diff options
| author | Peter Odding <peter@peterodding.com> | 2011-06-13 18:16:25 +0200 | 
|---|---|---|
| committer | Peter Odding <peter@peterodding.com> | 2011-06-13 18:16:25 +0200 | 
| commit | 4df41adeff4579d16d0a2ad125e13b7c7a90344f (patch) | |
| tree | e9a7a0ab5167dd90ea6d3d8df5460f1be8eac644 /autoload/xolox | |
| parent | 2094759c5206d974732fa699018d33d6fca910d2 (diff) | |
| download | vim-easytags-4df41adeff4579d16d0a2ad125e13b7c7a90344f.tar.gz | |
Basic support for file type specific tags files!
Diffstat (limited to 'autoload/xolox')
| -rw-r--r-- | autoload/xolox/easytags.vim | 18 | 
1 files changed, 11 insertions, 7 deletions
| diff --git a/autoload/xolox/easytags.vim b/autoload/xolox/easytags.vim index 3c7f7dd..c78b261 100644 --- a/autoload/xolox/easytags.vim +++ b/autoload/xolox/easytags.vim @@ -7,13 +7,14 @@ let s:script = expand('<sfile>:p:~')  " Public interface through (automatic) commands. {{{1 -function! xolox#easytags#register() " {{{2 +function! xolox#easytags#register(global) " {{{2    " Parse the &tags option and get a list of all tags files *including    " non-existing files* (this is why we can't just call tagfiles()).    let tagfiles = xolox#misc#option#split_tags(&tags)    let expanded = map(copy(tagfiles), 'resolve(expand(v:val))')    " Add the filename to the &tags option when the user hasn't done so already. -  if index(expanded, xolox#misc#path#absolute(g:easytags_file)) == -1 +  let tagsfile = a:global ? g:easytags_file : xolox#easytags#get_tagsfile() +  if index(expanded, xolox#misc#path#absolute(tagsfile)) == -1      " This is a real mess because of bugs in Vim?! :let &tags = '...' doesn't      " work on UNIX and Windows, :set tags=... doesn't work on Windows. What I      " mean with "doesn't work" is that tagfiles() == [] after the :let/:set @@ -21,9 +22,9 @@ function! xolox#easytags#register() " {{{2      " this is a bug in Vim is to type :set tags= then press <Tab> followed by      " <CR>. Now you entered the exact same value that the code below also did      " but suddenly Vim sees the tags file and tagfiles() != [] :-S -    call add(tagfiles, g:easytags_file) +    call add(tagfiles, tagsfile)      let value = xolox#misc#option#join_tags(tagfiles) -    let cmd = 'set tags=' . escape(value, '\ ') +    let cmd = (a:global ? 'set' : 'setl') . ' tags=' . escape(value, '\ ')      if xolox#misc#os#is_win() && v:version < 703        " TODO How to clear the expression from Vim's status line?        call feedkeys(":" . cmd . "|let &ro=&ro\<CR>", 'n') @@ -35,7 +36,7 @@ endfunction  function! xolox#easytags#autoload() " {{{2    try -    " Update the entries for the current file in the global tags file? +    " Update entries for current file in tags file?      let pathname = s:resolve(expand('%:p'))      if pathname != ''        let tags_outdated = getftime(pathname) > getftime(xolox#easytags#get_tagsfile()) @@ -43,7 +44,7 @@ function! xolox#easytags#autoload() " {{{2          call xolox#easytags#update(1, 0, [])        endif      endif -    " Apply highlighting of tags in global tags file to current buffer? +    " Apply highlighting of tags to current buffer?      if &eventignore !~? '\<syntax\>'        if !exists('b:easytags_last_highlighted')          call xolox#easytags#highlight() @@ -376,7 +377,10 @@ endfunction  function! xolox#easytags#get_tagsfile() " {{{2    let tagsfile = expand(g:easytags_file) -  if g:easytags_dynamic_files +  if !empty(g:easytags_by_filetype) && !empty(&filetype) +    let directory = xolox#misc#path#absolute(g:easytags_by_filetype) +    let tagsfile = xolox#misc#path#merge(directory, &filetype) +  elseif g:easytags_dynamic_files      let files = tagfiles()      if len(files) > 0        let tagsfile = files[0] | 
