Skip to content

Commit a18d9f7

Browse files
committed
Bug fix: Restore default syntax pattern prefix/suffix (word boundaries)
This is a bug fix / improvement to the new syntax keyword usage introduced in b6f8757. Also relevant is issue #68 on GitHub, see #68 @tarmack: Thanks for the feedback earlier today, it's now fixed! :-)
1 parent 2ff14b3 commit a18d9f7

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

autoload/xolox/easytags.vim

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
" Last Change: July 9, 2014
44
" URL: http://peterodding.com/code/vim/easytags/
55

6-
let g:xolox#easytags#version = '3.6.2'
6+
let g:xolox#easytags#version = '3.6.3'
7+
let g:xolox#easytags#default_pattern_prefix = '\C\<'
8+
let g:xolox#easytags#default_pattern_suffix = '\>'
79

810
" Plug-in initialization. {{{1
911

@@ -314,8 +316,10 @@ function! xolox#easytags#highlight() " {{{2
314316
if matches != []
315317
" Convert matched tags to :syntax commands and execute them.
316318
let use_keywords_when = xolox#misc#option#get('easytags_syntax_keyword', 'auto')
317-
let tagkind_has_patterns = !(empty(tagkind.pattern_prefix) && empty(tagkind.pattern_suffix))
318-
if use_keywords_when == 'always' || (use_keywords_when == 'auto' && !tagkind_has_patterns)
319+
let has_default_pattern_prefix = (tagkind.pattern_prefix == g:xolox#easytags#default_pattern_prefix)
320+
let has_default_pattern_suffix = (tagkind.pattern_suffix == g:xolox#easytags#default_pattern_suffix)
321+
let has_non_default_patterns = !(has_default_pattern_prefix && has_default_pattern_suffix)
322+
if use_keywords_when == 'always' || (use_keywords_when == 'auto' && !has_non_default_patterns)
319323
" Vim's ":syntax keyword" command doesn't use the regular
320324
" expression engine and the resulting syntax highlighting is
321325
" therefor much faster. Because of this we use the syntax
@@ -490,10 +494,10 @@ endfunction
490494

491495
function! xolox#easytags#define_tagkind(object) " {{{2
492496
if !has_key(a:object, 'pattern_prefix')
493-
let a:object.pattern_prefix = ''
497+
let a:object.pattern_prefix = g:xolox#easytags#default_pattern_prefix
494498
endif
495499
if !has_key(a:object, 'pattern_suffix')
496-
let a:object.pattern_suffix = ''
500+
let a:object.pattern_suffix = g:xolox#easytags#default_pattern_suffix
497501
endif
498502
if !has_key(s:tagkinds, a:object.filetype)
499503
let s:tagkinds[a:object.filetype] = []

0 commit comments

Comments
 (0)