diff options
author | Peter Odding <peter@peterodding.com> | 2014-07-09 21:44:59 +0200 |
---|---|---|
committer | Peter Odding <peter@peterodding.com> | 2014-07-09 21:44:59 +0200 |
commit | 2ff14b321f3ca45073320259f77af1014dc197e0 (patch) | |
tree | 7b4916142562876bde6cecf75cd71130e4658543 /autoload | |
parent | 0a64a812342956bacc00b54c216b54170d884a01 (diff) | |
download | vim-easytags-2ff14b321f3ca45073320259f77af1014dc197e0.tar.gz |
Filter out forbidden syntax keyword arguments
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
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/xolox/easytags.vim | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/autoload/xolox/easytags.vim b/autoload/xolox/easytags.vim index 8103324..73e32cc 100644 --- a/autoload/xolox/easytags.vim +++ b/autoload/xolox/easytags.vim @@ -3,7 +3,7 @@ " Last Change: July 9, 2014 " URL: http://peterodding.com/code/vim/easytags/ -let g:xolox#easytags#version = '3.6.1' +let g:xolox#easytags#version = '3.6.2' " Plug-in initialization. {{{1 @@ -375,10 +375,33 @@ endfunction function! s:is_keyword_compatible(tag) let name = get(a:tag, 'name', '') if !empty(name) - return name =~ '^\k\+$' && len(name) <= 80 + " Make sure the tag contains only `keyword characters' (included in the + " &iskeyword option) and is not longer than 80 characters (these + " limitations are documented under :help :syn-keyword). + if name =~ '^\k\+$' && len(name) <= 80 + " Make sure the tag doesn't conflict with one of the named options + " accepted by the `:syntax keyword' command (using these named options + " improperly, e.g. without a mandatory argument, will raise an error). + return !has_key(s:invalid_keywords, name) endif + return 0 endfunction +" These are documented under :help E395, except for "contains" which is not +" documented as being forbidden but when used definitely triggers an error. +let s:invalid_keywords = { + \ 'cchar': 1, + \ 'conceal': 1, + \ 'contained': 1, + \ 'containedin': 1, + \ 'contains': 1, + \ 'nextgroup': 1, + \ 'skipempty': 1, + \ 'skipnl': 1, + \ 'skipwhite': 1, + \ 'transparent': 1, + \ } + " Public supporting functions (might be useful to others). {{{1 function! xolox#easytags#get_tagsfile() " {{{2 |