diff options
author | Peter Odding <peter@peterodding.com> | 2010-06-10 21:30:55 +0200 |
---|---|---|
committer | Peter Odding <peter@peterodding.com> | 2010-06-10 21:30:55 +0200 |
commit | d227685a4110e5f3f11cd1b49118172f528a52d7 (patch) | |
tree | dddc766bd458b2466e1412d30ee91aebd35dfc61 | |
parent | 61b99f078557d65331e72de60d145e16b8bbb88e (diff) | |
download | vim-easytags-d227685a4110e5f3f11cd1b49118172f528a52d7.tar.gz |
Make sure there's something to highlight before doing so
-rw-r--r-- | autoload.vim | 10 |
1 files 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)") |