From 4d77b7e3165196342f7a6cc83eb549b63735ff5b Mon Sep 17 00:00:00 2001 From: Guangxiong Lin Date: Tue, 26 Dec 2023 23:48:55 +0800 Subject: Add neovim config --- .config/nvim/init.vim | 3 +++ .gitmodules | 39 +++++++++++++++++++++++++++++++++ .ignore | 1 + .vim/after/plugin/cmp.vim | 18 +++++++++------ .vim/after/plugin/cscope.vim | 4 ++++ .vim/after/plugin/floaterm.vim | 5 ++++- .vim/after/plugin/hop.vim | 14 ++++++++++++ .vim/after/plugin/minpac.vim | 2 -- .vim/after/plugin/mucomplete.vim | 4 ++++ .vim/after/plugin/nnn.vim | 1 - .vim/after/plugin/nvim-cscope.vim | 29 ++++++++++++++++++++++++ .vim/after/plugin/nvim-lsp.vim | 10 ++++----- .vim/after/plugin/tig.vim | 1 - .vim/after/plugin/treesitter.vim | 1 - .vim/after/plugin/vim9-stargate.vim | 4 ++++ .vim/pack/nvim/opt/cmp-buffer | 1 + .vim/pack/nvim/opt/cmp-cmdline | 1 + .vim/pack/nvim/opt/cmp-nvim-lsp | 1 + .vim/pack/nvim/opt/cmp-nvim-ultisnips | 1 + .vim/pack/nvim/opt/cmp-omni | 1 + .vim/pack/nvim/opt/cmp-path | 1 + .vim/pack/nvim/opt/cscope_maps.nvim | 1 + .vim/pack/nvim/opt/hop.nvim | 1 + .vim/pack/nvim/opt/lsp_signature.nvim | 1 + .vim/pack/nvim/opt/nvim-cmp | 1 + .vim/pack/nvim/opt/nvim-lspconfig | 1 + .vim/pack/nvim/opt/nvim-treesitter | 1 + .vim/pack/nvim/opt/symbols-outline.nvim | 1 + .vimrc | 5 ++++- README.md | 28 +++++++++++++++++++++++ scripts/bootstrap.sh | 2 +- 31 files changed, 164 insertions(+), 20 deletions(-) create mode 100644 .config/nvim/init.vim create mode 100644 .ignore create mode 100644 .vim/after/plugin/hop.vim delete mode 100644 .vim/after/plugin/nnn.vim create mode 100644 .vim/after/plugin/nvim-cscope.vim delete mode 100644 .vim/after/plugin/tig.vim create mode 160000 .vim/pack/nvim/opt/cmp-buffer create mode 160000 .vim/pack/nvim/opt/cmp-cmdline create mode 160000 .vim/pack/nvim/opt/cmp-nvim-lsp create mode 160000 .vim/pack/nvim/opt/cmp-nvim-ultisnips create mode 160000 .vim/pack/nvim/opt/cmp-omni create mode 160000 .vim/pack/nvim/opt/cmp-path create mode 160000 .vim/pack/nvim/opt/cscope_maps.nvim create mode 160000 .vim/pack/nvim/opt/hop.nvim create mode 160000 .vim/pack/nvim/opt/lsp_signature.nvim create mode 160000 .vim/pack/nvim/opt/nvim-cmp create mode 160000 .vim/pack/nvim/opt/nvim-lspconfig create mode 160000 .vim/pack/nvim/opt/nvim-treesitter create mode 160000 .vim/pack/nvim/opt/symbols-outline.nvim diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim new file mode 100644 index 0000000..f182e5b --- /dev/null +++ b/.config/nvim/init.vim @@ -0,0 +1,3 @@ +set runtimepath^=~/.vim runtimepath+=~/.vim/after +let &packpath = &runtimepath +source ~/.vimrc diff --git a/.gitmodules b/.gitmodules index e05ae45..d26b45d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,3 +16,42 @@ [submodule ".vim/pack/submodule/opt/vim-sneak"] path = .vim/pack/submodule/opt/vim-sneak url = https://github.com/justinmk/vim-sneak +[submodule ".vim/pack/nvim/opt/nvim-treesitter"] + path = .vim/pack/nvim/opt/nvim-treesitter + url = https://github.com/nvim-treesitter/nvim-treesitter +[submodule ".vim/pack/nvim/opt/nvim-cmp"] + path = .vim/pack/nvim/opt/nvim-cmp + url = https://github.com/hrsh7th/nvim-cmp +[submodule ".vim/pack/nvim/opt/nvim-lspconfig"] + path = .vim/pack/nvim/opt/nvim-lspconfig + url = https://github.com/neovim/nvim-lspconfig +[submodule ".vim/pack/nvim/opt/cmp-nvim-lsp"] + path = .vim/pack/nvim/opt/cmp-nvim-lsp + url = https://github.com/hrsh7th/cmp-nvim-lsp +[submodule ".vim/pack/nvim/opt/symbols-outline.nvim"] + path = .vim/pack/nvim/opt/symbols-outline.nvim + url = https://github.com/simrat39/symbols-outline.nvim +[submodule ".vim/pack/nvim/opt/lsp_signature.nvim"] + path = .vim/pack/nvim/opt/lsp_signature.nvim + url = https://github.com/ray-x/lsp_signature.nvim +[submodule ".vim/pack/nvim/opt/cmp-buffer"] + path = .vim/pack/nvim/opt/cmp-buffer + url = https://github.com/hrsh7th/cmp-buffer +[submodule ".vim/pack/nvim/opt/cmp-path"] + path = .vim/pack/nvim/opt/cmp-path + url = https://github.com/hrsh7th/cmp-path +[submodule ".vim/pack/nvim/opt/cmp-cmdline"] + path = .vim/pack/nvim/opt/cmp-cmdline + url = https://github.com/hrsh7th/cmp-cmdline +[submodule ".vim/pack/nvim/opt/cmp-nvim-ultisnips"] + path = .vim/pack/nvim/opt/cmp-nvim-ultisnips + url = https://github.com/quangnguyen30192/cmp-nvim-ultisnips +[submodule ".vim/pack/nvim/opt/cscope_maps.nvim"] + path = .vim/pack/nvim/opt/cscope_maps.nvim + url = https://github.com/dhananjaylatkar/cscope_maps.nvim +[submodule ".vim/pack/nvim/opt/hop.nvim"] + path = .vim/pack/nvim/opt/hop.nvim + url = https://github.com/smoka7/hop.nvim +[submodule ".vim/pack/nvim/opt/cmp-omni"] + path = .vim/pack/nvim/opt/cmp-omni + url = https://github.com/hrsh7th/cmp-omni diff --git a/.ignore b/.ignore new file mode 100644 index 0000000..6446820 --- /dev/null +++ b/.ignore @@ -0,0 +1 @@ +.vim/pack/ diff --git a/.vim/after/plugin/cmp.vim b/.vim/after/plugin/cmp.vim index e95dd71..17f5086 100644 --- a/.vim/after/plugin/cmp.vim +++ b/.vim/after/plugin/cmp.vim @@ -9,7 +9,10 @@ packadd nvim-cmp packadd cmp-buffer packadd cmp-path packadd cmp-cmdline -packadd cmp-nvim-ultisnips +packadd cmp-omni + +" cmp-nvim-ultisnips is kind of buggy. Disable it before investigation. +" packadd cmp-nvim-ultisnips lua <t :FloatermToggle +nnoremap n :FloatermNew nnn +nnoremap gs :FloatermNew tig status diff --git a/.vim/after/plugin/hop.vim b/.vim/after/plugin/hop.vim new file mode 100644 index 0000000..03ea18e --- /dev/null +++ b/.vim/after/plugin/hop.vim @@ -0,0 +1,14 @@ +if !has('nvim') + finish +endif + +packadd hop.nvim + +noremap f :HopChar1 +noremap s :HopChar2 + +noremap w :HopWord + +lua <n :NnnPicker % diff --git a/.vim/after/plugin/nvim-cscope.vim b/.vim/after/plugin/nvim-cscope.vim new file mode 100644 index 0000000..c463800 --- /dev/null +++ b/.vim/after/plugin/nvim-cscope.vim @@ -0,0 +1,29 @@ +if !has('nvim') + finish +endif + +packadd cscope_maps.nvim + +nmap css :Cscope find s =expand("") +nmap csg :Cscope find g =expand("") +nmap csc :Cscope find c =expand("") +nmap cst :Cscope find t =expand("") +nmap cse :Cscope find e =expand("") +nmap csf :Cscope find f =expand("") +nmap csi :Cscope find i ^=expand("")$ +nmap csd :Cscope find d =expand("") +nmap csa :Cscope find a =expand("") +nmap cs :Cscope find +nmap :Cstag =expand('') + +lua <gs :TigStatus diff --git a/.vim/after/plugin/treesitter.vim b/.vim/after/plugin/treesitter.vim index c022662..268ab0a 100644 --- a/.vim/after/plugin/treesitter.vim +++ b/.vim/after/plugin/treesitter.vim @@ -9,7 +9,6 @@ lua <f call stargate#OKvim(1) " For 2 consecutive characters to search diff --git a/.vim/pack/nvim/opt/cmp-buffer b/.vim/pack/nvim/opt/cmp-buffer new file mode 160000 index 0000000..3022dbc --- /dev/null +++ b/.vim/pack/nvim/opt/cmp-buffer @@ -0,0 +1 @@ +Subproject commit 3022dbc9166796b644a841a02de8dd1cc1d311fa diff --git a/.vim/pack/nvim/opt/cmp-cmdline b/.vim/pack/nvim/opt/cmp-cmdline new file mode 160000 index 0000000..8ee981b --- /dev/null +++ b/.vim/pack/nvim/opt/cmp-cmdline @@ -0,0 +1 @@ +Subproject commit 8ee981b4a91f536f52add291594e89fb6645e451 diff --git a/.vim/pack/nvim/opt/cmp-nvim-lsp b/.vim/pack/nvim/opt/cmp-nvim-lsp new file mode 160000 index 0000000..5af77f5 --- /dev/null +++ b/.vim/pack/nvim/opt/cmp-nvim-lsp @@ -0,0 +1 @@ +Subproject commit 5af77f54de1b16c34b23cba810150689a3a90312 diff --git a/.vim/pack/nvim/opt/cmp-nvim-ultisnips b/.vim/pack/nvim/opt/cmp-nvim-ultisnips new file mode 160000 index 0000000..24bca5c --- /dev/null +++ b/.vim/pack/nvim/opt/cmp-nvim-ultisnips @@ -0,0 +1 @@ +Subproject commit 24bca5c3e137b28cd87442d4fc51a2b312dd99cc diff --git a/.vim/pack/nvim/opt/cmp-omni b/.vim/pack/nvim/opt/cmp-omni new file mode 160000 index 0000000..4ef610b --- /dev/null +++ b/.vim/pack/nvim/opt/cmp-omni @@ -0,0 +1 @@ +Subproject commit 4ef610bbd85a5ee4e97e09450c0daecbdc60de86 diff --git a/.vim/pack/nvim/opt/cmp-path b/.vim/pack/nvim/opt/cmp-path new file mode 160000 index 0000000..91ff86c --- /dev/null +++ b/.vim/pack/nvim/opt/cmp-path @@ -0,0 +1 @@ +Subproject commit 91ff86cd9c29299a64f968ebb45846c485725f23 diff --git a/.vim/pack/nvim/opt/cscope_maps.nvim b/.vim/pack/nvim/opt/cscope_maps.nvim new file mode 160000 index 0000000..c3922f1 --- /dev/null +++ b/.vim/pack/nvim/opt/cscope_maps.nvim @@ -0,0 +1 @@ +Subproject commit c3922f1decbbcedca3aba5cd4534f397e5a903b4 diff --git a/.vim/pack/nvim/opt/hop.nvim b/.vim/pack/nvim/opt/hop.nvim new file mode 160000 index 0000000..df0b5b6 --- /dev/null +++ b/.vim/pack/nvim/opt/hop.nvim @@ -0,0 +1 @@ +Subproject commit df0b5b693ef8c3d414b5b85e4bc11cea99c4958d diff --git a/.vim/pack/nvim/opt/lsp_signature.nvim b/.vim/pack/nvim/opt/lsp_signature.nvim new file mode 160000 index 0000000..fed2c83 --- /dev/null +++ b/.vim/pack/nvim/opt/lsp_signature.nvim @@ -0,0 +1 @@ +Subproject commit fed2c8389c148ff1dfdcdca63c2b48d08a50dea0 diff --git a/.vim/pack/nvim/opt/nvim-cmp b/.vim/pack/nvim/opt/nvim-cmp new file mode 160000 index 0000000..538e37b --- /dev/null +++ b/.vim/pack/nvim/opt/nvim-cmp @@ -0,0 +1 @@ +Subproject commit 538e37ba87284942c1d76ed38dd497e54e65b891 diff --git a/.vim/pack/nvim/opt/nvim-lspconfig b/.vim/pack/nvim/opt/nvim-lspconfig new file mode 160000 index 0000000..9099871 --- /dev/null +++ b/.vim/pack/nvim/opt/nvim-lspconfig @@ -0,0 +1 @@ +Subproject commit 9099871a7c7e1c16122e00d70208a2cd02078d80 diff --git a/.vim/pack/nvim/opt/nvim-treesitter b/.vim/pack/nvim/opt/nvim-treesitter new file mode 160000 index 0000000..27f68c0 --- /dev/null +++ b/.vim/pack/nvim/opt/nvim-treesitter @@ -0,0 +1 @@ +Subproject commit 27f68c0b6a87cbad900b3d016425450af8268026 diff --git a/.vim/pack/nvim/opt/symbols-outline.nvim b/.vim/pack/nvim/opt/symbols-outline.nvim new file mode 160000 index 0000000..5127919 --- /dev/null +++ b/.vim/pack/nvim/opt/symbols-outline.nvim @@ -0,0 +1 @@ +Subproject commit 512791925d57a61c545bc303356e8a8f7869763c diff --git a/.vimrc b/.vimrc index 405da2f..954f4db 100644 --- a/.vimrc +++ b/.vimrc @@ -150,9 +150,12 @@ packadd! onedark.vim silent colorscheme onedark packadd matchit -packadd editorconfig packadd cfilter +if !has('nvim') + packadd editorconfig +endif + if !empty(glob('~/.vim_local')) source ~/.vim_local endif diff --git a/README.md b/README.md index 51cbabd..4195e69 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,15 @@ Motion: - [vim-sneak](https://github.com/justinmk/vim-sneak): Jump to any location with two characters. It should be `opt`. Otherwise the config in `after` folder would not work. +- [hop.nvim](https://github.com/smoka7/hop.nvim): modern alternative to + easymotion in neovim. + +Navigation: + +- symbols-outline.nvim: alternative to tagbar in neovim. +- cscope_maps.nvim: as neovim deprecated cscope in neovim 0.9, this + plugin is required to use the cscope features. +- nvim-lspconfig Languages specfic: @@ -19,10 +28,29 @@ Languages specfic: - [vim-terraform](https://github.com/hashivim/vim-terraform): Improve terraform syntax highlight. +Editing: + +- [nvim-cmp](https://github.com/hrsh7th/nvim-cmp): Code completion in + neovim. + + Related completion sources: + + - cmp-buffer + - cmp-cmdline + - cmp-nvim-lsp + - cmp-nvim-ultisnips (kind of buggy) + - cmp-omni + - cmp-path + +- lsp_signature.nvim + +Interface: + Misc: - [vim-highlightedyank](https://github.com/machakann/vim-highlightedyank): highlight yanked text. +- nvim-treesitter Good but not included yet: diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index e073c90..7e755ce 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -26,7 +26,7 @@ link_all () { .env .config/kitty .wezterm.lua .config/mpv \ .config/sway .config/swaylock .config/zathura .tigrc .config/foot \ .config/fish .arch.aliases .bashrc .zinitrc \ - .config/git + .config/git .config/nvim } main () { -- cgit v1.2.3