Stop vim from creating ctags when the process is already running
This commit is contained in:
parent
82487cfa67
commit
054aaa0808
19
vimrc
19
vimrc
|
@ -118,6 +118,10 @@ let g:campo_custom_search_args = ""
|
|||
" in this comment string)
|
||||
" let g:campo_custom_ctags_args = \"--exclude=3rd_party"
|
||||
let g:campo_custom_ctags_args = ""
|
||||
|
||||
" Default files and directories that ctags should ignore.
|
||||
let s:default_ctags_exclude_args = "--exclude=.git --exclude=*.md --exclude=*.txt --exclude=*.config --exclude=*.css --exclude=*.html --exclude=*.htm --exclude=*.json --exclude=node_modules --exclude=.cache"
|
||||
|
||||
" ---------------------------------------------------------------------------
|
||||
|
||||
"################################################################
|
||||
|
@ -464,7 +468,7 @@ augroup campoCmds
|
|||
|
||||
" Automatically wrap at N characters.
|
||||
autocmd FileType gitcommit setlocal colorcolumn=72
|
||||
autocmd BufRead,BufNewFile *.{md,txt,plan} execute "setlocal textwidth=" .s:max_line_length
|
||||
autocmd BufRead,BufNewFile *.{md,txt,plan} exec "setlocal textwidth=" .s:max_line_length
|
||||
|
||||
" Spell checking.
|
||||
autocmd FileType gitcommit,markdown,text setlocal spell
|
||||
|
@ -493,11 +497,14 @@ augroup campoCmds
|
|||
" The ampersand at the end is to make this run in the background. I had to
|
||||
" group the commands in parens to make the chained commands run in the
|
||||
" background.
|
||||
" @improve: don't run a bunch of ctags for the same project when mass
|
||||
" saving files. They all try to write and move newtags which tends to
|
||||
" lock up vim and/or spew errors.
|
||||
let l:ctags_cmd = "!(ctags --c-types=+l --c++-types=+l --exclude=*.md --exclude=*.txt --exclude=*.config --exclude=*.css --exclude=*.js --exclude=*.html --exclude=*.htm --exclude=*.json --exclude=node_modules --exclude=.git --exclude=.cache " . g:campo_custom_ctags_args . " --recurse=yes -o newtags; mv newtags tags) &"
|
||||
exec l:ctags_cmd | redraw!
|
||||
let l:lock_file = "ctags.lock"
|
||||
if !filereadable(l:lock_file) && !filereadable("newtags")
|
||||
" Will include local variables for C-like languages.
|
||||
let l:ctags_cmd = "!(touch ".l:lock_file."; ctags --c-types=+l --c++-types=+l ".s:default_ctags_exclude_args." ". g:campo_custom_ctags_args." --recurse=yes -o newtags; mv newtags tags; rm ".l:lock_file.") &"
|
||||
silent! exec l:ctags_cmd | redraw!
|
||||
else
|
||||
PrintError "ctags already running (found ".l:lock_file.")"
|
||||
endif
|
||||
endfun
|
||||
|
||||
" Generate ctags on save.
|
||||
|
|
Loading…
Reference in New Issue
Block a user