Don't run ctags in vim if in home directory

This commit is contained in:
Michael Campagnaro 2024-07-03 14:20:48 -04:00
parent 172396583f
commit 3bff9be48a

11
.vimrc
View File

@ -686,16 +686,19 @@ fu! CreateCtags()
return return
endif endif
" Abort if we're editing a text file. This won't be an exhaustive " Abort if the file is in a root drive directory because we don't want to recurse across the entire drive!
" filter. We can restrict what goes into the tag file
" First determine if we're in a root drive directory. If we are then
" we bail because we don't want to recurse across the entire drive!
let l:path = expand('%:p:h') let l:path = expand('%:p:h')
if IsRootDrive(l:path) if IsRootDrive(l:path)
call PrintError("Not going to run ctags because the file is in a root drive directory") call PrintError("Not going to run ctags because the file is in a root drive directory")
return return
endif endif
" Abort if the file is in the home directory for the same reason as above.
if l:path == expand('$HOME')
call PrintError("Not going to run ctags because the file is in the home directory")
return
endif
" Always ignore .git and node_modules " Always ignore .git and node_modules
let g:campo_ctags_exclude = g:campo_ctags_exclude + ['.git', 'node_modules'] let g:campo_ctags_exclude = g:campo_ctags_exclude + ['.git', 'node_modules']
let l:exclude_list = "" let l:exclude_list = ""