From d4a08c33e516314f35c541b34fe7f909c2ff4381 Mon Sep 17 00:00:00 2001 From: Jan Larres Date: Tue, 12 Sep 2017 13:30:22 +1200 Subject: [PATCH] Add byte limit for look-behind pattern The TagbarKind syntax match pattern has a zero-width look-behind atom with unlimited length. This can slow down syntax highlighting. Since in this case there can only be 1 or 2 characters that get matched, we can set a limit for the match, thus speeding up the matching. Since the limit unfortunately works with bytes instead of characters, use 3 instead of 2 to account for double-width folding characters. --- syntax/tagbar.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/syntax/tagbar.vim b/syntax/tagbar.vim index ef7686e..5d67393 100644 --- a/syntax/tagbar.vim +++ b/syntax/tagbar.vim @@ -12,7 +12,8 @@ if exists("b:current_syntax") endif let s:ics = escape(join(g:tagbar_iconchars, ''), ']^\-') -let s:pattern = '\(^[' . s:ics . '] \?\)\@<=[^-+: ]\+[^:]\+$' + +let s:pattern = '\(^[' . s:ics . '] \?\)\@3<=[^-+: ]\+[^:]\+$' execute "syntax match TagbarKind '" . s:pattern . "'" let s:pattern = '\(\S\@