mirror of
https://github.com/preservim/tagbar.git
synced 2025-02-07 21:02:02 +08:00
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.
This commit is contained in:
parent
7299257d77
commit
d4a08c33e5
|
@ -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\@<![' . s:ics . '][-+# ]\?\)\@<=[^*(]\+\(\*\?\(([^)]\+)\)\? :\)\@='
|
||||
|
|
Loading…
Reference in New Issue
Block a user