From dd7e28d3a92f901b8a1853cdd70656aa09bb4540 Mon Sep 17 00:00:00 2001 From: gxlin Date: Sun, 1 Aug 2021 23:51:46 +0800 Subject: Modify vim config --- .vim/plugin/init.vim | 176 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 168 insertions(+), 8 deletions(-) (limited to '.vim/plugin/init.vim') diff --git a/.vim/plugin/init.vim b/.vim/plugin/init.vim index 7f71d9c..1d02fcd 100644 --- a/.vim/plugin/init.vim +++ b/.vim/plugin/init.vim @@ -4,15 +4,8 @@ if empty(glob('~/.vim/autoload/plug.vim')) autocmd VimEnter * PlugInstall --sync | source $MYVIMRC endif -let s:plugins = split(expand('~/.vim/plugin/*.plug')) let s:settings = split(expand('~/.vim/plugin/*.vim')) -function! s:load_plugins() - for plugin in s:plugins - exec "source " . plugin - endfor -endfunction - function! s:load_settings() for setting in s:settings if setting !~ 'init.vim' @@ -22,7 +15,174 @@ function! s:load_settings() endfunction call plug#begin('~/.vim/plugged') -call s:load_plugins() + +" General +Plug 'Valloric/YouCompleteMe', { + \ 'do': 'python3 ./install.py --clangd-completer', + \ } +Plug 'prabirshrestha/vim-lsp' +Plug 'mattn/vim-lsp-settings' + +Plug 'dense-analysis/ale' +Plug 'sheerun/vim-polyglot' +Plug 'Yggdroot/LeaderF', {'do': ':LeaderfInstallCExtension'} +Plug 'tpope/vim-eunuch' +Plug 'godlygeek/tabular' +Plug 'ludovicchabant/vim-gutentags' + +let g:gutentags_project_root = ['.root', '.svn', '.git', '.hg', '.project'] +let g:gutentags_ctags_tagfile = '.tags' +let g:gutentags_ctags_extra_args = ['--fields=+niazS', '--extra=+q'] +let g:gutentags_ctags_extra_args = ['--c++-kinds=+px'] +let g:gutentags_ctags_extra_args = ['--c-kinds=+px'] + + +let g:ycm_language_server = [] +let g:Lf_RootMarkers = [] +Plug 'vim-airline/vim-airline' +Plug 'vim-airline/vim-airline-themes' + +let g:airline#extensions#tabline#enabled = 1 +Plug 'tpope/vim-fugitive' + +nnoremap gl :Gclog! -- % +nnoremap gd :Gdiffsplit +nnoremap gs :G +Plug 'easymotion/vim-easymotion' + +map (easymotion-prefix) + +" Language specific +Plug 'habamax/vim-godot', {'for': 'gdscript'} +Plug 'plasticboy/vim-markdown' +Plug 'scrooloose/nerdtree', {'on': 'NERDTreeToggle'} +Plug 'ledger/vim-ledger', {'for': 'ledger'} + +let g:ledger_bin = 'ledger' +let g:ledger_align_at = 50 +let g:ledger_commodity_before = 0 + +au FileType ledger call s:ledger_keymap() + +function! s:ledger_keymap() abort + noremap { ?^\d + noremap } /^\d + inoremap =ledger#autocomplete_and_align() + vnoremap :LedgerAlign +endfunction +Plug 'iamcco/markdown-preview.nvim', { + \ 'do': {-> mkdp#util#install()}, + \ 'for': ['markdown', 'vim-plug'] + \ } + +" REPL +Plug 'jpalardy/vim-slime', { + \'on': [ + \'SlimeRegionSend', + \'SlimeParagraphSend', + \'SlimeConfig' + \] + \} + +let g:slime_no_mappings = 1 + +xmap SlimeRegionSend +nmap SlimeParagraphSend +nmap v SlimeConfig + +let g:slime_target = 'tmux' + +" Misc +Plug 'skywind3000/asyncrun.vim' + +let g:asyncrun_open = 6 " the number of lines of quickfix window +let g:asyncrun_bell = 1 " the bell rings when the task is done +" use f10 to open/close asyncrun quickfix window +nnoremap :call asyncrun#quickfix_toggle(6) + + +Plug 'mhinz/vim-signify' +Plug 'tpope/vim-unimpaired' + +Plug 'joshdick/onedark.vim' +Plug 'liuchengxu/vista.vim' + +let g:vista_default_executive = 'ctags' + +let g:vista_executive_for = { + \ 'go': 'vim_lsp', + \ } + +nnoremap s :Vista + +Plug 'puremourning/vimspector', { 'on': 'VimspectorContinue' } + +let g:vimspector_install_gadgets = ['debugpy'] + +nmap dc VimspectorContinue +nmap dq VimspectorStop +nmap db VimspectorToggleBreakpoint +nmap dn VimspectorStepOver +nmap ds VimspectorStepInto +nmap df VimspectorStepOut +nmap di VimspectorBalloonEval +xmap di VimspectorBalloonEval + +let s:mapped = {} + +function! s:set_debug_keymaps() abort + if has_key(s:mapped, string(bufnr())) + return + endif + + " nmap c VimspectorContinue + " nmap q VimspectorStop + " nmap b VimspectorToggleBreakpoint + nmap m VimspectorStepOver + " nmap s VimspectorStepInto + " nmap f VimspectorStepOut + " nmap i VimspectorBalloonEval + " xmap i VimspectorBalloonEval + + let s:mapped[string(bufnr())] = {'modifiable': &modifiable} + + setlocal nomodifiable +endfunction + +function! s:unset_debug_keymaps() abort + let original_buf = bufnr() + let hidden = &hidden + + try + set hidden + for bufnr in keys(s:mapped) + try + execute 'noautocmd buffer' bufnr + " silent! nunmap c + " silent! nunmap q + " silent! nunmap b + silent! nunmap m + " silent! nunmap s + " silent! nunmap f + " silent! nunmap i + " silent! xunmap i + + let &l:modifiable = s:mapped[bufnr]['modifiable'] + endtry + endfor + finally + execute 'noautocmd buffer' original_buf + let &hidden = hidden + endtry + + let s:mapped = {} +endfunction + +augroup CustomMappings + au! + autocmd User VimspectorJumpedToFrame call s:set_debug_keymaps() + autocmd User VimspectorDebugEnded call s:unset_debug_keymaps() +augroup end call plug#end() call s:load_settings() -- cgit v1.2.3