Skip to content

Commit

Permalink
Bug fix: Restore default syntax pattern prefix/suffix (word boundaries)
Browse files Browse the repository at this point in the history
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! :-)
  • Loading branch information
xolox committed Jul 9, 2014
1 parent 2ff14b3 commit a18d9f7
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions autoload/xolox/easytags.vim
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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] = []
Expand Down

0 comments on commit a18d9f7

Please sign in to comment.