FIX: Avoid that the sigils used for highlighting match inside a tag.

When there's a tag e.g. "foo-bar", the "-bar" part is matched as TagbarKind. Add a zero-width condition to all sigil patterns that allow only whitespace characters before the sigil.
This commit is contained in:
Ingo Karkat 2013-04-12 21:14:23 +02:00
parent 87d293206b
commit 32b5b15b52

View File

@ -12,20 +12,20 @@ if exists("b:current_syntax")
endif
let s:ics= escape(join(g:tagbar_iconchars, ''), ']^\-')
let s:pattern = '\([' . s:ics . '] \?\)\@<=[^-+: ]\+[^:]\+$'
let s:pattern = '\(\S\@<![' . s:ics . '] \?\)\@<=[^-+: ]\+[^:]\+$'
execute "syntax match TagbarKind '" . s:pattern . "'"
let s:pattern = '\([' . s:ics . '][-+# ]\?\)\@<=[^*(]\+\(\*\?\(([^)]\+)\)\? :\)\@='
let s:pattern = '\(\S\@<!' . s:ics . '][-+# ]\?\)\@<=[^*(]\+\(\*\?\(([^)]\+)\)\? :\)\@='
execute "syntax match TagbarScope '" . s:pattern . "'"
let s:pattern = '[' . s:ics . ']\([-+# ]\?\)\@='
let s:pattern = '\S\@<![' . s:ics . ']\([-+# ]\?\)\@='
execute "syntax match TagbarFoldIcon '" . s:pattern . "'"
let s:pattern = '\([' . s:ics . ' ]\)\@<=+\([^-+# ]\)\@='
let s:pattern = '\(\S\@<![' . s:ics . ' ]\)\@<=+\([^-+# ]\)\@='
execute "syntax match TagbarVisibilityPublic '" . s:pattern . "'"
let s:pattern = '\([' . s:ics . ' ]\)\@<=#\([^-+# ]\)\@='
let s:pattern = '\(\S\@<![' . s:ics . ' ]\)\@<=#\([^-+# ]\)\@='
execute "syntax match TagbarVisibilityProtected '" . s:pattern . "'"
let s:pattern = '\([' . s:ics . ' ]\)\@<=-\([^-+# ]\)\@='
let s:pattern = '\(\S\@<![' . s:ics . ' ]\)\@<=-\([^-+# ]\)\@='
execute "syntax match TagbarVisibilityPrivate '" . s:pattern . "'"
unlet s:pattern