From ee0966c041bb48e9b2537ed36e09666be1f1f45f Mon Sep 17 00:00:00 2001 From: Peter Odding Date: Sat, 9 Jul 2011 00:45:34 +0200 Subject: Never try to autoload plug-in for unsupported file types --- autoload/xolox/easytags.vim | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'autoload') diff --git a/autoload/xolox/easytags.vim b/autoload/xolox/easytags.vim index 7519b85..03bb05d 100644 --- a/autoload/xolox/easytags.vim +++ b/autoload/xolox/easytags.vim @@ -1,6 +1,6 @@ " Vim script " Author: Peter Odding -" Last Change: June 27, 2011 +" Last Change: July 9, 2011 " URL: http://peterodding.com/code/vim/easytags/ " Public interface through (automatic) commands. {{{1 @@ -34,19 +34,23 @@ endfunction function! xolox#easytags#autoload() " {{{2 try - " Update entries for current file in tags file? - if xolox#misc#option#get('easytags_auto_update', 1) - let pathname = s:resolve(expand('%:p')) - if pathname != '' - let tags_outdated = getftime(pathname) > getftime(xolox#easytags#get_tagsfile()) - if tags_outdated || !xolox#easytags#file_has_tags(pathname) - call xolox#easytags#update(1, 0, []) + let do_update = xolox#misc#option#get('easytags_auto_update', 1) + let do_highlight = xolox#misc#option#get('easytags_auto_highlight', 1) && &eventignore !~? '\' + " Don't execute this function for unsupported file types (doesn't load + " the list of file types if updates and highlighting are both disabled). + if (do_update || do_highlight) && index(xolox#easytags#supported_filetypes(), &ft) >= 0 + " Update entries for current file in tags file? + if do_update + let pathname = s:resolve(expand('%:p')) + if pathname != '' + let tags_outdated = getftime(pathname) > getftime(xolox#easytags#get_tagsfile()) + if tags_outdated || !xolox#easytags#file_has_tags(pathname) + call xolox#easytags#update(1, 0, []) + endif endif endif - endif - " Apply highlighting of tags to current buffer? - if xolox#misc#option#get('easytags_auto_highlight', 1) - if &eventignore !~? '\' + " Apply highlighting of tags to current buffer? + if do_highlight if !exists('b:easytags_last_highlighted') call xolox#easytags#highlight() else -- cgit v1.2.3