Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Showing with 33 additions and 3 deletions.
  1. +24 −0
  2. +9 −3 autoload.vim
@@ -166,6 +166,28 @@ Every time the plug-in executes it will time how long the execution takes and
add the results to Vim's message history, which you can view by executing the
[:messages][messages] command.
+### Failed to highlight tags because pattern is too big!
+If the `easytags.vim` plug-in fails to highlight your tags and the error
+message mentions that the pattern is too big, your tags file has grown too
+large for Vim to be able to highlight all tagged identifiers! I've had this
+happen to me with 50 KB patterns because I added most of the headers in
+`/usr/include/` to my tags file. Internally Vim raises the error [E339: Pattern
+too long] [E339] and unfortunately the only way to avoid this problem once it
+occurs is to reduce the number of tagged identifiers...
+In my case the solution was to move most of the tags from `/usr/include/` over
+to project specific tags files which are automatically loaded by Vim when I
+edit files in different projects because I've set the ['tags' option]
+[tags_option] as follows:
+ :set tags=./.tags;,~/.vimtags
+Once you've executed the above command, Vim will automatically look for a file
+named `.tags` in the directory of the current file. Because of the `;` Vim also
+recurses upwards so that you can nest files arbitrarily deep under your project
## Contact
If you have questions, bug reports, suggestions, etc. the author can be
@@ -185,6 +207,7 @@ This software is licensed under the [MIT license] [mit_license].
@@ -195,6 +218,7 @@ This software is licensed under the [MIT license] [mit_license].
12 autoload.vim
@@ -1,6 +1,6 @@
" Vim script
" Maintainer: Peter Odding <>
-" Last Change: June 16, 2010
+" Last Change: July 10, 2010
" URL:
let s:script = expand('<sfile>:p:~')
@@ -114,8 +114,14 @@ function! easytags#highlight_cmd() " {{{2
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, '/'))
+ let template = 'syntax match %s /%s/ containedin=ALLBUT,.*String.*,.*Comment.*'
+ let command = printf(template, hlgroup_tagged, escape(pattern, '/'))
+ try
+ execute command
+ catch /^Vim\%((\a\+)\)\=:E339/
+ let msg = "easytags.vim: Failed to highlight %i %s tags because pattern is too big! (%i KB)"
+ call xolox#warning(printf(msg, len(matches), tagkind.hlgroup, len(pattern) / 1024))
+ endtry

0 comments on commit 92cd87d

Please sign in to comment.
Something went wrong with that request. Please try again.