aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuangxiong Lin <[email protected]>2023-12-26 23:48:55 +0800
committerGuangxiong Lin <[email protected]>2023-12-26 23:48:55 +0800
commit4d77b7e3165196342f7a6cc83eb549b63735ff5b (patch)
tree38993bbce621349b8bdc9857f176213d4d1513ad
parent1c6f6f0b0ecaad9b9266683377034252714e30fa (diff)
downloaddotfiles-4d77b7e3165196342f7a6cc83eb549b63735ff5b.tar.gz
dotfiles-4d77b7e3165196342f7a6cc83eb549b63735ff5b.tar.bz2
dotfiles-4d77b7e3165196342f7a6cc83eb549b63735ff5b.zip
Add neovim config
-rw-r--r--.config/nvim/init.vim3
-rw-r--r--.gitmodules39
-rw-r--r--.ignore1
-rw-r--r--.vim/after/plugin/cmp.vim18
-rw-r--r--.vim/after/plugin/cscope.vim4
-rw-r--r--.vim/after/plugin/floaterm.vim5
-rw-r--r--.vim/after/plugin/hop.vim14
-rw-r--r--.vim/after/plugin/minpac.vim2
-rw-r--r--.vim/after/plugin/mucomplete.vim4
-rw-r--r--.vim/after/plugin/nnn.vim1
-rw-r--r--.vim/after/plugin/nvim-cscope.vim29
-rw-r--r--.vim/after/plugin/nvim-lsp.vim10
-rw-r--r--.vim/after/plugin/tig.vim1
-rw-r--r--.vim/after/plugin/treesitter.vim1
-rw-r--r--.vim/after/plugin/vim9-stargate.vim4
m---------.vim/pack/nvim/opt/cmp-buffer0
m---------.vim/pack/nvim/opt/cmp-cmdline0
m---------.vim/pack/nvim/opt/cmp-nvim-lsp0
m---------.vim/pack/nvim/opt/cmp-nvim-ultisnips0
m---------.vim/pack/nvim/opt/cmp-omni0
m---------.vim/pack/nvim/opt/cmp-path0
m---------.vim/pack/nvim/opt/cscope_maps.nvim0
m---------.vim/pack/nvim/opt/hop.nvim0
m---------.vim/pack/nvim/opt/lsp_signature.nvim0
m---------.vim/pack/nvim/opt/nvim-cmp0
m---------.vim/pack/nvim/opt/nvim-lspconfig0
m---------.vim/pack/nvim/opt/nvim-treesitter0
m---------.vim/pack/nvim/opt/symbols-outline.nvim0
-rw-r--r--.vimrc5
-rw-r--r--README.md28
-rwxr-xr-xscripts/bootstrap.sh2
31 files changed, 151 insertions, 20 deletions
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 <<EOF
@@ -17,15 +20,16 @@ local cmp = require 'cmp'
cmp.setup({
preselect = cmp.PreselectMode.None,
- snippet = {
- expand = function(args)
- vim.fn["UltiSnips#Anon"](args.body)
- end,
- },
+ -- snippet = {
+ -- expand = function(args)
+ -- vim.fn["UltiSnips#Anon"](args.body)
+ -- end,
+ -- },
sources = cmp.config.sources({
- { name = 'ultisnips' },
+ -- { name = 'ultisnips' },
{ name = 'nvim_lsp' },
+ { name = 'omni' },
}, {
{ name = 'buffer' },
}),
diff --git a/.vim/after/plugin/cscope.vim b/.vim/after/plugin/cscope.vim
index a098e18..076101f 100644
--- a/.vim/after/plugin/cscope.vim
+++ b/.vim/after/plugin/cscope.vim
@@ -1,3 +1,7 @@
+if has('nvim')
+ finish
+endif
+
if executable('gtags-cscope')
let &csprg='gtags-cscope'
endif
diff --git a/.vim/after/plugin/floaterm.vim b/.vim/after/plugin/floaterm.vim
index b424f96..89fce6b 100644
--- a/.vim/after/plugin/floaterm.vim
+++ b/.vim/after/plugin/floaterm.vim
@@ -1,4 +1,7 @@
let g:floaterm_autoclose = 1
-let g:floaterm_opener = 'tabe'
+let g:floaterm_width = 0.8
+let g:floaterm_height = 0.8
nnoremap <Leader><Leader>t :FloatermToggle<CR>
+nnoremap <Leader><Leader>n :FloatermNew nnn<CR>
+nnoremap <Leader>gs :FloatermNew tig status<CR>
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 <space>f :HopChar1<CR>
+noremap <space>s :HopChar2<CR>
+
+noremap <space>w :HopWord<CR>
+
+lua <<EOF
+ require('hop').setup()
+EOF
diff --git a/.vim/after/plugin/minpac.vim b/.vim/after/plugin/minpac.vim
index f895def..e3fe4a8 100644
--- a/.vim/after/plugin/minpac.vim
+++ b/.vim/after/plugin/minpac.vim
@@ -65,7 +65,6 @@ function! InitMinpac() abort
" external
call minpac#add('https://github.com/junegunn/fzf.git')
call minpac#add('https://github.com/junegunn/fzf.vim.git', {'type': 'opt'})
- call minpac#add('https://github.com/mcchrish/nnn.vim.git')
" terminal
call minpac#add('https://github.com/voldikss/vim-floaterm.git')
@@ -73,7 +72,6 @@ function! InitMinpac() abort
" git
call minpac#add('https://github.com/tpope/vim-fugitive.git')
call minpac#add('https://github.com/rbong/vim-flog.git')
- call minpac#add('https://github.com/iberianpig/tig-explorer.vim')
call minpac#add('https://github.com/mhinz/vim-signify.git')
call minpac#add('https://github.com/jpalardy/vim-slime', {'type': 'opt'})
diff --git a/.vim/after/plugin/mucomplete.vim b/.vim/after/plugin/mucomplete.vim
index 3efbcbe..588d1d2 100644
--- a/.vim/after/plugin/mucomplete.vim
+++ b/.vim/after/plugin/mucomplete.vim
@@ -1,3 +1,7 @@
+if has('nvim')
+ finish
+endif
+
let g:mucomplete#enable_auto_at_startup = 1
let g:mucomplete#minimum_prefix_length = 1
let g:mucomplete#empty_text_auto = 1
diff --git a/.vim/after/plugin/nnn.vim b/.vim/after/plugin/nnn.vim
deleted file mode 100644
index 08cabfc..0000000
--- a/.vim/after/plugin/nnn.vim
+++ /dev/null
@@ -1 +0,0 @@
-nnoremap <leader><leader>n :NnnPicker %<CR>
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 <leader>css :Cscope find s <C-R>=expand("<cword>")<CR><CR>
+nmap <leader>csg :Cscope find g <C-R>=expand("<cword>")<CR>
+nmap <leader>csc :Cscope find c <C-R>=expand("<cword>")<CR>
+nmap <leader>cst :Cscope find t <C-R>=expand("<cword>")<CR><CR>
+nmap <leader>cse :Cscope find e <C-R>=expand("<cword>")<CR><CR>
+nmap <leader>csf :Cscope find f <C-R>=expand("<cfile>")<CR><CR>
+nmap <leader>csi :Cscope find i ^<C-R>=expand("<cfile>")<CR>$<CR>
+nmap <leader>csd :Cscope find d <C-R>=expand("<cword>")<CR>
+nmap <leader>csa :Cscope find a <C-R>=expand("<cword>")<CR>
+nmap <leader>cs<space> :Cscope find<space>
+nmap <C-]> :Cstag <C-R>=expand('<cword>')<CR>
+
+lua <<EOF
+
+ local cscope_maps = require 'cscope_maps'
+ cscope_maps.setup({
+ disable_maps = true,
+ cscope = {
+ exec = "gtags-cscope",
+ },
+ })
+
+EOF
diff --git a/.vim/after/plugin/nvim-lsp.vim b/.vim/after/plugin/nvim-lsp.vim
index d36ed3d..dec2a48 100644
--- a/.vim/after/plugin/nvim-lsp.vim
+++ b/.vim/after/plugin/nvim-lsp.vim
@@ -3,19 +3,19 @@ if !has('nvim')
endif
packadd nvim-lspconfig
-packadd cmp-nvim-lsp
+" packadd cmp-nvim-lsp
packadd symbols-outline.nvim
packadd lsp_signature.nvim
lua <<EOF
local lspconfig = require 'lspconfig'
-local cmp_nvim_lsp = require 'cmp_nvim_lsp'
+-- local cmp_nvim_lsp = require 'cmp_nvim_lsp'
local symbols_outline = require 'symbols-outline'
local lsp_signature = require 'lsp_signature'
-local capabilities = vim.lsp.protocol.make_client_capabilities()
-capabilities = cmp_nvim_lsp.update_capabilities(capabilities)
+-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
+-- local capabilities = require('cmp_nvim_lsp').default_capabilities()
local opts = { noremap = true, silent = true }
@@ -59,7 +59,7 @@ local servers = { 'clangd', 'gopls' , 'gdscript', 'pylsp' }
for _, lsp in pairs(servers) do
lspconfig[lsp].setup{
on_attach = on_attach,
- capabilities = capabilities,
+ -- capabilities = capabilities,
}
end
diff --git a/.vim/after/plugin/tig.vim b/.vim/after/plugin/tig.vim
deleted file mode 100644
index 8093e6a..0000000
--- a/.vim/after/plugin/tig.vim
+++ /dev/null
@@ -1 +0,0 @@
-nnoremap <leader>gs :TigStatus<CR>
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 <<EOF
local treesitter_config = require 'nvim-treesitter.configs'
treesitter_config.setup {
- ensure_installed = { 'c', 'lua', 'gdscript', 'go', 'python' },
sync_install = false,
highlight = {
diff --git a/.vim/after/plugin/vim9-stargate.vim b/.vim/after/plugin/vim9-stargate.vim
index d6f9075..6462be6 100644
--- a/.vim/after/plugin/vim9-stargate.vim
+++ b/.vim/after/plugin/vim9-stargate.vim
@@ -1,3 +1,7 @@
+if has('nvim')
+ finish
+endif
+
" For 1 character to search before showing hints
noremap <space>f <Cmd>call stargate#OKvim(1)<CR>
" 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
+Subproject 3022dbc9166796b644a841a02de8dd1cc1d311f
diff --git a/.vim/pack/nvim/opt/cmp-cmdline b/.vim/pack/nvim/opt/cmp-cmdline
new file mode 160000
+Subproject 8ee981b4a91f536f52add291594e89fb6645e45
diff --git a/.vim/pack/nvim/opt/cmp-nvim-lsp b/.vim/pack/nvim/opt/cmp-nvim-lsp
new file mode 160000
+Subproject 5af77f54de1b16c34b23cba810150689a3a9031
diff --git a/.vim/pack/nvim/opt/cmp-nvim-ultisnips b/.vim/pack/nvim/opt/cmp-nvim-ultisnips
new file mode 160000
+Subproject 24bca5c3e137b28cd87442d4fc51a2b312dd99c
diff --git a/.vim/pack/nvim/opt/cmp-omni b/.vim/pack/nvim/opt/cmp-omni
new file mode 160000
+Subproject 4ef610bbd85a5ee4e97e09450c0daecbdc60de8
diff --git a/.vim/pack/nvim/opt/cmp-path b/.vim/pack/nvim/opt/cmp-path
new file mode 160000
+Subproject 91ff86cd9c29299a64f968ebb45846c485725f2
diff --git a/.vim/pack/nvim/opt/cscope_maps.nvim b/.vim/pack/nvim/opt/cscope_maps.nvim
new file mode 160000
+Subproject c3922f1decbbcedca3aba5cd4534f397e5a903b
diff --git a/.vim/pack/nvim/opt/hop.nvim b/.vim/pack/nvim/opt/hop.nvim
new file mode 160000
+Subproject df0b5b693ef8c3d414b5b85e4bc11cea99c4958
diff --git a/.vim/pack/nvim/opt/lsp_signature.nvim b/.vim/pack/nvim/opt/lsp_signature.nvim
new file mode 160000
+Subproject fed2c8389c148ff1dfdcdca63c2b48d08a50dea
diff --git a/.vim/pack/nvim/opt/nvim-cmp b/.vim/pack/nvim/opt/nvim-cmp
new file mode 160000
+Subproject 538e37ba87284942c1d76ed38dd497e54e65b89
diff --git a/.vim/pack/nvim/opt/nvim-lspconfig b/.vim/pack/nvim/opt/nvim-lspconfig
new file mode 160000
+Subproject 9099871a7c7e1c16122e00d70208a2cd02078d8
diff --git a/.vim/pack/nvim/opt/nvim-treesitter b/.vim/pack/nvim/opt/nvim-treesitter
new file mode 160000
+Subproject 27f68c0b6a87cbad900b3d016425450af826802
diff --git a/.vim/pack/nvim/opt/symbols-outline.nvim b/.vim/pack/nvim/opt/symbols-outline.nvim
new file mode 160000
+Subproject 512791925d57a61c545bc303356e8a8f7869763
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 () {