From 708dab5f9abb58b7aed57c5324bf8f7c5241adb1 Mon Sep 17 00:00:00 2001 From: kphoen Date: Mon, 27 Jun 2011 21:19:43 +0200 Subject: [PATCH] Fix: patched to handle composed filetypes (ex: when using php.symfony filetype, Taglist will search for the php tags file) modified: plugin/taglist-plus.vim --- plugin/taglist-plus.vim | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/plugin/taglist-plus.vim b/plugin/taglist-plus.vim index 98f02a2..a5df6c1 100644 --- a/plugin/taglist-plus.vim +++ b/plugin/taglist-plus.vim @@ -950,6 +950,17 @@ function! s:Tlist_FileType_Init(ftype) return 1 endfunction +" Tlist_Fix_Ftype +" If the filetype is composed (foo.bar), only the part before the dot +" will be returned +function! s:Tlist_Fix_Ftype(raw_ftype) + if match(a:raw_ftype, '\.') + return split(a:raw_ftype, '\.')[0] + else + return a:raw_ftype + endif +endfunction + " Tlist_Detect_Filetype " Determine the filetype for the specified file using the filetypedetect " autocmd. @@ -972,7 +983,7 @@ function! s:Tlist_Detect_Filetype(fname) let &filetype = old_filetype let &eventignore = old_eventignore - return ftype + return s:Tlist_Fix_Ftype(ftype) endfunction " Tlist_Get_Buffer_Filetype @@ -982,12 +993,12 @@ function! s:Tlist_Get_Buffer_Filetype(bnum) if bufloaded(a:bnum) " For loaded buffers, the 'filetype' is already determined - return buf_ft + return s:Tlist_Fix_Ftype(buf_ft) endif " For unloaded buffers, if the 'filetype' option is set, return it if buf_ft != '' - return buf_ft + return s:Tlist_Fix_Ftype(buf_ft) endif " Skip non-existent buffers