diff options
author | Guangxiong Lin <[email protected]> | 2022-06-04 19:17:01 +0800 |
---|---|---|
committer | Guangxiong Lin <[email protected]> | 2022-06-05 11:41:04 +0800 |
commit | 47be6a508c4150f8ef2627ae185c650c081c6bbf (patch) | |
tree | 49656b4c2ffcc6adae8df89f4c9747287663311f | |
parent | 8c54a7ae533b5e07e978c705f3790eff054196c0 (diff) | |
download | dotfiles-47be6a508c4150f8ef2627ae185c650c081c6bbf.tar.gz dotfiles-47be6a508c4150f8ef2627ae185c650c081c6bbf.tar.bz2 dotfiles-47be6a508c4150f8ef2627ae185c650c081c6bbf.zip |
Add more plugins for nvim
-rw-r--r-- | .vim/UltiSnips/vimspector.snippets | 23 | ||||
-rw-r--r-- | .vim/after/plugin/cmp.vim | 7 | ||||
-rw-r--r-- | .vim/after/plugin/dap.vim | 46 | ||||
-rw-r--r-- | .vim/after/plugin/git.vim | 7 | ||||
-rw-r--r-- | .vim/after/plugin/minpac.vim | 18 | ||||
-rw-r--r-- | .vim/after/plugin/nvim-lsp.vim | 9 | ||||
-rw-r--r-- | .vim/after/plugin/vimspector.vim | 17 | ||||
-rw-r--r-- | .vim/filetype.vim | 8 | ||||
-rw-r--r-- | .vimrc | 16 |
9 files changed, 141 insertions, 10 deletions
diff --git a/.vim/UltiSnips/vimspector.snippets b/.vim/UltiSnips/vimspector.snippets new file mode 100644 index 0000000..9d2cad1 --- /dev/null +++ b/.vim/UltiSnips/vimspector.snippets @@ -0,0 +1,23 @@ +# Snippets to create vimspector.json + +snippet /^new/ "New Configurations" r +{ + "configurations": { + ${1:<new config here>} + } +} +endsnippet + +snippet godebug "Golang Debug" +"${1:run}": { + "adapter": "delve", + "configuration": { + "request": "launch", + "program": "${2:${workspaceFolder}}", + "mode": "debug", + "args": [ + "${3:*${CommandLineArgs}}" + ] + } +} +endsnippet diff --git a/.vim/after/plugin/cmp.vim b/.vim/after/plugin/cmp.vim index 226f8c5..e95dd71 100644 --- a/.vim/after/plugin/cmp.vim +++ b/.vim/after/plugin/cmp.vim @@ -9,6 +9,7 @@ packadd nvim-cmp packadd cmp-buffer packadd cmp-path packadd cmp-cmdline +packadd cmp-nvim-ultisnips lua <<EOF @@ -16,8 +17,14 @@ local cmp = require 'cmp' cmp.setup({ preselect = cmp.PreselectMode.None, + snippet = { + expand = function(args) + vim.fn["UltiSnips#Anon"](args.body) + end, + }, sources = cmp.config.sources({ + { name = 'ultisnips' }, { name = 'nvim_lsp' }, }, { { name = 'buffer' }, diff --git a/.vim/after/plugin/dap.vim b/.vim/after/plugin/dap.vim new file mode 100644 index 0000000..d452fce --- /dev/null +++ b/.vim/after/plugin/dap.vim @@ -0,0 +1,46 @@ +finish + +packadd nvim-dap +packadd nvim-dap-ui +packadd nvim-dap-go + +lua <<EOF + +local dap = require 'dap' +local dap_go = require 'dap-go' + +local widgets = require 'dap.ui.widgets' + +vim.keymap.set('n', '<localleader>b', dap.toggle_breakpoint) +vim.keymap.set('n', '<localleader>B', dap.list_breakpoints) +vim.keymap.set('n', '<localleader>c', dap.continue) +vim.keymap.set('n', '<localleader>n', dap.step_over) +vim.keymap.set('n', '<localleader>si', dap.step_into) +vim.keymap.set('n', '<localleader>so', dap.step_out) +vim.keymap.set('n', '<localleader>rl', dap.run_last) +vim.keymap.set('n', '<localleader>ut', dap.run_to_cursor) +vim.keymap.set('n', '<localleader>su', dap.up) +vim.keymap.set('n', '<localleader>sd', dap.down) +vim.keymap.set('n', '<localleader>K', widgets.hover) + +float_scopes = function () + widgets.centered_float(widgets.scopes) +end + +float_frames = function () + widgets.centered_float(widgets.frames) +end + +float_threads = function () + widgets.centered_float(widgets.threads) +end + +vim.keymap.set('n', '<localleader><localleader>s', float_scopes) +vim.keymap.set('n', '<localleader><localleader>f', float_frames) +vim.keymap.set('n', '<localleader><localleader>t', float_threads) +vim.keymap.set('n', '<localleader><localleader>r', dap.repl.toggle) + +dap_go.setup() + +EOF + diff --git a/.vim/after/plugin/git.vim b/.vim/after/plugin/git.vim new file mode 100644 index 0000000..687f2ab --- /dev/null +++ b/.vim/after/plugin/git.vim @@ -0,0 +1,7 @@ +if has('nvim') + let g:gitblame_enabled = 0 + + packadd plenary.nvim + packadd diffview.nvim + packadd git-blame.nvim +endif diff --git a/.vim/after/plugin/minpac.vim b/.vim/after/plugin/minpac.vim index baaac09..a557fda 100644 --- a/.vim/after/plugin/minpac.vim +++ b/.vim/after/plugin/minpac.vim @@ -23,13 +23,28 @@ function! InitMinpac() abort call minpac#add('https://github.com/ctrlpvim/ctrlp.vim.git', {'type': 'opt'}) call minpac#add('https://github.com/FelikZ/ctrlp-py-matcher.git', {'type': 'opt'}) call minpac#add('https://github.com/preservim/tagbar.git') + call minpac#add('https://github.com/puremourning/vimspector', {'type': 'opt'}) + + call minpac#add('https://github.com/nvim-lua/plenary.nvim', {'type': 'opt'}) + call minpac#add('https://github.com/sindrets/diffview.nvim', {'type': 'opt'}) + call minpac#add('https://github.com/f-person/git-blame.nvim', {'type': 'opt'}) + + call minpac#add('https://github.com/simrat39/symbols-outline.nvim', {'type': 'opt'}) call minpac#add('https://github.com/neovim/nvim-lspconfig', {'type': 'opt'}) + call minpac#add('https://github.com/ray-x/lsp_signature.nvim', {'type': 'opt'}) + + call minpac#add('https://github.com/mfussenegger/nvim-dap', {'type': 'opt'}) + call minpac#add('https://github.com/rcarriga/nvim-dap-ui', {'type': 'opt'}) + call minpac#add('https://github.com/leoluz/nvim-dap-go', {'type': 'opt'}) + call minpac#add('https://github.com/hrsh7th/nvim-cmp', {'type': 'opt'}) call minpac#add('https://github.com/hrsh7th/cmp-buffer', {'type': 'opt'}) call minpac#add('https://github.com/hrsh7th/cmp-path', {'type': 'opt'}) call minpac#add('https://github.com/hrsh7th/cmp-nvim-lsp', {'type': 'opt'}) call minpac#add('https://github.com/hrsh7th/cmp-cmdline', {'type': 'opt'}) + call minpac#add('https://github.com/quangnguyen30192/cmp-nvim-ultisnips', {'type': 'opt'}) + call minpac#add('https://github.com/nvim-treesitter/nvim-treesitter', { \ 'type': 'opt', \ 'do': 'if has("nvim") | packadd nvim-treesitter | :TSUpdate | endif', @@ -84,6 +99,9 @@ function! InitMinpac() abort call minpac#add('https://github.com/ledger/vim-ledger.git') call minpac#add('https://github.com/axvr/org.vim.git') call minpac#add('https://github.com/chr4/nginx.vim') + call minpac#add('https://github.com/iamcco/markdown-preview.nvim', { + \ 'type': 'start', + \ 'do': 'call mkdp#util#install()'}) let g:minpac_initialized = 1 endfunction diff --git a/.vim/after/plugin/nvim-lsp.vim b/.vim/after/plugin/nvim-lsp.vim index f6d23c3..d36ed3d 100644 --- a/.vim/after/plugin/nvim-lsp.vim +++ b/.vim/after/plugin/nvim-lsp.vim @@ -4,11 +4,15 @@ endif packadd nvim-lspconfig 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 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) @@ -41,10 +45,13 @@ local on_attach = function(client, bufnr) vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) -- vim.keymap.set('n', '<space>f', vim.lsp.buf.formatting, bufopts) + vim.keymap.set('n', '<leader><leader>s', symbols_outline.toggle_outline) + vim.cmd [[ - autocmd! BufWritePre *.go,*.rs lua vim.lsp.buf.formatting_sync(nil, 1000) + autocmd BufWritePre *.go,*.rs lua vim.lsp.buf.formatting_sync(nil, 1000) ]] + lsp_signature.on_attach() end local servers = { 'clangd', 'gopls' , 'gdscript', 'pylsp' } diff --git a/.vim/after/plugin/vimspector.vim b/.vim/after/plugin/vimspector.vim new file mode 100644 index 0000000..7157afb --- /dev/null +++ b/.vim/after/plugin/vimspector.vim @@ -0,0 +1,17 @@ +packadd vimspector + +nmap <leader>di <plug>VimspectorBalloonEval +xmap <leader>di <plug>VimspectorBalloonEval + +nmap <leader>db <plug>VimspectorToggleBreakpoint +nmap <leader>dB <plug>VimspectorBreakpoints + +nmap <leader>dc <plug>VimspectorContinue +nmap <leader>dr <plug>VimspectorRstart +nmap <leader>dn <plug>VimspectorStepOver +nmap <leader>dsi <plug>VimspectorStepInto +nmap <leader>dso <plug>VimspectorStepOut + +nmap <leader>dut <plug>VimspectorRunToCursor +nmap <leader>dq :VimspectorReset<CR> + diff --git a/.vim/filetype.vim b/.vim/filetype.vim index c29f97e..dce60b7 100644 --- a/.vim/filetype.vim +++ b/.vim/filetype.vim @@ -1,8 +1,16 @@ +if exists('did_load_filetypes') + finish +endif + augroup filetypedetect autocmd BufRead,BufNewFile *.org setfiletype org autocmd BufRead,BufNewFile *nginx.conf setfiletype nginx autocmd BufRead,BufNewFile /etc/nginx*.conf setfiletype nginx autocmd BufRead,BufNewFile *mutt-* setfiletype mail + + autocmd BufRead,BufNewFile .vimspector.json + \ setfiletype vimspector + \ | setlocal syntax=json augroup end autocmd FileType html setlocal shiftwidth=2 softtabstop=2 expandtab @@ -28,20 +28,17 @@ if has('python3') elseif has('python') endif -if has('nvim') - set packpath^=~/.vim - set packpath+=~/.vim/after - set runtimepath^=~/.vim - set runtimepath+=~/.vim/after -endif - " GUI set guioptions-=m set guioptions-=T set guioptions-=r set guioptions+=c -set guifont=DejaVu\ Sans\ Mono\ 12 +if has('nvim') + set guifont=Dejavu\ Sans\ Mono:h12 +else + set guifont=DejaVu\ Sans\ Mono\ 12 +endif if has('macunix') set guifont=Monaco:h16 endif @@ -131,7 +128,8 @@ set directory=~/.vim/.swp// set tags=./.tags;,.tags " mapping -let mapleader=',' " change the key <leader> +let mapleader=',' +let maplocalleader='\' nnoremap <leader>cd :cd %:p:h<CR> :pwd<CR> nnoremap <c-g><c-g> <Esc> cnoremap <C-G> <C-C> |