vimrc: Disable gutentags when ctags unavailable

This commit is contained in:
2020-07-04 21:24:48 +02:00
parent 55a06db3fe
commit a9f4901e25

26
.vimrc
View File

@@ -113,24 +113,27 @@ command! -bang -range=% -complete=file -nargs=* W <line1>,<line2>write<bang> <ar
command! -bang Q quit<bang> command! -bang Q quit<bang>
" Gutentags configuration " Gutentags configuration
let g:gutentags_add_default_project_roots = 0 if !executable('ctags')
let g:gutentags_project_root = ['.git'] let g:gutentags_enabled = 0
else
let g:gutentags_add_default_project_roots = 0
let g:gutentags_project_root = ['.git']
let g:gutentags_generate_on_new = 1 let g:gutentags_generate_on_new = 1
let g:gutentags_generate_on_missing = 1 let g:gutentags_generate_on_missing = 1
let g:gutentags_generate_on_write = 1 let g:gutentags_generate_on_write = 1
let g:gutentags_generate_on_empty_buffer = 0 let g:gutentags_generate_on_empty_buffer = 0
" Put all tags in one place " Put all tags in one place
let g:gutentags_cache_dir = expand('~/.cache/vim/ctags/') let g:gutentags_cache_dir = expand('~/.cache/vim/ctags/')
" Extra tag information " Extra tag information
let g:gutentags_ctags_extra_args = [ let g:gutentags_ctags_extra_args = [
\ '--tag-relative=yes', \ '--tag-relative=yes',
\ '--fields=+ailmnS', \ '--fields=+ailmnS',
\ ] \ ]
let g:gutentags_ctags_exclude = [ let g:gutentags_ctags_exclude = [
\ '*.git', '*.svg', '*.hg', \ '*.git', '*.svg', '*.hg',
\ '*/tests/*', \ '*/tests/*',
\ 'build', \ 'build',
@@ -178,6 +181,7 @@ let g:gutentags_ctags_exclude = [
\ '*.pdf', '*.doc', '*.docx', '*.ppt', '*.pptx', \ '*.pdf', '*.doc', '*.docx', '*.ppt', '*.pptx',
\ ] \ ]
endif
" fugitive.vim looks for tags in .git " fugitive.vim looks for tags in .git
" set tags +=~/tags " Recursively move upwards in tree, searching in subfolders for tags file " set tags +=~/tags " Recursively move upwards in tree, searching in subfolders for tags file