From 2ff14b321f3ca45073320259f77af1014dc197e0 Mon Sep 17 00:00:00 2001 From: Peter Odding Date: Wed, 9 Jul 2014 21:44:59 +0200 Subject: 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 --- autoload/xolox/easytags.vim | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'autoload') 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 -- cgit v1.2.3