aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Odding <peter@peterodding.com>2014-07-09 21:53:12 +0200
committerPeter Odding <peter@peterodding.com>2014-07-09 21:53:12 +0200
commita18d9f755c219bd12ed69e2a9f3f098c6b4d793d (patch)
tree83e6c10719cddbeec34d570b65aac93e50ee2db3
parent2ff14b321f3ca45073320259f77af1014dc197e0 (diff)
downloadvim-easytags-a18d9f755c219bd12ed69e2a9f3f098c6b4d793d.tar.gz
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! :-)
-rw-r--r--autoload/xolox/easytags.vim14
1 files changed, 9 insertions, 5 deletions
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] = []