Compare commits
15 Commits
e98bc6daba
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
10906c7fcf | ||
|
|
148c8a0716 | ||
|
|
5ac6e4b5ea | ||
|
|
4f3a964e42 | ||
|
|
e97cbf946c | ||
|
|
7040f7d16c | ||
|
|
0b78c0c95f | ||
|
|
b4da99b909 | ||
|
|
8f22556eef | ||
|
|
59620cb762 | ||
|
|
6bfefcb865 | ||
|
|
d0b09c2729 | ||
|
|
bb9b2877cb | ||
|
|
27c6466224 | ||
|
|
fa3dcbc1f1 |
234
README.md
234
README.md
@@ -1,233 +1,3 @@
|
|||||||
# kickstart.nvim
|
# Neovim config
|
||||||
|
|
||||||
## Introduction
|
|
||||||
|
|
||||||
A starting point for Neovim that is:
|
|
||||||
|
|
||||||
* Small
|
|
||||||
* Single-file
|
|
||||||
* Completely Documented
|
|
||||||
|
|
||||||
**NOT** a Neovim distribution, but instead a starting point for your configuration.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
### Install Neovim
|
|
||||||
|
|
||||||
Kickstart.nvim targets *only* the latest
|
|
||||||
['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest
|
|
||||||
['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim.
|
|
||||||
If you are experiencing issues, please make sure you have the latest versions.
|
|
||||||
|
|
||||||
### Install External Dependencies
|
|
||||||
|
|
||||||
External Requirements:
|
|
||||||
- Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`)
|
|
||||||
- [ripgrep](https://github.com/BurntSushi/ripgrep#installation)
|
|
||||||
- Clipboard tool (xclip/xsel/win32yank or other depending on platform)
|
|
||||||
- A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons
|
|
||||||
- if you have it set `vim.g.have_nerd_font` in `init.lua` to true
|
|
||||||
- Language Setup:
|
|
||||||
- If you want to write Typescript, you need `npm`
|
|
||||||
- If you want to write Golang, you will need `go`
|
|
||||||
- etc.
|
|
||||||
|
|
||||||
> **NOTE**
|
|
||||||
> See [Install Recipes](#Install-Recipes) for additional Windows and Linux specific notes
|
|
||||||
> and quick install snippets
|
|
||||||
|
|
||||||
### Install Kickstart
|
|
||||||
|
|
||||||
> **NOTE**
|
|
||||||
> [Backup](#FAQ) your previous configuration (if any exists)
|
|
||||||
|
|
||||||
Neovim's configurations are located under the following paths, depending on your OS:
|
|
||||||
|
|
||||||
| OS | PATH |
|
|
||||||
| :- | :--- |
|
|
||||||
| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
|
|
||||||
| Windows (cmd)| `%localappdata%\nvim\` |
|
|
||||||
| Windows (powershell)| `$env:LOCALAPPDATA\nvim\` |
|
|
||||||
|
|
||||||
#### Recommended Step
|
|
||||||
|
|
||||||
[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo
|
|
||||||
so that you have your own copy that you can modify, then install by cloning the
|
|
||||||
fork to your machine using one of the commands below, depending on your OS.
|
|
||||||
|
|
||||||
> **NOTE**
|
|
||||||
> Your fork's url will be something like this:
|
|
||||||
> `https://github.com/<your_github_username>/kickstart.nvim.git`
|
|
||||||
|
|
||||||
You likely want to remove `lazy-lock.json` from your fork's `.gitignore` file
|
|
||||||
too - it's ignored in the kickstart repo to make maintenance easier, but it's
|
|
||||||
[recommmended to track it in version control](https://lazy.folke.io/usage/lockfile).
|
|
||||||
|
|
||||||
#### Clone kickstart.nvim
|
|
||||||
> **NOTE**
|
|
||||||
> If following the recommended step above (i.e., forking the repo), replace
|
|
||||||
> `nvim-lua` with `<your_github_username>` in the commands below
|
|
||||||
|
|
||||||
<details><summary> Linux and Mac </summary>
|
|
||||||
|
|
||||||
```sh
|
|
||||||
git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details><summary> Windows </summary>
|
|
||||||
|
|
||||||
If you're using `cmd.exe`:
|
|
||||||
|
|
||||||
```
|
|
||||||
git clone https://github.com/nvim-lua/kickstart.nvim.git "%localappdata%\nvim"
|
|
||||||
```
|
|
||||||
|
|
||||||
If you're using `powershell.exe`
|
|
||||||
|
|
||||||
```
|
|
||||||
git clone https://github.com/nvim-lua/kickstart.nvim.git "${env:LOCALAPPDATA}\nvim"
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### Post Installation
|
|
||||||
|
|
||||||
Start Neovim
|
|
||||||
|
|
||||||
```sh
|
|
||||||
nvim
|
|
||||||
```
|
|
||||||
|
|
||||||
That's it! Lazy will install all the plugins you have. Use `:Lazy` to view
|
|
||||||
current plugin status. Hit `q` to close the window.
|
|
||||||
|
|
||||||
Read through the `init.lua` file in your configuration folder for more
|
|
||||||
information about extending and exploring Neovim. That also includes
|
|
||||||
examples of adding popularly requested plugins.
|
|
||||||
|
|
||||||
|
|
||||||
### Getting Started
|
|
||||||
|
|
||||||
[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o)
|
|
||||||
|
|
||||||
### FAQ
|
|
||||||
|
|
||||||
* What should I do if I already have a pre-existing neovim configuration?
|
|
||||||
* You should back it up and then delete all associated files.
|
|
||||||
* This includes your existing init.lua and the neovim files in `~/.local`
|
|
||||||
which can be deleted with `rm -rf ~/.local/share/nvim/`
|
|
||||||
* Can I keep my existing configuration in parallel to kickstart?
|
|
||||||
* Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME`
|
|
||||||
to maintain multiple configurations. For example, you can install the kickstart
|
|
||||||
configuration in `~/.config/nvim-kickstart` and create an alias:
|
|
||||||
```
|
|
||||||
alias nvim-kickstart='NVIM_APPNAME="nvim-kickstart" nvim'
|
|
||||||
```
|
|
||||||
When you run Neovim using `nvim-kickstart` alias it will use the alternative
|
|
||||||
config directory and the matching local directory
|
|
||||||
`~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim
|
|
||||||
distribution that you would like to try out.
|
|
||||||
* What if I want to "uninstall" this configuration:
|
|
||||||
* See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information
|
|
||||||
* Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files?
|
|
||||||
* The main purpose of kickstart is to serve as a teaching tool and a reference
|
|
||||||
configuration that someone can easily use to `git clone` as a basis for their own.
|
|
||||||
As you progress in learning Neovim and Lua, you might consider splitting `init.lua`
|
|
||||||
into smaller parts. A fork of kickstart that does this while maintaining the
|
|
||||||
same functionality is available here:
|
|
||||||
* [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim)
|
|
||||||
* Discussions on this topic can be found here:
|
|
||||||
* [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218)
|
|
||||||
* [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473)
|
|
||||||
|
|
||||||
### Install Recipes
|
|
||||||
|
|
||||||
Below you can find OS specific install instructions for Neovim and dependencies.
|
|
||||||
|
|
||||||
After installing all the dependencies continue with the [Install Kickstart](#Install-Kickstart) step.
|
|
||||||
|
|
||||||
#### Windows Installation
|
|
||||||
|
|
||||||
<details><summary>Windows with Microsoft C++ Build Tools and CMake</summary>
|
|
||||||
Installation may require installing build tools and updating the run command for `telescope-fzf-native`
|
|
||||||
|
|
||||||
See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation)
|
|
||||||
|
|
||||||
This requires:
|
|
||||||
|
|
||||||
- Install CMake and the Microsoft C++ Build Tools on Windows
|
|
||||||
|
|
||||||
```lua
|
|
||||||
{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
<details><summary>Windows with gcc/make using chocolatey</summary>
|
|
||||||
Alternatively, one can install gcc and make which don't require changing the config,
|
|
||||||
the easiest way is to use choco:
|
|
||||||
|
|
||||||
1. install [chocolatey](https://chocolatey.org/install)
|
|
||||||
either follow the instructions on the page or use winget,
|
|
||||||
run in cmd as **admin**:
|
|
||||||
```
|
|
||||||
winget install --accept-source-agreements chocolatey.chocolatey
|
|
||||||
```
|
|
||||||
|
|
||||||
2. install all requirements using choco, exit previous cmd and
|
|
||||||
open a new one so that choco path is set, and run in cmd as **admin**:
|
|
||||||
```
|
|
||||||
choco install -y neovim git ripgrep wget fd unzip gzip mingw make
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
<details><summary>WSL (Windows Subsystem for Linux)</summary>
|
|
||||||
|
|
||||||
```
|
|
||||||
wsl --install
|
|
||||||
wsl
|
|
||||||
sudo add-apt-repository ppa:neovim-ppa/unstable -y
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install make gcc ripgrep unzip git xclip neovim
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
|
|
||||||
#### Linux Install
|
|
||||||
<details><summary>Ubuntu Install Steps</summary>
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo add-apt-repository ppa:neovim-ppa/unstable -y
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install make gcc ripgrep unzip git xclip neovim
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
<details><summary>Debian Install Steps</summary>
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install make gcc ripgrep unzip git xclip curl
|
|
||||||
|
|
||||||
# Now we install nvim
|
|
||||||
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz
|
|
||||||
sudo rm -rf /opt/nvim-linux64
|
|
||||||
sudo mkdir -p /opt/nvim-linux64
|
|
||||||
sudo chmod a+rX /opt/nvim-linux64
|
|
||||||
sudo tar -C /opt -xzf nvim-linux64.tar.gz
|
|
||||||
|
|
||||||
# make it available in /usr/local/bin, distro installs to /usr/bin
|
|
||||||
sudo ln -sf /opt/nvim-linux64/bin/nvim /usr/local/bin/
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
<details><summary>Fedora Install Steps</summary>
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo dnf install -y gcc make git ripgrep fd-find unzip neovim
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details><summary>Arch Install Steps</summary>
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
|
|
||||||
|
This is my fork of kickstart.nvim!
|
||||||
|
|||||||
65
clean.sh
Executable file
65
clean.sh
Executable file
@@ -0,0 +1,65 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SRC_DIRS=(
|
||||||
|
"$HOME/.local/share/nvim"
|
||||||
|
"$HOME/.local/state/nvim"
|
||||||
|
"$HOME/.cache/nvim"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Ask if user wants to backup
|
||||||
|
printf "Do you want to backup before cleaning? [Y/n]: "
|
||||||
|
read -r BACKUP_CHOICE
|
||||||
|
case ${BACKUP_CHOICE:-} in
|
||||||
|
[nN]|[nN][oO])
|
||||||
|
BACKUP=false
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
BACKUP=true
|
||||||
|
TAG=.bak-$(date +%Y-%m-%d_%H-%M-%S)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Show plan and confirm
|
||||||
|
printf "\n"
|
||||||
|
if [ "$BACKUP" = true ]; then
|
||||||
|
printf "This will back up and clean your Neovim directories.\n"
|
||||||
|
printf "Backup suffix to be appended: %s\n\n" "$TAG"
|
||||||
|
printf "Plan:\n"
|
||||||
|
for SRC in "${SRC_DIRS[@]}"; do
|
||||||
|
if [ -e "$SRC" ]; then
|
||||||
|
DEST="${SRC}${TAG}"
|
||||||
|
printf " %s ➡️ %s\n" "$SRC" "$DEST"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
printf "This will remove your Neovim directories WITHOUT backup.\n\n"
|
||||||
|
printf "Plan:\n"
|
||||||
|
for SRC in "${SRC_DIRS[@]}"; do
|
||||||
|
if [ -e "$SRC" ]; then
|
||||||
|
printf " %s ❌\n" "$SRC"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "\n"
|
||||||
|
read -r -p "Are you sure you want to proceed? [y/N]: " CONFIRM
|
||||||
|
case ${CONFIRM:-} in
|
||||||
|
[yY]|[yY][eE][sS]) ;;
|
||||||
|
*) printf "Aborted!\n"; exit 0;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Perform action based on backup choice
|
||||||
|
for SRC in "${SRC_DIRS[@]}"; do
|
||||||
|
if [ -e "$SRC" ]; then
|
||||||
|
if [ "$BACKUP" = true ]; then
|
||||||
|
DEST="${SRC}${TAG}"
|
||||||
|
mv "$SRC" "$DEST"
|
||||||
|
else
|
||||||
|
rm -rf "$SRC"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
printf "Done!"
|
||||||
374
init.lua
374
init.lua
@@ -7,12 +7,12 @@ require 'keymaps'
|
|||||||
|
|
||||||
-- Highlight when yanking (copying) text
|
-- Highlight when yanking (copying) text
|
||||||
-- Try it with `yap` in normal mode
|
-- Try it with `yap` in normal mode
|
||||||
-- See `:help vim.highlight.on_yank()`
|
-- See `:help vim.hl.on_yank()`
|
||||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||||
desc = 'Highlight when yanking (copying) text',
|
desc = 'Highlight when yanking (copying) text',
|
||||||
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.highlight.on_yank()
|
vim.hl.on_yank()
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -25,8 +25,11 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
|||||||
if vim.v.shell_error ~= 0 then
|
if vim.v.shell_error ~= 0 then
|
||||||
error('Error cloning lazy.nvim:\n' .. out)
|
error('Error cloning lazy.nvim:\n' .. out)
|
||||||
end
|
end
|
||||||
end ---@diagnostic disable-next-line: undefined-field
|
end
|
||||||
vim.opt.rtp:prepend(lazypath)
|
|
||||||
|
---@type vim.Option
|
||||||
|
local rtp = vim.opt.rtp
|
||||||
|
rtp:prepend(lazypath)
|
||||||
|
|
||||||
-- [[ Configure and install plugins ]]
|
-- [[ Configure and install plugins ]]
|
||||||
--
|
--
|
||||||
@@ -38,20 +41,21 @@ vim.opt.rtp:prepend(lazypath)
|
|||||||
-- To update plugins you can run
|
-- To update plugins you can run
|
||||||
-- :Lazy update
|
-- :Lazy update
|
||||||
--
|
--
|
||||||
-- NOTE: Here is where you install your plugins.
|
|
||||||
require('lazy').setup({
|
require('lazy').setup({
|
||||||
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
|
'NMAC427/guess-indent.nvim', -- Detect tabstop and shiftwidth automatically
|
||||||
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
|
|
||||||
|
|
||||||
{ -- Useful plugin to show you pending keybinds.
|
{ -- Useful plugin to show you pending keybinds.
|
||||||
'folke/which-key.nvim',
|
'folke/which-key.nvim',
|
||||||
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
|
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
|
||||||
opts = {
|
opts = {
|
||||||
|
-- delay between pressing a key and opening which-key (milliseconds)
|
||||||
|
-- this setting is independent of vim.o.timeoutlen
|
||||||
|
delay = 0,
|
||||||
icons = {
|
icons = {
|
||||||
-- set icon mappings to true if you have a Nerd Font
|
-- set icon mappings to true if you have a Nerd Font
|
||||||
mappings = vim.g.have_nerd_font,
|
mappings = vim.g.have_nerd_font,
|
||||||
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
|
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
|
||||||
-- default whick-key.nvim defined Nerd Font icons, otherwise define a string table
|
-- default which-key.nvim defined Nerd Font icons, otherwise define a string table
|
||||||
keys = vim.g.have_nerd_font and {} or {
|
keys = vim.g.have_nerd_font and {} or {
|
||||||
Up = '<Up> ',
|
Up = '<Up> ',
|
||||||
Down = '<Down> ',
|
Down = '<Down> ',
|
||||||
@@ -86,31 +90,18 @@ require('lazy').setup({
|
|||||||
|
|
||||||
-- Document existing key chains
|
-- Document existing key chains
|
||||||
spec = {
|
spec = {
|
||||||
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
|
|
||||||
{ '<leader>d', group = '[D]ocument' },
|
|
||||||
{ '<leader>r', group = '[R]ename' },
|
|
||||||
{ '<leader>s', group = '[S]earch' },
|
{ '<leader>s', group = '[S]earch' },
|
||||||
{ '<leader>w', group = '[W]orkspace' },
|
|
||||||
{ '<leader>t', group = '[T]oggle' },
|
{ '<leader>t', group = '[T]oggle' },
|
||||||
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
|
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
-- NOTE: Plugins can specify dependencies.
|
|
||||||
--
|
|
||||||
-- The dependencies are proper plugin specifications as well - anything
|
|
||||||
-- you do for a plugin at the top level, you can do for a dependency.
|
|
||||||
--
|
|
||||||
-- Use the `dependencies` key to specify the dependencies of a particular plugin
|
|
||||||
|
|
||||||
{ -- Fuzzy Finder (files, lsp, etc)
|
{ -- Fuzzy Finder (files, lsp, etc)
|
||||||
'nvim-telescope/telescope.nvim',
|
'nvim-telescope/telescope.nvim',
|
||||||
event = 'VimEnter',
|
event = 'VimEnter',
|
||||||
branch = '0.1.x',
|
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-lua/plenary.nvim',
|
'nvim-lua/plenary.nvim',
|
||||||
|
|
||||||
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
|
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
|
||||||
'nvim-telescope/telescope-fzf-native.nvim',
|
'nvim-telescope/telescope-fzf-native.nvim',
|
||||||
|
|
||||||
@@ -124,7 +115,6 @@ require('lazy').setup({
|
|||||||
return vim.fn.executable 'make' == 1
|
return vim.fn.executable 'make' == 1
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ 'nvim-telescope/telescope-ui-select.nvim' },
|
{ 'nvim-telescope/telescope-ui-select.nvim' },
|
||||||
|
|
||||||
-- Useful for getting pretty icons, but requires a Nerd Font.
|
-- Useful for getting pretty icons, but requires a Nerd Font.
|
||||||
@@ -178,7 +168,7 @@ require('lazy').setup({
|
|||||||
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
||||||
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
||||||
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
|
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
|
||||||
vim.keymap.set('n', '<leader>st', builtin.builtin, { desc = '[S]earch Select [T]elescope' })
|
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
|
||||||
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
|
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
|
||||||
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
|
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
|
||||||
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
|
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||||
@@ -220,54 +210,28 @@ require('lazy').setup({
|
|||||||
opts = {
|
opts = {
|
||||||
library = {
|
library = {
|
||||||
-- Load luvit types when the `vim.uv` word is found
|
-- Load luvit types when the `vim.uv` word is found
|
||||||
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
|
{ path = '${3rd}/luv/library', words = { 'vim%.uv' } },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ 'Bilal2453/luvit-meta', lazy = true },
|
|
||||||
{
|
{
|
||||||
-- Main LSP Configuration
|
-- Main LSP Configuration
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
-- Automatically install LSPs and related tools to stdpath for Neovim
|
-- Automatically install LSPs and related tools to stdpath for Neovim
|
||||||
|
-- Mason must be loaded before its dependents so we need to set it up here.
|
||||||
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
|
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
|
||||||
{ 'mason-org/mason.nvim', opts = {} },
|
{ 'mason-org/mason.nvim', opts = {} },
|
||||||
'williamboman/mason-lspconfig.nvim',
|
'mason-org/mason-lspconfig.nvim',
|
||||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||||
|
|
||||||
-- Useful status updates for LSP.
|
-- Useful status updates for LSP.
|
||||||
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
|
||||||
{ 'j-hui/fidget.nvim', opts = {} },
|
{ 'j-hui/fidget.nvim', opts = {} },
|
||||||
|
|
||||||
-- Allows extra capabilities provided by nvim-cmp
|
-- Allows extra capabilities provided by blink.cmp
|
||||||
'hrsh7th/cmp-nvim-lsp',
|
'saghen/blink.cmp',
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
-- Brief aside: **What is LSP?**
|
|
||||||
--
|
|
||||||
-- LSP is an initialism you've probably heard, but might not understand what it is.
|
|
||||||
--
|
|
||||||
-- LSP stands for Language Server Protocol. It's a protocol that helps editors
|
|
||||||
-- and language tooling communicate in a standardized fashion.
|
|
||||||
--
|
|
||||||
-- In general, you have a "server" which is some tool built to understand a particular
|
|
||||||
-- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers
|
|
||||||
-- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone
|
|
||||||
-- processes that communicate with some "client" - in this case, Neovim!
|
|
||||||
--
|
|
||||||
-- LSP provides Neovim with features like:
|
|
||||||
-- - Go to definition
|
|
||||||
-- - Find references
|
|
||||||
-- - Autocompletion
|
|
||||||
-- - Symbol Search
|
|
||||||
-- - and more!
|
|
||||||
--
|
|
||||||
-- Thus, Language Servers are external tools that must be installed separately from
|
|
||||||
-- Neovim. This is where `mason` and related plugins come into play.
|
|
||||||
--
|
|
||||||
-- If you're wondering about lsp vs treesitter, you can check out the wonderfully
|
|
||||||
-- and elegantly composed help section, `:help lsp-vs-treesitter`
|
|
||||||
|
|
||||||
-- This function gets run when an LSP attaches to a particular buffer.
|
-- This function gets run when an LSP attaches to a particular buffer.
|
||||||
-- That is to say, every time a new file is opened that is associated with
|
-- That is to say, every time a new file is opened that is associated with
|
||||||
-- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
|
-- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
|
||||||
@@ -285,42 +249,55 @@ require('lazy').setup({
|
|||||||
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
|
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Jump to the definition of the word under your cursor.
|
-- Rename the variable under your cursor.
|
||||||
-- This is where a variable was first declared, or where a function is defined, etc.
|
-- Most Language Servers support renaming across files, etc.
|
||||||
-- To jump back, press <C-t>.
|
map('grn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||||
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
|
||||||
|
-- Execute a code action, usually your cursor needs to be on top of an error
|
||||||
|
-- or a suggestion from your LSP for this to activate.
|
||||||
|
map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' })
|
||||||
|
|
||||||
-- Find references for the word under your cursor.
|
-- Find references for the word under your cursor.
|
||||||
map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||||
|
|
||||||
-- Jump to the implementation of the word under your cursor.
|
-- Jump to the implementation of the word under your cursor.
|
||||||
-- Useful when your language has ways of declaring types without an actual implementation.
|
-- Useful when your language has ways of declaring types without an actual implementation.
|
||||||
map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
||||||
|
|
||||||
|
-- Jump to the definition of the word under your cursor.
|
||||||
|
-- This is where a variable was first declared, or where a function is defined, etc.
|
||||||
|
-- To jump back, press <C-t>.
|
||||||
|
map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
||||||
|
|
||||||
|
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
||||||
|
-- For example, in C this would take you to the header.
|
||||||
|
map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||||
|
|
||||||
|
-- Fuzzy find all the symbols in your current document.
|
||||||
|
-- Symbols are things like variables, functions, types, etc.
|
||||||
|
map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols')
|
||||||
|
|
||||||
|
-- Fuzzy find all the symbols in your current workspace.
|
||||||
|
-- Similar to document symbols, except searches over your entire project.
|
||||||
|
map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols')
|
||||||
|
|
||||||
-- Jump to the type of the word under your cursor.
|
-- Jump to the type of the word under your cursor.
|
||||||
-- Useful when you're not sure what type a variable is and you want to see
|
-- Useful when you're not sure what type a variable is and you want to see
|
||||||
-- the definition of its *type*, not where it was *defined*.
|
-- the definition of its *type*, not where it was *defined*.
|
||||||
map('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
|
map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition')
|
||||||
|
|
||||||
-- Fuzzy find all the symbols in your current document.
|
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
|
||||||
-- Symbols are things like variables, functions, types, etc.
|
---@param client vim.lsp.Client
|
||||||
map('<leader>ss', require('telescope.builtin').lsp_document_symbols, '[S]earch Document [S]ymbols')
|
---@param method vim.lsp.protocol.Method
|
||||||
|
---@param bufnr? integer some lsp support methods only in specific files
|
||||||
-- Fuzzy find all the symbols in your current workspace.
|
---@return boolean
|
||||||
-- Similar to document symbols, except searches over your entire project.
|
local function client_supports_method(client, method, bufnr)
|
||||||
map('<leader>se', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[S]earch Symbols [E]verywhere')
|
if vim.fn.has 'nvim-0.11' == 1 then
|
||||||
|
return client:supports_method(method, bufnr)
|
||||||
-- Rename the variable under your cursor.
|
else
|
||||||
-- Most Language Servers support renaming across files, etc.
|
return client.supports_method(method, { bufnr = bufnr })
|
||||||
map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
end
|
||||||
|
end
|
||||||
-- Execute a code action, usually your cursor needs to be on top of an error
|
|
||||||
-- or a suggestion from your LSP for this to activate.
|
|
||||||
map('<leader>ac', vim.lsp.buf.code_action, 'Code [Ac]tion', { 'n', 'x' })
|
|
||||||
|
|
||||||
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
|
||||||
-- For example, in C this would take you to the header.
|
|
||||||
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
|
||||||
|
|
||||||
-- The following two autocommands are used to highlight references of the
|
-- The following two autocommands are used to highlight references of the
|
||||||
-- word under your cursor when your cursor rests there for a little while.
|
-- word under your cursor when your cursor rests there for a little while.
|
||||||
@@ -328,7 +305,7 @@ require('lazy').setup({
|
|||||||
--
|
--
|
||||||
-- When you move your cursor, the highlights will be cleared (the second autocommand).
|
-- When you move your cursor, the highlights will be cleared (the second autocommand).
|
||||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||||
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
|
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then
|
||||||
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
|
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
|
||||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||||
buffer = event.buf,
|
buffer = event.buf,
|
||||||
@@ -355,7 +332,7 @@ require('lazy').setup({
|
|||||||
-- code, if the language server you are using supports them
|
-- code, if the language server you are using supports them
|
||||||
--
|
--
|
||||||
-- This may be unwanted, since they displace some of your code
|
-- This may be unwanted, since they displace some of your code
|
||||||
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
|
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
|
||||||
map('<leader>th', function()
|
map('<leader>th', function()
|
||||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
|
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
|
||||||
end, '[T]oggle Inlay [H]ints')
|
end, '[T]oggle Inlay [H]ints')
|
||||||
@@ -363,16 +340,42 @@ require('lazy').setup({
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Diagnostic Config
|
||||||
|
-- See :help vim.diagnostic.Opts
|
||||||
|
vim.diagnostic.config {
|
||||||
|
severity_sort = true,
|
||||||
|
float = { border = 'rounded', source = 'if_many' },
|
||||||
|
underline = { severity = vim.diagnostic.severity.ERROR },
|
||||||
|
signs = vim.g.have_nerd_font and {
|
||||||
|
text = {
|
||||||
|
[vim.diagnostic.severity.ERROR] = ' ',
|
||||||
|
[vim.diagnostic.severity.WARN] = ' ',
|
||||||
|
[vim.diagnostic.severity.INFO] = ' ',
|
||||||
|
[vim.diagnostic.severity.HINT] = ' ',
|
||||||
|
},
|
||||||
|
} or {},
|
||||||
|
virtual_text = {
|
||||||
|
source = 'if_many',
|
||||||
|
spacing = 2,
|
||||||
|
format = function(diagnostic)
|
||||||
|
local diagnostic_message = {
|
||||||
|
[vim.diagnostic.severity.ERROR] = diagnostic.message,
|
||||||
|
[vim.diagnostic.severity.WARN] = diagnostic.message,
|
||||||
|
[vim.diagnostic.severity.INFO] = diagnostic.message,
|
||||||
|
[vim.diagnostic.severity.HINT] = diagnostic.message,
|
||||||
|
}
|
||||||
|
return diagnostic_message[diagnostic.severity]
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
-- LSP servers and clients are able to communicate to each other what features they support.
|
-- LSP servers and clients are able to communicate to each other what features they support.
|
||||||
-- By default, Neovim doesn't support everything that is in the LSP specification.
|
-- By default, Neovim doesn't support everything that is in the LSP specification.
|
||||||
-- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
|
-- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
|
||||||
-- So, we create new capabilities with nvim cmp, and then broadcast that to the servers.
|
-- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
local capabilities = require('blink.cmp').get_lsp_capabilities()
|
||||||
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
|
|
||||||
|
|
||||||
-- Enable the following language servers
|
-- Enable the following language servers
|
||||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
|
||||||
--
|
|
||||||
-- Add any additional override configuration in the following tables. Available keys are:
|
-- Add any additional override configuration in the following tables. Available keys are:
|
||||||
-- - cmd (table): Override the default command used to start the server
|
-- - cmd (table): Override the default command used to start the server
|
||||||
-- - filetypes (table): Override the default list of associated filetypes for the server
|
-- - filetypes (table): Override the default list of associated filetypes for the server
|
||||||
@@ -392,11 +395,9 @@ require('lazy').setup({
|
|||||||
-- But for many setups, the LSP (`ts_ls`) will work just fine
|
-- But for many setups, the LSP (`ts_ls`) will work just fine
|
||||||
ts_ls = {},
|
ts_ls = {},
|
||||||
|
|
||||||
graphql = {},
|
|
||||||
|
|
||||||
lua_ls = {
|
lua_ls = {
|
||||||
-- cmd = {...},
|
-- cmd = { ... },
|
||||||
-- filetypes = { ...},
|
-- filetypes = { ... },
|
||||||
-- capabilities = {},
|
-- capabilities = {},
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
@@ -419,7 +420,6 @@ require('lazy').setup({
|
|||||||
require('mason-lspconfig').setup {
|
require('mason-lspconfig').setup {
|
||||||
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
|
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
|
||||||
automatic_installation = false,
|
automatic_installation = false,
|
||||||
automatic_enable = false,
|
|
||||||
handlers = {
|
handlers = {
|
||||||
function(server_name)
|
function(server_name)
|
||||||
local server = servers[server_name] or {}
|
local server = servers[server_name] or {}
|
||||||
@@ -455,16 +455,14 @@ require('lazy').setup({
|
|||||||
-- have a well standardized coding style. You can add additional
|
-- have a well standardized coding style. You can add additional
|
||||||
-- languages here or re-enable it for the disabled ones.
|
-- languages here or re-enable it for the disabled ones.
|
||||||
local disable_filetypes = { c = true, cpp = true }
|
local disable_filetypes = { c = true, cpp = true }
|
||||||
local lsp_format_opt
|
|
||||||
if disable_filetypes[vim.bo[bufnr].filetype] then
|
if disable_filetypes[vim.bo[bufnr].filetype] then
|
||||||
lsp_format_opt = 'never'
|
return nil
|
||||||
else
|
else
|
||||||
lsp_format_opt = 'fallback'
|
return {
|
||||||
|
timeout_ms = 500,
|
||||||
|
lsp_format = 'fallback',
|
||||||
|
}
|
||||||
end
|
end
|
||||||
return {
|
|
||||||
timeout_ms = 500,
|
|
||||||
lsp_format = lsp_format_opt,
|
|
||||||
}
|
|
||||||
end,
|
end,
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
lua = { 'stylua' },
|
lua = { 'stylua' },
|
||||||
@@ -473,18 +471,19 @@ require('lazy').setup({
|
|||||||
--
|
--
|
||||||
-- You can use 'stop_after_first' to run the first available formatter from the list
|
-- You can use 'stop_after_first' to run the first available formatter from the list
|
||||||
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||||
go = { 'goimports', 'gofmt' },
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- Autocompletion
|
{ -- Autocompletion
|
||||||
'hrsh7th/nvim-cmp',
|
'saghen/blink.cmp',
|
||||||
event = 'InsertEnter',
|
event = 'VimEnter',
|
||||||
|
version = '1.*',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
-- Snippet Engine & its associated nvim-cmp source
|
-- Snippet Engine
|
||||||
{
|
{
|
||||||
'L3MON4D3/LuaSnip',
|
'L3MON4D3/LuaSnip',
|
||||||
|
version = '2.*',
|
||||||
build = (function()
|
build = (function()
|
||||||
-- Build Step is needed for regex support in snippets.
|
-- Build Step is needed for regex support in snippets.
|
||||||
-- This step is not supported in many windows environments.
|
-- This step is not supported in many windows environments.
|
||||||
@@ -495,103 +494,82 @@ require('lazy').setup({
|
|||||||
return 'make install_jsregexp'
|
return 'make install_jsregexp'
|
||||||
end)(),
|
end)(),
|
||||||
dependencies = {
|
dependencies = {
|
||||||
-- `friendly-snippets` contains a variety of premade snippets.
|
{
|
||||||
-- See the README about individual language/framework/plugin snippets:
|
'rafamadriz/friendly-snippets',
|
||||||
-- https://github.com/rafamadriz/friendly-snippets
|
config = function()
|
||||||
-- {
|
require('luasnip.loaders.from_vscode').lazy_load()
|
||||||
-- 'rafamadriz/friendly-snippets',
|
end,
|
||||||
-- config = function()
|
},
|
||||||
-- require('luasnip.loaders.from_vscode').lazy_load()
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
},
|
},
|
||||||
|
opts = {},
|
||||||
},
|
},
|
||||||
'saadparwaiz1/cmp_luasnip',
|
'folke/lazydev.nvim',
|
||||||
|
|
||||||
-- Adds other completion capabilities.
|
|
||||||
-- nvim-cmp does not ship with all sources by default. They are split
|
|
||||||
-- into multiple repos for maintenance purposes.
|
|
||||||
'hrsh7th/cmp-nvim-lsp',
|
|
||||||
'hrsh7th/cmp-path',
|
|
||||||
},
|
},
|
||||||
config = function()
|
--- @module 'blink.cmp'
|
||||||
-- See `:help cmp`
|
--- @type blink.cmp.Config
|
||||||
local cmp = require 'cmp'
|
opts = {
|
||||||
local luasnip = require 'luasnip'
|
keymap = {
|
||||||
luasnip.config.setup {}
|
-- 'default' (recommended) for mappings similar to built-in completions
|
||||||
|
-- <c-y> to accept ([y]es) the completion.
|
||||||
cmp.setup {
|
-- This will auto-import if your LSP supports it.
|
||||||
snippet = {
|
-- This will expand snippets if the LSP sent a snippet.
|
||||||
expand = function(args)
|
-- 'super-tab' for tab to accept
|
||||||
luasnip.lsp_expand(args.body)
|
-- 'enter' for enter to accept
|
||||||
end,
|
-- 'none' for no mappings
|
||||||
},
|
--
|
||||||
completion = { completeopt = 'menu,menuone,noinsert' },
|
-- For an understanding of why the 'default' preset is recommended,
|
||||||
|
-- you will need to read `:help ins-completion`
|
||||||
-- For an understanding of why these mappings were
|
|
||||||
-- chosen, you will need to read `:help ins-completion`
|
|
||||||
--
|
--
|
||||||
-- No, but seriously. Please read `:help ins-completion`, it is really good!
|
-- No, but seriously. Please read `:help ins-completion`, it is really good!
|
||||||
mapping = cmp.mapping.preset.insert {
|
--
|
||||||
-- Select the [n]ext item
|
-- All presets have the following mappings:
|
||||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
-- <tab>/<s-tab>: move to right/left of your snippet expansion
|
||||||
-- Select the [p]revious item
|
-- <c-space>: Open menu or open docs if already open
|
||||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
-- <c-n>/<c-p> or <up>/<down>: Select next/previous item
|
||||||
|
-- <c-e>: Hide menu
|
||||||
|
-- <c-k>: Toggle signature help
|
||||||
|
--
|
||||||
|
-- See :h blink-cmp-config-keymap for defining your own keymap
|
||||||
|
preset = 'default',
|
||||||
|
|
||||||
-- Scroll the documentation window [b]ack / [f]orward
|
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
||||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
||||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
},
|
||||||
|
|
||||||
-- Accept ([y]es) the completion.
|
appearance = {
|
||||||
-- This will auto-import if your LSP supports it.
|
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
||||||
-- This will expand snippets if the LSP sent a snippet.
|
-- Adjusts spacing to ensure icons are aligned
|
||||||
-- ['<C-y>'] = cmp.mapping.confirm { select = true },
|
nerd_font_variant = 'mono',
|
||||||
|
},
|
||||||
|
|
||||||
-- If you prefer more traditional completion keymaps,
|
completion = {
|
||||||
-- you can uncomment the following lines
|
-- By default, you may press `<c-space>` to show the documentation.
|
||||||
['<CR>'] = cmp.mapping.confirm { select = true },
|
-- Optionally, set `auto_show = true` to show the documentation after a delay.
|
||||||
-- ['<Tab>'] = cmp.mapping.select_next_item(),
|
documentation = { auto_show = false, auto_show_delay_ms = 500 },
|
||||||
-- ['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
},
|
||||||
|
|
||||||
-- Manually trigger a completion from nvim-cmp.
|
sources = {
|
||||||
-- Generally you don't need this, because nvim-cmp will display
|
default = { 'lsp', 'path', 'snippets', 'lazydev' },
|
||||||
-- completions whenever it has completion options available.
|
providers = {
|
||||||
['<C-Space>'] = cmp.mapping.complete {},
|
snippets = { score_offset = -100 },
|
||||||
|
lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 },
|
||||||
-- Think of <c-l> as moving to the right of your snippet expansion.
|
|
||||||
-- So if you have a snippet that's like:
|
|
||||||
-- function $name($args)
|
|
||||||
-- $body
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- <c-l> will move you to the right of each of the expansion locations.
|
|
||||||
-- <c-h> is similar, except moving you backwards.
|
|
||||||
['<C-l>'] = cmp.mapping(function()
|
|
||||||
if luasnip.expand_or_locally_jumpable() then
|
|
||||||
luasnip.expand_or_jump()
|
|
||||||
end
|
|
||||||
end, { 'i', 's' }),
|
|
||||||
['<C-h>'] = cmp.mapping(function()
|
|
||||||
if luasnip.locally_jumpable(-1) then
|
|
||||||
luasnip.jump(-1)
|
|
||||||
end
|
|
||||||
end, { 'i', 's' }),
|
|
||||||
|
|
||||||
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
|
||||||
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
|
||||||
},
|
},
|
||||||
sources = {
|
},
|
||||||
{
|
|
||||||
name = 'lazydev',
|
snippets = { preset = 'luasnip' },
|
||||||
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
|
|
||||||
group_index = 0,
|
-- Blink.cmp includes an optional, recommended rust fuzzy matcher,
|
||||||
},
|
-- which automatically downloads a prebuilt binary when enabled.
|
||||||
{ name = 'nvim_lsp' },
|
--
|
||||||
{ name = 'luasnip' },
|
-- By default, we use the Lua implementation instead, but you may enable
|
||||||
{ name = 'path' },
|
-- the rust implementation via `'prefer_rust_with_warning'`
|
||||||
},
|
--
|
||||||
}
|
-- See :h blink-cmp-config-fuzzy for more information
|
||||||
end,
|
fuzzy = { implementation = 'lua' },
|
||||||
|
|
||||||
|
-- Shows a signature help window while you type arguments for a function
|
||||||
|
signature = { enabled = true },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- You can easily change to a different colorscheme.
|
{ -- You can easily change to a different colorscheme.
|
||||||
@@ -601,14 +579,18 @@ require('lazy').setup({
|
|||||||
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
|
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
|
||||||
'folke/tokyonight.nvim',
|
'folke/tokyonight.nvim',
|
||||||
priority = 1000, -- Make sure to load this before all the other start plugins.
|
priority = 1000, -- Make sure to load this before all the other start plugins.
|
||||||
init = function()
|
config = function()
|
||||||
|
---@diagnostic disable-next-line: missing-fields
|
||||||
|
require('tokyonight').setup {
|
||||||
|
styles = {
|
||||||
|
comments = { italic = false }, -- Disable italics in comments
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
-- Load the colorscheme here.
|
-- Load the colorscheme here.
|
||||||
-- Like many other themes, this one has different styles, and you could load
|
-- Like many other themes, this one has different styles, and you could load
|
||||||
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
||||||
vim.cmd.colorscheme 'tokyonight-night'
|
vim.cmd.colorscheme 'tokyonight-night'
|
||||||
|
|
||||||
-- You can configure highlights by doing something like:
|
|
||||||
vim.cmd.hi 'Comment gui=none'
|
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -678,7 +660,7 @@ require('lazy').setup({
|
|||||||
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
||||||
},
|
},
|
||||||
|
|
||||||
-- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the
|
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
|
||||||
-- init.lua. If you want these files, they are in the repository, so you can just download them and
|
-- init.lua. If you want these files, they are in the repository, so you can just download them and
|
||||||
-- place them in the correct locations.
|
-- place them in the correct locations.
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
return {
|
|
||||||
'ray-x/lsp_signature.nvim',
|
|
||||||
event = 'InsertEnter',
|
|
||||||
opts = {
|
|
||||||
bind = true,
|
|
||||||
doc_lines = 0,
|
|
||||||
close_timeout = 1000,
|
|
||||||
handler_opts = {
|
|
||||||
border = 'rounded',
|
|
||||||
},
|
|
||||||
toggle_key = '<C-k>',
|
|
||||||
},
|
|
||||||
config = function(_, opts)
|
|
||||||
require('lsp_signature').setup(opts)
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
@@ -53,3 +53,7 @@ vim.keymap.set('n', '<leader>ch', function()
|
|||||||
print(('Deleted %d out of %d hidden buffers'):format(deleteCount, deleteCount + skipCount))
|
print(('Deleted %d out of %d hidden buffers'):format(deleteCount, deleteCount + skipCount))
|
||||||
end, bufinfos)
|
end, bufinfos)
|
||||||
end, { desc = '[C]lose [H]idden buffers' })
|
end, { desc = '[C]lose [H]idden buffers' })
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>tt', function()
|
||||||
|
vim.diagnostic.open_float(nil, { focus = false })
|
||||||
|
end, { desc = 'Toggle Trouble' })
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ return {
|
|||||||
local dap = require 'dap'
|
local dap = require 'dap'
|
||||||
local dapui = require 'dapui'
|
local dapui = require 'dapui'
|
||||||
local dapgo = require 'dap-go'
|
local dapgo = require 'dap-go'
|
||||||
|
local dapwidgets = require 'dap.ui.widgets'
|
||||||
|
|
||||||
return {
|
return {
|
||||||
-- Basic debugging keymaps, feel free to change to your liking!
|
-- Basic debugging keymaps, feel free to change to your liking!
|
||||||
@@ -34,7 +35,8 @@ return {
|
|||||||
desc = 'Debug: Set Breakpoint',
|
desc = 'Debug: Set Breakpoint',
|
||||||
},
|
},
|
||||||
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
||||||
{ '<leader>td', dapui.toggle, desc = 'Debug: [T]oggle [D]AP ui.' },
|
{ '<leader>td', dapui.toggle, desc = 'Debug: [T]oggle [D]AP ui' },
|
||||||
|
{ '<leader>ts', dapwidgets.sidebar(dapwidgets.sessions, nil, '5 sp').toggle, desc = 'Debug: [T]oggle [S]essions panel' }, -- show sessions panel
|
||||||
{ '<leader>rl', dap.run_last, desc = 'Debug: [R]un [l]ast' },
|
{ '<leader>rl', dap.run_last, desc = 'Debug: [R]un [l]ast' },
|
||||||
{ '<leader>rt', dapgo.debug_test, desc = 'Debug: [R]un [t]est' },
|
{ '<leader>rt', dapgo.debug_test, desc = 'Debug: [R]un [t]est' },
|
||||||
unpack(keys),
|
unpack(keys),
|
||||||
@@ -87,6 +89,28 @@ return {
|
|||||||
disconnect = '⏏',
|
disconnect = '⏏',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
layouts = {
|
||||||
|
{
|
||||||
|
elements = {
|
||||||
|
{ id = 'scopes', size = 0.25 },
|
||||||
|
{ id = 'breakpoints', size = 0.25 },
|
||||||
|
{ id = 'stacks', size = 0.25 },
|
||||||
|
{ id = 'watches', size = 0.25 },
|
||||||
|
},
|
||||||
|
size = 40, -- width of the panel
|
||||||
|
position = 'left',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
elements = {
|
||||||
|
{ id = 'repl', size = 1.0 },
|
||||||
|
-- mostly useless to me (Delve doesn't use it)
|
||||||
|
-- { id = "console", size = 0.25 }
|
||||||
|
},
|
||||||
|
size = 10, -- height of the panel
|
||||||
|
position = 'bottom',
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
vim.fn.sign_define('DapBreakpoint', { text = '🔴', texthl = '', linehl = '', numhl = '' })
|
vim.fn.sign_define('DapBreakpoint', { text = '🔴', texthl = '', linehl = '', numhl = '' })
|
||||||
@@ -96,8 +120,8 @@ return {
|
|||||||
vim.fn.sign_define('DapStopped', { text = '👉', texthl = '', linehl = '', numhl = '' })
|
vim.fn.sign_define('DapStopped', { text = '👉', texthl = '', linehl = '', numhl = '' })
|
||||||
|
|
||||||
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
|
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
|
||||||
-- dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
||||||
-- dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
||||||
|
|
||||||
-- Install golang specific config
|
-- Install golang specific config
|
||||||
require('dap-go').setup {
|
require('dap-go').setup {
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
|
||||||
-- NOTE: gitsigns is already included in init.lua but contains only the base
|
|
||||||
-- config. This will add also the recommended keymaps.
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
'lewis6991/gitsigns.nvim',
|
'lewis6991/gitsigns.nvim',
|
||||||
|
|||||||
@@ -1,77 +1,411 @@
|
|||||||
-- Neo-tree is a Neovim plugin to browse the file system
|
|
||||||
-- https://github.com/nvim-neo-tree/neo-tree.nvim
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'nvim-neo-tree/neo-tree.nvim',
|
-- If you want neo-tree's file operations to work with LSP (updating imports, etc.), you can use a plugin like
|
||||||
version = '*',
|
-- https://github.com/antosha417/nvim-lsp-file-operations:
|
||||||
dependencies = {
|
-- {
|
||||||
'nvim-lua/plenary.nvim',
|
-- "antosha417/nvim-lsp-file-operations",
|
||||||
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
|
-- dependencies = {
|
||||||
'MunifTanjim/nui.nvim',
|
-- "nvim-lua/plenary.nvim",
|
||||||
},
|
-- "nvim-neo-tree/neo-tree.nvim",
|
||||||
cmd = 'Neotree',
|
-- },
|
||||||
keys = {
|
-- config = function()
|
||||||
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
|
-- require("lsp-file-operations").setup()
|
||||||
},
|
-- end,
|
||||||
opts = {
|
-- },
|
||||||
filesystem = {
|
{
|
||||||
hijack_netrw_behavior = 'open_default',
|
'nvim-neo-tree/neo-tree.nvim',
|
||||||
window = {
|
branch = 'v3.x',
|
||||||
mappings = {
|
dependencies = {
|
||||||
['\\'] = 'close_window',
|
'nvim-lua/plenary.nvim',
|
||||||
},
|
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
|
||||||
},
|
'MunifTanjim/nui.nvim',
|
||||||
filtered_items = {
|
-- {"3rd/image.nvim", opts = {}}, -- Optional image support in preview window: See `# Preview Mode` for more information
|
||||||
visible = false,
|
{
|
||||||
hide_dotfiles = false,
|
's1n7ax/nvim-window-picker', -- for open_with_window_picker keymaps
|
||||||
hide_gitignored = true,
|
version = '2.*',
|
||||||
hide_by_name = {
|
config = function()
|
||||||
'.git',
|
require('window-picker').setup {
|
||||||
'.DS_Store',
|
filter_rules = {
|
||||||
},
|
include_current_win = false,
|
||||||
never_show = {},
|
autoselect_one = true,
|
||||||
always_show_by_pattern = {
|
-- filter using buffer options
|
||||||
'.env*',
|
bo = {
|
||||||
},
|
-- if the file type is one of following, the window will be ignored
|
||||||
},
|
filetype = { 'neo-tree', 'neo-tree-popup', 'notify' },
|
||||||
},
|
-- if the buffer type is one of following, the window will be ignored
|
||||||
|
buftype = { 'terminal', 'quickfix' },
|
||||||
buffers = {
|
},
|
||||||
follow_current_file = {
|
},
|
||||||
enabled = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
window = {
|
|
||||||
mappings = {
|
|
||||||
['<C-v>'] = 'open_vsplit',
|
|
||||||
['Y'] = function(state)
|
|
||||||
local node = state.tree:get_node()
|
|
||||||
local filepath = node:get_id()
|
|
||||||
local filename = node.name
|
|
||||||
|
|
||||||
local results = {
|
|
||||||
vim.fn.fnamemodify(filepath, ':.'),
|
|
||||||
filepath,
|
|
||||||
filename,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local i = vim.fn.inputlist {
|
|
||||||
'Choose what to copy:',
|
|
||||||
'1. ' .. results[1],
|
|
||||||
'2. ' .. results[2],
|
|
||||||
'3. ' .. results[3],
|
|
||||||
}
|
|
||||||
|
|
||||||
if i > 0 then
|
|
||||||
local result = results[i]
|
|
||||||
if not result then
|
|
||||||
return print('Invalid choice: ' .. i)
|
|
||||||
end
|
|
||||||
vim.fn.setreg('"', result)
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
lazy = false,
|
||||||
|
-----Instead of using `config`, you can use `opts` instead, if you'd like:
|
||||||
|
-----@module "neo-tree"
|
||||||
|
-----@type neotree.Config
|
||||||
|
--opts = {},
|
||||||
|
config = function()
|
||||||
|
-- If you want icons for diagnostic errors, you'll need to define them somewhere.
|
||||||
|
-- In Neovim v0.10+, you can configure them in vim.diagnostic.config(), like:
|
||||||
|
--
|
||||||
|
-- vim.diagnostic.config({
|
||||||
|
-- signs = {
|
||||||
|
-- text = {
|
||||||
|
-- [vim.diagnostic.severity.ERROR] = '',
|
||||||
|
-- [vim.diagnostic.severity.WARN] = '',
|
||||||
|
-- [vim.diagnostic.severity.INFO] = '',
|
||||||
|
-- [vim.diagnostic.severity.HINT] = '',
|
||||||
|
-- },
|
||||||
|
-- }
|
||||||
|
-- })
|
||||||
|
--
|
||||||
|
-- In older versions, you can define the signs manually:
|
||||||
|
-- vim.fn.sign_define("DiagnosticSignError", { text = " ", texthl = "DiagnosticSignError" })
|
||||||
|
-- vim.fn.sign_define("DiagnosticSignWarn", { text = " ", texthl = "DiagnosticSignWarn" })
|
||||||
|
-- vim.fn.sign_define("DiagnosticSignInfo", { text = " ", texthl = "DiagnosticSignInfo" })
|
||||||
|
-- vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" })
|
||||||
|
|
||||||
|
require('neo-tree').setup {
|
||||||
|
close_if_last_window = false, -- Close Neo-tree if it is the last window left in the tab
|
||||||
|
popup_border_style = 'NC', -- or "" to use 'winborder' on Neovim v0.11+
|
||||||
|
enable_git_status = true,
|
||||||
|
enable_diagnostics = true,
|
||||||
|
open_files_do_not_replace_types = { 'terminal', 'trouble', 'qf' }, -- when opening files, do not use windows containing these filetypes or buftypes
|
||||||
|
open_files_using_relative_paths = false,
|
||||||
|
sort_case_insensitive = false, -- used when sorting files and directories in the tree
|
||||||
|
sort_function = nil, -- use a custom function for sorting files and directories in the tree
|
||||||
|
-- sort_function = function (a,b)
|
||||||
|
-- if a.type == b.type then
|
||||||
|
-- return a.path > b.path
|
||||||
|
-- else
|
||||||
|
-- return a.type > b.type
|
||||||
|
-- end
|
||||||
|
-- end , -- this sorts files and directories descendantly
|
||||||
|
default_component_configs = {
|
||||||
|
container = {
|
||||||
|
enable_character_fade = true,
|
||||||
|
},
|
||||||
|
indent = {
|
||||||
|
indent_size = 2,
|
||||||
|
padding = 1, -- extra padding on left hand side
|
||||||
|
-- indent guides
|
||||||
|
with_markers = true,
|
||||||
|
indent_marker = '│',
|
||||||
|
last_indent_marker = '└',
|
||||||
|
highlight = 'NeoTreeIndentMarker',
|
||||||
|
-- expander config, needed for nesting files
|
||||||
|
with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders
|
||||||
|
expander_collapsed = '',
|
||||||
|
expander_expanded = '',
|
||||||
|
expander_highlight = 'NeoTreeExpander',
|
||||||
|
},
|
||||||
|
icon = {
|
||||||
|
folder_closed = '',
|
||||||
|
folder_open = '',
|
||||||
|
folder_empty = '',
|
||||||
|
provider = function(icon, node, state) -- default icon provider utilizes nvim-web-devicons if available
|
||||||
|
if node.type == 'file' or node.type == 'terminal' then
|
||||||
|
local success, web_devicons = pcall(require, 'nvim-web-devicons')
|
||||||
|
local name = node.type == 'terminal' and 'terminal' or node.name
|
||||||
|
if success then
|
||||||
|
local devicon, hl = web_devicons.get_icon(name)
|
||||||
|
icon.text = devicon or icon.text
|
||||||
|
icon.highlight = hl or icon.highlight
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
-- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there
|
||||||
|
-- then these will never be used.
|
||||||
|
default = '*',
|
||||||
|
highlight = 'NeoTreeFileIcon',
|
||||||
|
},
|
||||||
|
modified = {
|
||||||
|
symbol = '[+]',
|
||||||
|
highlight = 'NeoTreeModified',
|
||||||
|
},
|
||||||
|
name = {
|
||||||
|
trailing_slash = false,
|
||||||
|
use_git_status_colors = true,
|
||||||
|
highlight = 'NeoTreeFileName',
|
||||||
|
},
|
||||||
|
git_status = {
|
||||||
|
symbols = {
|
||||||
|
-- Change type
|
||||||
|
added = '', -- or "✚", but this is redundant info if you use git_status_colors on the name
|
||||||
|
modified = '', -- or "", but this is redundant info if you use git_status_colors on the name
|
||||||
|
deleted = '✖', -- this can only be used in the git_status source
|
||||||
|
renamed = '', -- this can only be used in the git_status source
|
||||||
|
-- Status type
|
||||||
|
untracked = '',
|
||||||
|
ignored = '',
|
||||||
|
unstaged = '',
|
||||||
|
staged = '',
|
||||||
|
conflict = '',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- If you don't want to use these columns, you can set `enabled = false` for each of them individually
|
||||||
|
file_size = {
|
||||||
|
enabled = true,
|
||||||
|
width = 12, -- width of the column
|
||||||
|
required_width = 64, -- min width of window required to show this column
|
||||||
|
},
|
||||||
|
type = {
|
||||||
|
enabled = true,
|
||||||
|
width = 10, -- width of the column
|
||||||
|
required_width = 122, -- min width of window required to show this column
|
||||||
|
},
|
||||||
|
last_modified = {
|
||||||
|
enabled = true,
|
||||||
|
width = 20, -- width of the column
|
||||||
|
required_width = 88, -- min width of window required to show this column
|
||||||
|
},
|
||||||
|
created = {
|
||||||
|
enabled = true,
|
||||||
|
width = 20, -- width of the column
|
||||||
|
required_width = 110, -- min width of window required to show this column
|
||||||
|
},
|
||||||
|
symlink_target = {
|
||||||
|
enabled = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- A list of functions, each representing a global custom command
|
||||||
|
-- that will be available in all sources (if not overridden in `opts[source_name].commands`)
|
||||||
|
-- see `:h neo-tree-custom-commands-global`
|
||||||
|
commands = {},
|
||||||
|
window = {
|
||||||
|
position = 'left',
|
||||||
|
width = 40,
|
||||||
|
mapping_options = {
|
||||||
|
noremap = true,
|
||||||
|
nowait = true,
|
||||||
|
},
|
||||||
|
mappings = {
|
||||||
|
['\\'] = 'close_window',
|
||||||
|
['<space>'] = '<Nop>',
|
||||||
|
['<2-LeftMouse>'] = 'open',
|
||||||
|
['<cr>'] = 'open',
|
||||||
|
['<esc>'] = 'cancel', -- close preview or floating neo-tree window
|
||||||
|
['P'] = { 'toggle_preview', config = { use_float = true, use_image_nvim = true } },
|
||||||
|
-- Read `# Preview Mode` for more information
|
||||||
|
['l'] = 'focus_preview',
|
||||||
|
['S'] = 'open_split',
|
||||||
|
['s'] = 'open_vsplit',
|
||||||
|
-- ["S"] = "split_with_window_picker",
|
||||||
|
-- ["s"] = "vsplit_with_window_picker",
|
||||||
|
['t'] = 'open_tabnew',
|
||||||
|
-- ["<cr>"] = "open_drop",
|
||||||
|
-- ["t"] = "open_tab_drop",
|
||||||
|
['w'] = 'open_with_window_picker',
|
||||||
|
--["P"] = "toggle_preview", -- enter preview mode, which shows the current node without focusing
|
||||||
|
['C'] = 'close_node',
|
||||||
|
-- ['C'] = 'close_all_subnodes',
|
||||||
|
['z'] = 'close_all_nodes',
|
||||||
|
--["Z"] = "expand_all_nodes",
|
||||||
|
['Z'] = 'expand_all_subnodes',
|
||||||
|
['a'] = {
|
||||||
|
'add',
|
||||||
|
-- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc). see `:h neo-tree-file-actions` for details
|
||||||
|
-- some commands may take optional config options, see `:h neo-tree-mappings` for details
|
||||||
|
config = {
|
||||||
|
show_path = 'none', -- "none", "relative", "absolute"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
['A'] = 'add_directory', -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion.
|
||||||
|
['d'] = 'delete',
|
||||||
|
['r'] = 'rename',
|
||||||
|
['b'] = 'rename_basename',
|
||||||
|
['y'] = 'copy_to_clipboard',
|
||||||
|
['x'] = 'cut_to_clipboard',
|
||||||
|
['p'] = 'paste_from_clipboard',
|
||||||
|
--['c'] = 'copy', -- takes text input for destination, also accepts the optional config.show_path option like "add":
|
||||||
|
['c'] = {
|
||||||
|
'copy',
|
||||||
|
config = {
|
||||||
|
show_path = 'relative', -- "none", "relative", "absolute"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
['m'] = 'move', -- takes text input for destination, also accepts the optional config.show_path option like "add".
|
||||||
|
['q'] = 'close_window',
|
||||||
|
['R'] = 'refresh',
|
||||||
|
['?'] = 'show_help',
|
||||||
|
['<'] = 'prev_source',
|
||||||
|
['>'] = 'next_source',
|
||||||
|
['i'] = 'show_file_details',
|
||||||
|
-- ["i"] = {
|
||||||
|
-- "show_file_details",
|
||||||
|
-- -- format strings of the timestamps shown for date created and last modified (see `:h os.date()`)
|
||||||
|
-- -- both options accept a string or a function that takes in the date in seconds and returns a string to display
|
||||||
|
-- -- config = {
|
||||||
|
-- -- created_format = "%Y-%m-%d %I:%M %p",
|
||||||
|
-- -- modified_format = "relative", -- equivalent to the line below
|
||||||
|
-- -- modified_format = function(seconds) return require('neo-tree.utils').relative_date(seconds) end
|
||||||
|
-- -- }
|
||||||
|
-- },
|
||||||
|
['Y'] = function(state)
|
||||||
|
local node = state.tree:get_node()
|
||||||
|
local filepath = node:get_id()
|
||||||
|
local filename = node.name
|
||||||
|
|
||||||
|
local results = {
|
||||||
|
filename,
|
||||||
|
vim.fn.fnamemodify(filepath, ':.'),
|
||||||
|
filepath,
|
||||||
|
}
|
||||||
|
|
||||||
|
local i = vim.fn.inputlist {
|
||||||
|
'Choose what to copy:',
|
||||||
|
'1. ' .. results[1],
|
||||||
|
'2. ' .. results[2],
|
||||||
|
'3. ' .. results[3],
|
||||||
|
}
|
||||||
|
|
||||||
|
if i > 0 then
|
||||||
|
local result = results[i]
|
||||||
|
if not result then
|
||||||
|
return print('Invalid choice: ' .. i)
|
||||||
|
end
|
||||||
|
vim.fn.setreg('+', result)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
nesting_rules = {},
|
||||||
|
filesystem = {
|
||||||
|
filtered_items = {
|
||||||
|
visible = true, -- when true, they will just be displayed differently than normal items
|
||||||
|
hide_dotfiles = true,
|
||||||
|
hide_gitignored = true,
|
||||||
|
hide_hidden = true, -- only works on Windows for hidden files/directories
|
||||||
|
hide_by_name = {
|
||||||
|
--"node_modules"
|
||||||
|
},
|
||||||
|
hide_by_pattern = { -- uses glob style patterns
|
||||||
|
--"*.meta",
|
||||||
|
--"*/src/*/tsconfig.json",
|
||||||
|
},
|
||||||
|
always_show = { -- remains visible even if other settings would normally hide it
|
||||||
|
'.gitignore',
|
||||||
|
},
|
||||||
|
always_show_by_pattern = { -- uses glob style patterns
|
||||||
|
'.env*',
|
||||||
|
},
|
||||||
|
never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show
|
||||||
|
'.DS_Store',
|
||||||
|
--"thumbs.db"
|
||||||
|
},
|
||||||
|
never_show_by_pattern = { -- uses glob style patterns
|
||||||
|
--".null-ls_*",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
follow_current_file = {
|
||||||
|
enabled = true, -- This will find and focus the file in the active buffer every time
|
||||||
|
-- -- the current file is changed while the tree is open.
|
||||||
|
leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal`
|
||||||
|
},
|
||||||
|
group_empty_dirs = false, -- when true, empty folders will be grouped together
|
||||||
|
hijack_netrw_behavior = 'open_current', -- netrw disabled, opening a directory opens neo-tree
|
||||||
|
-- in whatever position is specified in window.position
|
||||||
|
-- "open_current", -- netrw disabled, opening a directory opens within the
|
||||||
|
-- window like netrw would, regardless of window.position
|
||||||
|
-- "disabled", -- netrw left alone, neo-tree does not handle opening dirs
|
||||||
|
use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes
|
||||||
|
-- instead of relying on nvim autocmd events.
|
||||||
|
window = {
|
||||||
|
mappings = {
|
||||||
|
['<bs>'] = 'navigate_up',
|
||||||
|
['.'] = 'set_root',
|
||||||
|
['H'] = 'toggle_hidden',
|
||||||
|
['/'] = 'fuzzy_finder',
|
||||||
|
['D'] = 'fuzzy_finder_directory',
|
||||||
|
['#'] = 'fuzzy_sorter', -- fuzzy sorting using the fzy algorithm
|
||||||
|
-- ["D"] = "fuzzy_sorter_directory",
|
||||||
|
['f'] = 'filter_on_submit',
|
||||||
|
['<c-x>'] = 'clear_filter',
|
||||||
|
['[g'] = 'prev_git_modified',
|
||||||
|
[']g'] = 'next_git_modified',
|
||||||
|
['o'] = {
|
||||||
|
'show_help',
|
||||||
|
nowait = false,
|
||||||
|
config = { title = 'Order by', prefix_key = 'o' },
|
||||||
|
},
|
||||||
|
['oc'] = { 'order_by_created', nowait = false },
|
||||||
|
['od'] = { 'order_by_diagnostics', nowait = false },
|
||||||
|
['og'] = { 'order_by_git_status', nowait = false },
|
||||||
|
['om'] = { 'order_by_modified', nowait = false },
|
||||||
|
['on'] = { 'order_by_name', nowait = false },
|
||||||
|
['os'] = { 'order_by_size', nowait = false },
|
||||||
|
['ot'] = { 'order_by_type', nowait = false },
|
||||||
|
-- ['<key>'] = function(state) ... end,
|
||||||
|
},
|
||||||
|
fuzzy_finder_mappings = { -- define keymaps for filter popup window in fuzzy_finder_mode
|
||||||
|
['<down>'] = 'move_cursor_down',
|
||||||
|
['<C-n>'] = 'move_cursor_down',
|
||||||
|
['<up>'] = 'move_cursor_up',
|
||||||
|
['<C-p>'] = 'move_cursor_up',
|
||||||
|
['<esc>'] = 'close',
|
||||||
|
-- ['<key>'] = function(state, scroll_padding) ... end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
commands = {}, -- Add a custom command or override a global one using the same function name
|
||||||
|
},
|
||||||
|
buffers = {
|
||||||
|
follow_current_file = {
|
||||||
|
enabled = true, -- This will find and focus the file in the active buffer every time
|
||||||
|
-- -- the current file is changed while the tree is open.
|
||||||
|
leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal`
|
||||||
|
},
|
||||||
|
group_empty_dirs = true, -- when true, empty folders will be grouped together
|
||||||
|
show_unloaded = true,
|
||||||
|
window = {
|
||||||
|
mappings = {
|
||||||
|
['d'] = 'buffer_delete',
|
||||||
|
['bd'] = 'buffer_delete',
|
||||||
|
['<bs>'] = 'navigate_up',
|
||||||
|
['.'] = 'set_root',
|
||||||
|
['o'] = {
|
||||||
|
'show_help',
|
||||||
|
nowait = false,
|
||||||
|
config = { title = 'Order by', prefix_key = 'o' },
|
||||||
|
},
|
||||||
|
['oc'] = { 'order_by_created', nowait = false },
|
||||||
|
['od'] = { 'order_by_diagnostics', nowait = false },
|
||||||
|
['om'] = { 'order_by_modified', nowait = false },
|
||||||
|
['on'] = { 'order_by_name', nowait = false },
|
||||||
|
['os'] = { 'order_by_size', nowait = false },
|
||||||
|
['ot'] = { 'order_by_type', nowait = false },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
git_status = {
|
||||||
|
window = {
|
||||||
|
position = 'float',
|
||||||
|
mappings = {
|
||||||
|
['A'] = 'git_add_all',
|
||||||
|
['gu'] = 'git_unstage_file',
|
||||||
|
['gU'] = 'git_undo_last_commit',
|
||||||
|
['ga'] = 'git_add_file',
|
||||||
|
['gr'] = 'git_revert_file',
|
||||||
|
['gc'] = 'git_commit',
|
||||||
|
['gp'] = 'git_push',
|
||||||
|
['gg'] = 'git_commit_and_push',
|
||||||
|
['o'] = {
|
||||||
|
'show_help',
|
||||||
|
nowait = false,
|
||||||
|
config = { title = 'Order by', prefix_key = 'o' },
|
||||||
|
},
|
||||||
|
['oc'] = { 'order_by_created', nowait = false },
|
||||||
|
['od'] = { 'order_by_diagnostics', nowait = false },
|
||||||
|
['om'] = { 'order_by_modified', nowait = false },
|
||||||
|
['on'] = { 'order_by_name', nowait = false },
|
||||||
|
['os'] = { 'order_by_size', nowait = false },
|
||||||
|
['ot'] = { 'order_by_type', nowait = false },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
vim.keymap.set('n', '\\', '<Cmd>Neotree reveal<CR>')
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
25
lua/opts.lua
25
lua/opts.lua
@@ -1,3 +1,6 @@
|
|||||||
|
-- Set <space> as the leader key
|
||||||
|
-- See `:help mapleader`
|
||||||
|
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
|
||||||
vim.g.mapleader = ' '
|
vim.g.mapleader = ' '
|
||||||
vim.g.maplocalleader = ' '
|
vim.g.maplocalleader = ' '
|
||||||
|
|
||||||
@@ -10,12 +13,20 @@ vim.opt.relativenumber = true
|
|||||||
-- Don't show the mode, since it's already in the status line
|
-- Don't show the mode, since it's already in the status line
|
||||||
vim.opt.showmode = false
|
vim.opt.showmode = false
|
||||||
|
|
||||||
|
-- Sync clipboard between OS and Neovim.
|
||||||
|
-- Schedule the setting after `UiEnter` because it can increase startup-time.
|
||||||
|
-- Remove this option if you want your OS clipboard to remain independent.
|
||||||
|
-- See `:help 'clipboard'`
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.o.clipboard = 'unnamedplus'
|
||||||
|
end)
|
||||||
|
|
||||||
vim.opt.tabstop = 4
|
vim.opt.tabstop = 4
|
||||||
vim.opt.softtabstop = 4
|
vim.opt.softtabstop = 4
|
||||||
vim.opt.shiftwidth = 4
|
vim.opt.shiftwidth = 4
|
||||||
vim.opt.expandtab = true
|
vim.opt.expandtab = true
|
||||||
|
|
||||||
vim.opt.smartindent = true
|
vim.o.breakindent = true
|
||||||
|
|
||||||
vim.opt.wrap = false
|
vim.opt.wrap = false
|
||||||
|
|
||||||
@@ -41,7 +52,7 @@ vim.opt.smartcase = true
|
|||||||
vim.opt.signcolumn = 'yes'
|
vim.opt.signcolumn = 'yes'
|
||||||
|
|
||||||
-- Decrease update time
|
-- Decrease update time
|
||||||
vim.opt.updatetime = 200
|
vim.opt.updatetime = 250
|
||||||
|
|
||||||
-- Decrease mapped sequence wait time
|
-- Decrease mapped sequence wait time
|
||||||
-- Displays which-key popup sooner
|
-- Displays which-key popup sooner
|
||||||
@@ -51,13 +62,17 @@ vim.opt.timeoutlen = 300
|
|||||||
vim.opt.splitright = true
|
vim.opt.splitright = true
|
||||||
vim.opt.splitbelow = true
|
vim.opt.splitbelow = true
|
||||||
|
|
||||||
|
-- Preview substitutions live, as you type!
|
||||||
|
vim.opt.inccommand = 'split'
|
||||||
-- Sets how neovim will display certain whitespace characters in the editor.
|
-- Sets how neovim will display certain whitespace characters in the editor.
|
||||||
-- See `:help 'list'`
|
-- See `:help 'list'5
|
||||||
-- and `:help 'listchars'`
|
-- and `:help 'listchars'`
|
||||||
-- vim.opt.list = true
|
-- vim.opt.list = true
|
||||||
-- vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
|
-- vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
|
||||||
|
|
||||||
-- Preview substitutions live, as you type!
|
-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
|
||||||
vim.opt.inccommand = 'split'
|
-- instead raise a dialog asking if you wish to save the current file(s)
|
||||||
|
-- See `:help 'confirm'`
|
||||||
|
vim.o.confirm = true
|
||||||
|
|
||||||
--vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]]
|
--vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]]
|
||||||
|
|||||||
Reference in New Issue
Block a user