From ef00232b6df90dbba49ff5ddbd6ef1543a297545 Mon Sep 17 00:00:00 2001 From: Guangxiong Lin Date: Sun, 10 Oct 2021 10:11:13 +0800 Subject: Update vim config --- .vim/plugin/editorconfig.vim | 2 ++ .vim/plugin/gutentags.vim | 19 +++++++++++++++++++ .vim/plugin/init.vim | 9 ++------- .vim/plugin/lsp.vim | 9 +++++++++ .vim/plugin/rooter.vim | 1 + 5 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 .vim/plugin/editorconfig.vim create mode 100644 .vim/plugin/gutentags.vim create mode 100644 .vim/plugin/rooter.vim diff --git a/.vim/plugin/editorconfig.vim b/.vim/plugin/editorconfig.vim new file mode 100644 index 0000000..70a4c16 --- /dev/null +++ b/.vim/plugin/editorconfig.vim @@ -0,0 +1,2 @@ +let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*'] +au FileType gitcommit let b:EditorConfig_disable = 1 diff --git a/.vim/plugin/gutentags.vim b/.vim/plugin/gutentags.vim new file mode 100644 index 0000000..25bfaaf --- /dev/null +++ b/.vim/plugin/gutentags.vim @@ -0,0 +1,19 @@ +let g:gutentags_project_root = ['.root', '.svn', '.git', '.hg', '.project'] +let g:gutentags_ctags_tagfile = '.tags' +let g:gutentags_cache_dir = expand('~/.cache/tags') +let g:gutentags_ctags_extra_args = ['--fields=+niazS', '--extras=+q'] +let g:gutentags_ctags_extra_args += ['--c++-kinds=+px'] +let g:gutentags_ctags_extra_args += ['--c-kinds=+px'] +let g:gutentags_ctags_extra_args += ['--output-format=e-ctags'] +let g:gutentags_define_advanced_commands = 1 + +let $GTAGSLABEL = 'native-pygments' +let $GTAGSCONF = '/usr/local/share/gtags/gtags.conf' + +let g:gutentags_modules = [] +if executable('ctags') + let g:gutentags_modules += ['ctags'] +endif +if executable('gtags') && executable('gtags-cscope') + let g:gutentags_modules += ['gtags_cscope'] +endif diff --git a/.vim/plugin/init.vim b/.vim/plugin/init.vim index 0c2f2dd..2f5afd4 100644 --- a/.vim/plugin/init.vim +++ b/.vim/plugin/init.vim @@ -32,13 +32,6 @@ Plug 'godlygeek/tabular' Plug 'airblade/vim-rooter' 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'] - - Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' @@ -53,6 +46,8 @@ Plug 'easymotion/vim-easymotion' map (easymotion-prefix) +Plug 'editorconfig/editorconfig-vim' + " Language specific Plug 'habamax/vim-godot', {'for': 'gdscript'} Plug 'scrooloose/nerdtree', {'on': 'NERDTreeToggle'} diff --git a/.vim/plugin/lsp.vim b/.vim/plugin/lsp.vim index 0cd0a36..cc40ee6 100644 --- a/.vim/plugin/lsp.vim +++ b/.vim/plugin/lsp.vim @@ -5,6 +5,15 @@ if executable('gopls') \ 'allowlist': ['go'], \ }) endif +if executable('ccls') + au User lsp_setup call lsp#register_server({ + \ 'name': 'ccls', + \ 'cmd': {server_info->['ccls']}, + \ 'root_uri': {server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'compile_commands.json'))}, + \ 'initialization_options': {'cache': {'directory': expand('~/.cache/ccls') }}, + \ 'allowlist': ['c', 'cpp', 'objc', 'objcpp', 'cc'], + \ }) +endif function! s:on_lsp_buffer_enabled() abort setlocal omnifunc=lsp#complete diff --git a/.vim/plugin/rooter.vim b/.vim/plugin/rooter.vim new file mode 100644 index 0000000..bb07c0a --- /dev/null +++ b/.vim/plugin/rooter.vim @@ -0,0 +1 @@ +let g:rooter_patterns = ['.git'] -- cgit v1.2.3