diff options
author | gxlin <[email protected]> | 2021-03-16 10:42:48 +0800 |
---|---|---|
committer | gxlin <[email protected]> | 2021-03-16 10:42:48 +0800 |
commit | 06929ba11c0ef83da2462f60ee8c6dc07a2aa9a4 (patch) | |
tree | 7eede7fef35e892ec41b0db529819ce33871b016 /.vim | |
parent | 4d3b20b9445c1bcdd015e2babc03da91651898ed (diff) | |
download | dotfiles-06929ba11c0ef83da2462f60ee8c6dc07a2aa9a4.tar.gz dotfiles-06929ba11c0ef83da2462f60ee8c6dc07a2aa9a4.tar.bz2 dotfiles-06929ba11c0ef83da2462f60ee8c6dc07a2aa9a4.zip |
Split .vimrc to multiple vimscript files
Diffstat (limited to '.vim')
-rw-r--r-- | .vim/init.vim | 1 | ||||
-rw-r--r-- | .vim/plugins/ack.vim | 7 | ||||
-rw-r--r-- | .vim/plugins/airline.vim | 4 | ||||
-rw-r--r-- | .vim/plugins/ale.vim | 24 | ||||
-rw-r--r-- | .vim/plugins/gutentags.vim | 8 | ||||
-rw-r--r-- | .vim/plugins/init.vim | 19 | ||||
-rw-r--r-- | .vim/plugins/leaderf.vim | 22 | ||||
-rw-r--r-- | .vim/plugins/misc.vim | 19 | ||||
-rw-r--r-- | .vim/plugins/vimwiki.vim | 4 | ||||
-rw-r--r-- | .vim/plugins/youcompleteme.vim | 12 |
10 files changed, 120 insertions, 0 deletions
diff --git a/.vim/init.vim b/.vim/init.vim new file mode 100644 index 0000000..2a5d6df --- /dev/null +++ b/.vim/init.vim @@ -0,0 +1 @@ +source ~/.dotfiles/.vim/plugins/init.vim diff --git a/.vim/plugins/ack.vim b/.vim/plugins/ack.vim new file mode 100644 index 0000000..dd96e47 --- /dev/null +++ b/.vim/plugins/ack.vim @@ -0,0 +1,7 @@ +Plug 'mileszs/ack.vim' + +if executable('ag') + let g:ackprg = 'ag --vimgrep' +endif +cnoreabbrev Ack Ack! +nnoremap <Leader>a :Ack!<Space> diff --git a/.vim/plugins/airline.vim b/.vim/plugins/airline.vim new file mode 100644 index 0000000..a1c1b94 --- /dev/null +++ b/.vim/plugins/airline.vim @@ -0,0 +1,4 @@ +Plug 'vim-airline/vim-airline' +Plug 'vim-airline/vim-airline-themes' + +let g:airline#extensions#tabline#enabled = 1 diff --git a/.vim/plugins/ale.vim b/.vim/plugins/ale.vim new file mode 100644 index 0000000..f092c62 --- /dev/null +++ b/.vim/plugins/ale.vim @@ -0,0 +1,24 @@ +Plug 'dense-analysis/ale' + +let g:ale_linters_explicit = 1 +let g:ale_completion_delay = 500 +let g:ale_echo_delay = 20 +let g:ale_lint_delay = 500 +let g:ale_echo_msg_format = '[%linter%] %code: %%s' +let g:ale_lint_on_text_changed = 'normal' +let g:ale_lint_on_insert_leave = 1 +let g:airline#extensions#ale#enabled = 1 + +let g:ale_c_gcc_options = '-Wall -O2 -std=c99' +let g:ale_cpp_gcc_options = '-Wall -O2 -std=c++14' +let g:ale_c_cppcheck_options = '' +let g:ale_cpp_cppcheck_options = '' + +let g:ale_sign_error = "\ue009\ue009" +hi! clear SpellBad +hi! clear SpellCap +hi! clear SpellRare +hi! SpellBad gui=undercurl guisp=red +hi! SpellCap gui=undercurl guisp=blue +hi! SpellRare gui=undercurl guisp=magenta + diff --git a/.vim/plugins/gutentags.vim b/.vim/plugins/gutentags.vim new file mode 100644 index 0000000..c2a7090 --- /dev/null +++ b/.vim/plugins/gutentags.vim @@ -0,0 +1,8 @@ +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'] + diff --git a/.vim/plugins/init.vim b/.vim/plugins/init.vim new file mode 100644 index 0000000..590f18c --- /dev/null +++ b/.vim/plugins/init.vim @@ -0,0 +1,19 @@ +if empty(glob('~/.vim/autoload/plug.vim')) + silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs + \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + autocmd VimEnter * PlugInstall --sync | source $MYVIMRC +endif + +let s:plugins = split(expand('~/.dotfiles/.vim/plugins/*.vim')) + +function! s:load_plugins() + for plugin in s:plugins + if plugin !~ 'init.vim' + exec "source " . plugin + endif + endfor +endfunction + +call plug#begin('~/.vim/plugged') +call s:load_plugins() +call plug#end() diff --git a/.vim/plugins/leaderf.vim b/.vim/plugins/leaderf.vim new file mode 100644 index 0000000..4d6d0ac --- /dev/null +++ b/.vim/plugins/leaderf.vim @@ -0,0 +1,22 @@ +Plug 'Yggdroot/LeaderF', {'do': './install.sh'} + +" " Show icons, icons are shown by default +let g:Lf_ShowDevIcons = 1 + +" For GUI vim, the icon font can be specify like this, for example +let g:Lf_DevIconsFont = "DejaVuSansMono Nerd Font Mono" +let g:Lf_WindowPosition = 'popup' +let g:Lf_ShortcutF = "<leader>ff" + +noremap <leader>fb :<C-U><C-R>=printf("Leaderf buffer %s", "")<CR><CR> +noremap <leader>fm :<C-U><C-R>=printf("Leaderf mru %s", "")<CR><CR> +noremap <leader>ft :<C-U><C-R>=printf("Leaderf bufTag %s", "")<CR><CR> +noremap <leader>fl :<C-U><C-R>=printf("Leaderf line %s", "")<CR><CR> +noremap <C-B> :<C-U><C-R>=printf("Leaderf! rg --current-buffer -e %s ", expand("<cword>"))<CR> +noremap <C-F> :<C-U><C-R>=printf("Leaderf! rg -e %s ", expand("<cword>"))<CR> + +" search visually selected text literally +xnoremap gf :<C-U><C-R>=printf("Leaderf! rg -F -e %s ", leaderf#Rg#visual())<CR> +noremap go :<C-U>Leaderf! rg --recall<CR> +let g:Lf_RootMarkers = ['.project', '.root', '.svn', '.git'] +let g:Lf_WorkingDirectoryMode = 'AF' diff --git a/.vim/plugins/misc.vim b/.vim/plugins/misc.vim new file mode 100644 index 0000000..a07c23c --- /dev/null +++ b/.vim/plugins/misc.vim @@ -0,0 +1,19 @@ +Plug 'scrooloose/nerdtree', {'on': 'NERDTreeToggle'} + +map <C-n> :NERDTreeToggle<CR> + +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 <F10> :call asyncrun#quickfix_toggle(6)<cr> + +Plug 'puremourning/vimspector' + +let g:vimspector_enable_mappings = 'HUMAN' + +Plug 'mhinz/vim-signify' +Plug 'tpope/vim-unimpaired' +Plug 'godlygeek/tabular' +Plug 'ledger/vim-ledger', {'for': 'ledger'} diff --git a/.vim/plugins/vimwiki.vim b/.vim/plugins/vimwiki.vim new file mode 100644 index 0000000..226e135 --- /dev/null +++ b/.vim/plugins/vimwiki.vim @@ -0,0 +1,4 @@ +Plug 'vimwiki/vimwiki' + +let g:vimwiki_list = [{'path': '~/Documents/notes', + \ 'syntax': 'markdown', 'ext': '.md'}] diff --git a/.vim/plugins/youcompleteme.vim b/.vim/plugins/youcompleteme.vim new file mode 100644 index 0000000..449e8ff --- /dev/null +++ b/.vim/plugins/youcompleteme.vim @@ -0,0 +1,12 @@ +Plug 'Valloric/YouCompleteMe', {'do': 'python3 ./install.py --clangd-completer'} + +let g:ycm_server_log_level = 'info' +let g:ycm_add_preview_to_completeopt = 0 +let g:ycm_show_diagnostics_ui = 0 +let g:ycm_collect_identifiers_from_comments_and_strings = 1 +let g:ycm_complete_in_strings = 1 + +let g:ycm_filetype_whilelist = { + \ "c": 1, "cpp": 1, "sh": 1, "zsh": 1, + \ "python": 1, + \ } |