Skip to content

Commit 100bd8d

Browse files
committed
New g:easytags_updatetime_autodisable option (issue #17, reported by Strahinja Marković)
1 parent fae8ddd commit 100bd8d

3 files changed

Lines changed: 66 additions & 20 deletions

File tree

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,14 @@ As I explained above the plug-in by default doesn't update or highlight your tag
103103

104104
Note: Like the `g:easytags_always_enabled` option, if you change this option it won't apply until you restart Vim, so you'll have to set this option in your [vimrc script] [vimrc].
105105

106+
### The `g:easytags_updatetime_min` option
107+
108+
Vim has a setting which influences how often the plug-in is automatically executed. When this setting is too low, the plug-in can break. For this reason the plug-in warns you when ['updatetime'][updatetime] is lower than 4000 milliseconds. If you really want the plug-in to be executed more than once every 4 seconds (without a warning) you can lower the minimum acceptable updatetime by setting this option (number of milliseconds).
109+
110+
### The `g:easytags_updatetime_autodisable` option
111+
112+
Other plug-ins may lower the ['updatetime'][updatetime] value in certain contexts, e.g. insert mode in the case of the [neocomplcache][neocomplcache] plug-in. By setting this option to 1 (true) you can configure the easytags plug-in so that it doesn't give warnings about the updatetime option but instead skip updating and highlighting while the updatetime is set too low. When the updatetime is restored to a reasonable value the plug-in resumes.
113+
106114
### The `g:easytags_auto_update` option
107115

108116
By default the plug-in automatically updates and highlights your tags when you stop typing for a moment. If you want to disable automatic updating while keeping automatic highlighting enabled you can set this option to false:
@@ -264,13 +272,15 @@ This software is licensed under the [MIT license](http://en.wikipedia.org/wiki/M
264272
[hlinks]: http://en.wikipedia.org/wiki/Hard_link
265273
[ide]: http://en.wikipedia.org/wiki/Integrated_development_environment
266274
[messages]: http://vimdoc.sourceforge.net/htmldoc/message.html#:messages
275+
[neocomplcache]: http://www.vim.org/scripts/script.php?script_id=2620
267276
[shell]: http://peterodding.com/code/vim/shell/
268277
[slinks]: http://en.wikipedia.org/wiki/Symbolic_link
269278
[syn_groups]: http://vimdoc.sourceforge.net/htmldoc/syntax.html#group-name
270279
[system]: http://vimdoc.sourceforge.net/htmldoc/eval.html#system%28%29
271280
[tagfiles_fun]: http://vimdoc.sourceforge.net/htmldoc/eval.html#tagfiles%28%29
272281
[tags_opt]: http://vimdoc.sourceforge.net/htmldoc/options.html#%27tags%27
273282
[unlet]: http://vimdoc.sourceforge.net/htmldoc/eval.html#:unlet
283+
[updatetime]: http://vimdoc.sourceforge.net/htmldoc/options.html#'updatetime'
274284
[vim]: http://www.vim.org/
275285
[vim_fts]: http://ftp.vim.org/vim/runtime/syntax/
276286
[vim_online]: http://www.vim.org/scripts/script.php?script_id=3114

autoload/xolox/easytags.vim

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
" Vim script
22
" Author: Peter Odding <peter@peterodding.com>
3-
" Last Change: September 5, 2011
3+
" Last Change: September 17, 2011
44
" URL: http://peterodding.com/code/vim/easytags/
55

6-
let g:xolox#easytags#version = '2.5.7'
6+
let g:xolox#easytags#version = '2.5.8'
77

88
" Public interface through (automatic) commands. {{{1
99

@@ -36,9 +36,24 @@ endfunction
3636

3737
function! xolox#easytags#autoload(event) " {{{2
3838
try
39-
" Check for unreasonable &updatetime values.
40-
if a:event =~? 'cursorhold' && &updatetime < 4000
41-
call xolox#misc#msg#warn("easytags.vim %s: I'm being executed every %i milliseconds! Please set the 'updatetime' option to >= 4000 (4 seconds). To find where 'updatetime' was changed execute ':verbose set updatetime?'", g:xolox#easytags#version, &updatetime)
39+
if a:event =~? 'cursorhold'
40+
" Only for the CursorHold automatic command: check for unreasonable
41+
" &updatetime values. The minimum value 4000 is kind of arbitrary
42+
" (apart from being Vim's default) so I made it configurable:
43+
let updatetime_min = xolox#misc#option#get('easytags_updatetime_min', 4000)
44+
if &updatetime < updatetime_min
45+
" Other plug-ins may lower &updatetime in certain contexts, e.g.
46+
" insert mode in the case of the neocomplcache plug-in. The following
47+
" option (disabled by default unless neocomplcache is loaded) silences
48+
" the warning and makes the easytags plug-in skip the update and
49+
" highlight. When the &updatetime is restored to a reasonable value
50+
" the plug-in resumes.
51+
if xolox#misc#option#get('easytags_updatetime_autodisable', exists('g:loaded_neocomplcache'))
52+
return
53+
else
54+
call xolox#misc#msg#warn("easytags.vim %s: I'm being executed every %i milliseconds! Please :set updatetime=%i. To find where 'updatetime' was changed execute ':verb set ut?'", g:xolox#easytags#version, &updatetime, updatetime_min)
55+
endif
56+
endif
4257
endif
4358
let do_update = xolox#misc#option#get('easytags_auto_update', 1)
4459
let do_highlight = xolox#misc#option#get('easytags_auto_highlight', 1) && &eventignore !~? '\<syntax\>'

doc/easytags.txt

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,26 @@ Note: Like the |g:easytags_always_enabled| option, if you change this option
214214
it won't apply until you restart Vim, so you'll have to set this option in
215215
your |vimrc| script.
216216

217+
-------------------------------------------------------------------------------
218+
The *g:easytags_updatetime_min* option
219+
220+
Vim has a setting which influences how often the plug-in is automatically
221+
executed. When this setting is too low, the plug-in can break. For this reason
222+
the plug-in warns you when |'updatetime'| is lower than 4000 milliseconds. If
223+
you really want the plug-in to be executed more than once every 4 seconds
224+
(without a warning) you can lower the minimum acceptable updatetime by setting
225+
this option (number of milliseconds).
226+
227+
-------------------------------------------------------------------------------
228+
The *g:easytags_updatetime_autodisable* option
229+
230+
Other plug-ins may lower the |'updatetime'| value in certain contexts, e.g.
231+
insert mode in the case of the neocomplcache [9] plug-in. By setting this
232+
option to 1 (true) you can configure the easytags plug-in so that it doesn't
233+
give warnings about the updatetime option but instead skip updating and
234+
highlighting while the updatetime is set too low. When the updatetime is
235+
restored to a reasonable value the plug-in resumes.
236+
217237
-------------------------------------------------------------------------------
218238
The *g:easytags_auto_update* option
219239

@@ -280,14 +300,14 @@ your vimrc script, a file type plug-in, etc.):
280300
-------------------------------------------------------------------------------
281301
The *g:easytags_resolve_links* option
282302

283-
UNIX has symbolic links [9] and hard links [10], both of which conflict with
303+
UNIX has symbolic links [10] and hard links [11], both of which conflict with
284304
the concept of having one unique location for every identifier. With regards
285305
to hard links there's not much anyone can do, but because I use symbolic links
286306
quite a lot I've added this option. It's disabled by default since it has a
287307
small performance impact and might not do what unknowing users expect it to:
288308
When you enable this option the plug-in will resolve symbolic links in
289309
pathnames, which means your tags file will only contain entries with canonical
290-
pathnames [11]. To enable this option (which I strongly suggest doing when you
310+
pathnames [12]. To enable this option (which I strongly suggest doing when you
291311
run UNIX and use symbolic links) execute the following Vim command:
292312
>
293313
:let g:easytags_resolve_links = 1
@@ -358,11 +378,11 @@ modes (except of course for the 'Tag' suffix).
358378
Passing custom command line arguments to Exuberant Ctags ~
359379

360380
You may want to run Exuberant Ctags with specific command line options, for
361-
example the code_complete [12] plug-in requires the signature field to be
381+
example the code_complete [13] plug-in requires the signature field to be
362382
present. To do this you can create a configuration file for Exuberant Ctags,
363383
e.g. '~/.ctags' on UNIX or '%USERPROFILE%\ctags.cnf' on Windows. The file
364384
should contain one command line option per line. See the Exuberant Ctags
365-
manual [13] for details.
385+
manual [14] for details.
366386

367387
===============================================================================
368388
*easytags-troubleshooting*
@@ -462,7 +482,7 @@ project directories.
462482
-------------------------------------------------------------------------------
463483
The plug-in doesn't seem to work in Cygwin ~
464484

465-
If you want to use the plug-in with Vim under Cygwin [14], you need to have
485+
If you want to use the plug-in with Vim under Cygwin [15], you need to have
466486
the Cygwin version of Ctags installed instead of the Windows version (thanks
467487
to Alex Zuroff for reporting this!).
468488

@@ -473,13 +493,13 @@ Contact ~
473493
If you have questions, bug reports, suggestions, etc. the author can be
474494
contacted at peter@peterodding.com. The latest version is available at
475495
http://peterodding.com/code/vim/easytags/ and http://github.com/xolox/vim-easytags.
476-
If you like this plug-in please vote for it on Vim Online [15].
496+
If you like this plug-in please vote for it on Vim Online [16].
477497

478498
===============================================================================
479499
*easytags-license*
480500
License ~
481501

482-
This software is licensed under the MIT license [16]. Copyright 2011 Peter
502+
This software is licensed under the MIT license [17]. Copyright 2011 Peter
483503
Odding <peter@peterodding.com>.
484504

485505
===============================================================================
@@ -494,13 +514,14 @@ References ~
494514
[6] http://peterodding.com/code/vim/downloads/easytags.zip
495515
[7] http://peterodding.com/code/vim/shell/
496516
[8] http://en.wikipedia.org/wiki/Dynamic-link_library
497-
[9] http://en.wikipedia.org/wiki/Symbolic_link
498-
[10] http://en.wikipedia.org/wiki/Hard_link
499-
[11] http://en.wikipedia.org/wiki/Canonicalization
500-
[12] http://www.vim.org/scripts/script.php?script_id=1764
501-
[13] http://ctags.sourceforge.net/ctags.html#FILES
502-
[14] http://en.wikipedia.org/wiki/Cygwin
503-
[15] http://www.vim.org/scripts/script.php?script_id=3114
504-
[16] http://en.wikipedia.org/wiki/MIT_License
517+
[9] http://www.vim.org/scripts/script.php?script_id=2620
518+
[10] http://en.wikipedia.org/wiki/Symbolic_link
519+
[11] http://en.wikipedia.org/wiki/Hard_link
520+
[12] http://en.wikipedia.org/wiki/Canonicalization
521+
[13] http://www.vim.org/scripts/script.php?script_id=1764
522+
[14] http://ctags.sourceforge.net/ctags.html#FILES
523+
[15] http://en.wikipedia.org/wiki/Cygwin
524+
[16] http://www.vim.org/scripts/script.php?script_id=3114
525+
[17] http://en.wikipedia.org/wiki/MIT_License
505526

506527
vim: ft=help

0 commit comments

Comments
 (0)