From d227685a4110e5f3f11cd1b49118172f528a52d7 Mon Sep 17 00:00:00 2001 From: Peter Odding Date: Thu, 10 Jun 2010 21:30:55 +0200 Subject: Make sure there's something to highlight before doing so --- autoload.vim | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/autoload.vim b/autoload.vim index 67377b2..8ed840e 100644 --- a/autoload.vim +++ b/autoload.vim @@ -114,10 +114,12 @@ function! easytags#highlight_cmd() " {{{1 execute 'highlight def link' hlgroup_tagged tagkind.hlgroup endif let matches = filter(copy(taglist), tagkind.filter) - call map(matches, 'xolox#escape#pattern(get(v:val, "name"))') - let pattern = tagkind.pattern_prefix . '\%(' . join(xolox#unique(matches), '\|') . '\)' . tagkind.pattern_suffix - let command = 'syntax match %s /%s/ containedin=ALLBUT,.*String.*,.*Comment.*' - execute printf(command, hlgroup_tagged, escape(pattern, '/')) + if matches != [] + call map(matches, 'xolox#escape#pattern(get(v:val, "name"))') + let pattern = tagkind.pattern_prefix . '\%(' . join(xolox#unique(matches), '\|') . '\)' . tagkind.pattern_suffix + let command = 'syntax match %s /%s/ containedin=ALLBUT,.*String.*,.*Comment.*' + execute printf(command, hlgroup_tagged, escape(pattern, '/')) + endif endfor redraw call xolox#timer#stop(start, "easytags.vim: Highlighted tags in %s second(s)") -- cgit v1.2.3