From a18d9f755c219bd12ed69e2a9f3f098c6b4d793d Mon Sep 17 00:00:00 2001 From: Peter Odding Date: Wed, 9 Jul 2014 21:53:12 +0200 Subject: Bug fix: Restore default syntax pattern prefix/suffix (word boundaries) This is a bug fix / improvement to the new syntax keyword usage introduced in b6f8757d004d5f4ef7280fd111a21821e6bee79a. Also relevant is issue #68 on GitHub, see https://github.com/xolox/vim-easytags/issues/68 @tarmack: Thanks for the feedback earlier today, it's now fixed! :-) --- autoload/xolox/easytags.vim | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'autoload') diff --git a/autoload/xolox/easytags.vim b/autoload/xolox/easytags.vim index 73e32cc..b98fb2b 100644 --- a/autoload/xolox/easytags.vim +++ b/autoload/xolox/easytags.vim @@ -3,7 +3,9 @@ " Last Change: July 9, 2014 " URL: http://peterodding.com/code/vim/easytags/ -let g:xolox#easytags#version = '3.6.2' +let g:xolox#easytags#version = '3.6.3' +let g:xolox#easytags#default_pattern_prefix = '\C\<' +let g:xolox#easytags#default_pattern_suffix = '\>' " Plug-in initialization. {{{1 @@ -314,8 +316,10 @@ function! xolox#easytags#highlight() " {{{2 if matches != [] " Convert matched tags to :syntax commands and execute them. let use_keywords_when = xolox#misc#option#get('easytags_syntax_keyword', 'auto') - let tagkind_has_patterns = !(empty(tagkind.pattern_prefix) && empty(tagkind.pattern_suffix)) - if use_keywords_when == 'always' || (use_keywords_when == 'auto' && !tagkind_has_patterns) + let has_default_pattern_prefix = (tagkind.pattern_prefix == g:xolox#easytags#default_pattern_prefix) + let has_default_pattern_suffix = (tagkind.pattern_suffix == g:xolox#easytags#default_pattern_suffix) + let has_non_default_patterns = !(has_default_pattern_prefix && has_default_pattern_suffix) + if use_keywords_when == 'always' || (use_keywords_when == 'auto' && !has_non_default_patterns) " Vim's ":syntax keyword" command doesn't use the regular " expression engine and the resulting syntax highlighting is " therefor much faster. Because of this we use the syntax @@ -490,10 +494,10 @@ endfunction function! xolox#easytags#define_tagkind(object) " {{{2 if !has_key(a:object, 'pattern_prefix') - let a:object.pattern_prefix = '' + let a:object.pattern_prefix = g:xolox#easytags#default_pattern_prefix endif if !has_key(a:object, 'pattern_suffix') - let a:object.pattern_suffix = '' + let a:object.pattern_suffix = g:xolox#easytags#default_pattern_suffix endif if !has_key(s:tagkinds, a:object.filetype) let s:tagkinds[a:object.filetype] = [] -- cgit v1.2.3