From 47be6a508c4150f8ef2627ae185c650c081c6bbf Mon Sep 17 00:00:00 2001 From: Guangxiong Lin Date: Sat, 4 Jun 2022 19:17:01 +0800 Subject: Add more plugins for nvim --- .vim/UltiSnips/vimspector.snippets | 23 +++++++++++++++++++ .vim/after/plugin/cmp.vim | 7 ++++++ .vim/after/plugin/dap.vim | 46 ++++++++++++++++++++++++++++++++++++++ .vim/after/plugin/git.vim | 7 ++++++ .vim/after/plugin/minpac.vim | 18 +++++++++++++++ .vim/after/plugin/nvim-lsp.vim | 9 +++++++- .vim/after/plugin/vimspector.vim | 17 ++++++++++++++ .vim/filetype.vim | 8 +++++++ .vimrc | 16 ++++++------- 9 files changed, 141 insertions(+), 10 deletions(-) create mode 100644 .vim/UltiSnips/vimspector.snippets create mode 100644 .vim/after/plugin/dap.vim create mode 100644 .vim/after/plugin/git.vim create mode 100644 .vim/after/plugin/vimspector.vim 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:} + } +} +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 <b', dap.toggle_breakpoint) +vim.keymap.set('n', 'B', dap.list_breakpoints) +vim.keymap.set('n', 'c', dap.continue) +vim.keymap.set('n', 'n', dap.step_over) +vim.keymap.set('n', 'si', dap.step_into) +vim.keymap.set('n', 'so', dap.step_out) +vim.keymap.set('n', 'rl', dap.run_last) +vim.keymap.set('n', 'ut', dap.run_to_cursor) +vim.keymap.set('n', 'su', dap.up) +vim.keymap.set('n', 'sd', dap.down) +vim.keymap.set('n', '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', 's', float_scopes) +vim.keymap.set('n', 'f', float_frames) +vim.keymap.set('n', 't', float_threads) +vim.keymap.set('n', '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 <f', vim.lsp.buf.formatting, bufopts) + vim.keymap.set('n', '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 di VimspectorBalloonEval +xmap di VimspectorBalloonEval + +nmap db VimspectorToggleBreakpoint +nmap dB VimspectorBreakpoints + +nmap dc VimspectorContinue +nmap dr VimspectorRstart +nmap dn VimspectorStepOver +nmap dsi VimspectorStepInto +nmap dso VimspectorStepOut + +nmap dut VimspectorRunToCursor +nmap dq :VimspectorReset + 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 diff --git a/.vimrc b/.vimrc index 4f25b5d..6ec5036 100644 --- a/.vimrc +++ b/.vimrc @@ -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 +let mapleader=',' +let maplocalleader='\' nnoremap cd :cd %:p:h :pwd nnoremap cnoremap -- cgit v1.2.3