Use standard highlight group if syntax is disabled

This prevents an error message about a non-existent highlighting group
when trying to match the tag pattern.
This commit is contained in:
Jan Larres 2013-11-02 21:51:15 +13:00
parent fd79a17189
commit 2e2ba2eab2

View File

@ -2891,7 +2891,12 @@ function! s:HighlightTag(openfolds, ...) abort
let foldpat = '[' . s:icon_open . s:icon_closed . ' ]'
let pattern = '/^\%' . tagline . 'l\s*' . foldpat . '[-+# ]\zs[^( ]\+\ze/'
call s:LogDebugMessage("Highlight pattern: '" . pattern . "'")
execute 'match TagbarHighlight ' . pattern
if exists('g:syntax_on') " Safeguard in case syntax highlighting is disabled
execute 'match TagbarHighlight ' . pattern
else
execute 'match Search ' . pattern
endif
if a:0 <= 1 " no line explicitly given, so assume we were in the file window
call s:winexec(prevwinnr . 'wincmd w')