diff --git a/vimrc b/vimrc index 7dec805..b526de1 100644 --- a/vimrc +++ b/vimrc @@ -565,9 +565,14 @@ augroup campoCmds " Include local variables for C-like languages. let l:ctags_cmd = 'ctags '.l:exclude_list.' '.g:campo_custom_ctags_args.' --c-types=+l --c++-types=+l -o newtags' - " If there's an error running ctags then this echo will cause the - " error msg to be displayed on a new line. - echo '' + " Add the filename to the ctags command if not running in recursive mode. + let l:recursive = matchstr(g:campo_custom_ctags_args, '\(-R\s\)\|\(-R$\)\|\(--recurse=yes\)\|\(--recurse\s\)\|\(--recurse$\)') + if l:recursive == '' + let l:ctags_cmd = l:ctags_cmd . ' ' . expand('%:t') + echo "Creating non-recursive ctags" + else + echo "Creating recursive ctags" + endif " 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.