aboutsummaryrefslogtreecommitdiffstats
path: root/autoload.vim
diff options
context:
space:
mode:
authorPeter Odding <peter@peterodding.com>2010-08-10 18:57:22 +0200
committerPeter Odding <peter@peterodding.com>2010-08-10 18:57:22 +0200
commit0d9567900f23e8ca243db16df80004aa7c658623 (patch)
tree1b92261a6f2ab1eb7d4313f412cf987af470d031 /autoload.vim
parent80847259b7c3dd5781384f31914a7d7465ed0069 (diff)
downloadvim-easytags-0d9567900f23e8ca243db16df80004aa7c658623.tar.gz
Support for automatic recursion using ctags -R
Diffstat (limited to 'autoload.vim')
-rw-r--r--autoload.vim22
1 files changed, 18 insertions, 4 deletions
diff --git a/autoload.vim b/autoload.vim
index 51ef188..1de2e6c 100644
--- a/autoload.vim
+++ b/autoload.vim
@@ -67,8 +67,16 @@ function! s:check_cfile(silent, filter_tags, have_args) " {{{3
if a:have_args
return ''
endif
- let cfile = s:resolve(expand('%:p'))
let silent = a:silent || a:filter_tags
+ if g:easytags_autorecurse
+ let cdir = s:resolve(expand('%:p:h'))
+ if !isdirectory(cdir)
+ if silent | return '' | endif
+ throw "The directory of the current file doesn't exist yet!"
+ endif
+ return cdir
+ endif
+ let cfile = s:resolve(expand('%:p'))
if cfile == '' || !filereadable(cfile)
if silent | return '' | endif
throw "You'll need to save your file before using :UpdateTags!"
@@ -92,9 +100,14 @@ function! s:prep_cmdline(cfile, tagsfile, firstrun, arguments) " {{{3
call add(cmdline, '-f-')
endif
if a:cfile != ''
- let filetype = easytags#to_ctags_ft(&filetype)
- call add(cmdline, shellescape('--language-force=' . filetype))
- call add(cmdline, shellescape(a:cfile))
+ if g:easytags_autorecurse
+ call add(cmdline, '-R')
+ call add(cmdline, shellescape(a:cfile))
+ else
+ let filetype = easytags#to_ctags_ft(&filetype)
+ call add(cmdline, shellescape('--language-force=' . filetype))
+ call add(cmdline, shellescape(a:cfile))
+ endif
else
for fname in a:arguments
let matches = split(expand(fname), "\n")
@@ -108,6 +121,7 @@ endfunction
function! s:run_ctags(starttime, cfile, tagsfile, firstrun, cmdline) " {{{3
let output = []
if a:cmdline != ''
+ call xolox#debug("%s: Executing %s", s:script, a:cmdline)
try
let output = xolox#shell#execute(a:cmdline, 1)
catch /^Vim\%((\a\+)\)\=:E117/