vimrc: Disable gutentags when ctags unavailable

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

124
.vimrc
View File

@@ -113,71 +113,75 @@ 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',
\ 'dist', \ 'dist',
\ '*sites/*/files/*', \ '*sites/*/files/*',
\ 'bin', \ 'bin',
\ 'node_modules', \ 'node_modules',
\ 'bower_components', \ 'bower_components',
\ 'cache', \ 'cache',
\ 'compiled', \ 'compiled',
\ 'docs', \ 'docs',
\ 'example', \ 'example',
\ 'bundle', \ 'bundle',
\ 'vendor', \ 'vendor',
\ '*.md', \ '*.md',
\ '*-lock.json', \ '*-lock.json',
\ '*.lock', \ '*.lock',
\ '*bundle*.js', \ '*bundle*.js',
\ '*build*.js', \ '*build*.js',
\ '.*rc*', \ '.*rc*',
\ '*.json', \ '*.json',
\ '*.min.*', \ '*.min.*',
\ '*.map', \ '*.map',
\ '*.bak', \ '*.bak',
\ '*.zip', \ '*.zip',
\ '*.pyc', \ '*.pyc',
\ '*.class', \ '*.class',
\ '*.sln', \ '*.sln',
\ '*.Master', \ '*.Master',
\ '*.csproj', \ '*.csproj',
\ '*.tmp', \ '*.tmp',
\ '*.csproj.user', \ '*.csproj.user',
\ '*.cache', \ '*.cache',
\ '*.pdb', \ '*.pdb',
\ 'tags*', \ 'tags*',
\ 'cscope.*', \ 'cscope.*',
\ '*.css', \ '*.css',
\ '*.less', \ '*.less',
\ '*.scss', \ '*.scss',
\ '*.exe', '*.dll', \ '*.exe', '*.dll',
\ '*.mp3', '*.ogg', '*.flac', \ '*.mp3', '*.ogg', '*.flac',
\ '*.swp', '*.swo', \ '*.swp', '*.swo',
\ '*.bmp', '*.gif', '*.ico', '*.jpg', '*.png', \ '*.bmp', '*.gif', '*.ico', '*.jpg', '*.png',
\ '*.rar', '*.zip', '*.tar', '*.tar.gz', '*.tar.xz', '*.tar.bz2', \ '*.rar', '*.zip', '*.tar', '*.tar.gz', '*.tar.xz', '*.tar.bz2',
\ '*.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