diff options
author | Peter Odding <peter@peterodding.com> | 2011-09-17 17:47:01 +0200 |
---|---|---|
committer | Peter Odding <peter@peterodding.com> | 2011-09-17 17:47:01 +0200 |
commit | 100bd8df876c589c956a08a76fa4fd9eac96af2d (patch) | |
tree | 1aa9601ef9cec8568444b6ddd7513f61af86657a | |
parent | fae8ddd3b6cdf823113ed2a911daa7d319885f7a (diff) | |
download | vim-easytags-100bd8df876c589c956a08a76fa4fd9eac96af2d.tar.gz |
New g:easytags_updatetime_autodisable option (issue #17, reported by Strahinja Marković)
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | autoload/xolox/easytags.vim | 25 | ||||
-rw-r--r-- | doc/easytags.txt | 51 |
3 files changed, 66 insertions, 20 deletions
@@ -103,6 +103,14 @@ As I explained above the plug-in by default doesn't update or highlight your tag 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]. +### The `g:easytags_updatetime_min` option + +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). + +### The `g:easytags_updatetime_autodisable` option + +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. + ### The `g:easytags_auto_update` option 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,6 +272,7 @@ This software is licensed under the [MIT license](http://en.wikipedia.org/wiki/M [hlinks]: http://en.wikipedia.org/wiki/Hard_link [ide]: http://en.wikipedia.org/wiki/Integrated_development_environment [messages]: http://vimdoc.sourceforge.net/htmldoc/message.html#:messages +[neocomplcache]: http://www.vim.org/scripts/script.php?script_id=2620 [shell]: http://peterodding.com/code/vim/shell/ [slinks]: http://en.wikipedia.org/wiki/Symbolic_link [syn_groups]: http://vimdoc.sourceforge.net/htmldoc/syntax.html#group-name @@ -271,6 +280,7 @@ This software is licensed under the [MIT license](http://en.wikipedia.org/wiki/M [tagfiles_fun]: http://vimdoc.sourceforge.net/htmldoc/eval.html#tagfiles%28%29 [tags_opt]: http://vimdoc.sourceforge.net/htmldoc/options.html#%27tags%27 [unlet]: http://vimdoc.sourceforge.net/htmldoc/eval.html#:unlet +[updatetime]: http://vimdoc.sourceforge.net/htmldoc/options.html#'updatetime' [vim]: http://www.vim.org/ [vim_fts]: http://ftp.vim.org/vim/runtime/syntax/ [vim_online]: http://www.vim.org/scripts/script.php?script_id=3114 diff --git a/autoload/xolox/easytags.vim b/autoload/xolox/easytags.vim index 39102e2..63d411a 100644 --- a/autoload/xolox/easytags.vim +++ b/autoload/xolox/easytags.vim @@ -1,9 +1,9 @@ " Vim script " Author: Peter Odding <peter@peterodding.com> -" Last Change: September 5, 2011 +" Last Change: September 17, 2011 " URL: http://peterodding.com/code/vim/easytags/ -let g:xolox#easytags#version = '2.5.7' +let g:xolox#easytags#version = '2.5.8' " Public interface through (automatic) commands. {{{1 @@ -36,9 +36,24 @@ endfunction function! xolox#easytags#autoload(event) " {{{2 try - " Check for unreasonable &updatetime values. - if a:event =~? 'cursorhold' && &updatetime < 4000 - 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) + if a:event =~? 'cursorhold' + " Only for the CursorHold automatic command: check for unreasonable + " &updatetime values. The minimum value 4000 is kind of arbitrary + " (apart from being Vim's default) so I made it configurable: + let updatetime_min = xolox#misc#option#get('easytags_updatetime_min', 4000) + if &updatetime < updatetime_min + " Other plug-ins may lower &updatetime in certain contexts, e.g. + " insert mode in the case of the neocomplcache plug-in. The following + " option (disabled by default unless neocomplcache is loaded) silences + " the warning and makes the easytags plug-in skip the update and + " highlight. When the &updatetime is restored to a reasonable value + " the plug-in resumes. + if xolox#misc#option#get('easytags_updatetime_autodisable', exists('g:loaded_neocomplcache')) + return + else + 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) + endif + endif endif let do_update = xolox#misc#option#get('easytags_auto_update', 1) let do_highlight = xolox#misc#option#get('easytags_auto_highlight', 1) && &eventignore !~? '\<syntax\>' diff --git a/doc/easytags.txt b/doc/easytags.txt index 0ffb508..1b9e78c 100644 --- a/doc/easytags.txt +++ b/doc/easytags.txt @@ -215,6 +215,26 @@ it won't apply until you restart Vim, so you'll have to set this option in your |vimrc| script. ------------------------------------------------------------------------------- +The *g:easytags_updatetime_min* option + +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'| 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). + +------------------------------------------------------------------------------- +The *g:easytags_updatetime_autodisable* option + +Other plug-ins may lower the |'updatetime'| value in certain contexts, e.g. +insert mode in the case of the neocomplcache [9] 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. + +------------------------------------------------------------------------------- The *g:easytags_auto_update* option By default the plug-in automatically updates and highlights your tags when you @@ -280,14 +300,14 @@ your vimrc script, a file type plug-in, etc.): ------------------------------------------------------------------------------- The *g:easytags_resolve_links* option -UNIX has symbolic links [9] and hard links [10], both of which conflict with +UNIX has symbolic links [10] and hard links [11], both of which conflict with the concept of having one unique location for every identifier. With regards to hard links there's not much anyone can do, but because I use symbolic links quite a lot I've added this option. It's disabled by default since it has a small performance impact and might not do what unknowing users expect it to: When you enable this option the plug-in will resolve symbolic links in pathnames, which means your tags file will only contain entries with canonical -pathnames [11]. To enable this option (which I strongly suggest doing when you +pathnames [12]. To enable this option (which I strongly suggest doing when you run UNIX and use symbolic links) execute the following Vim command: > :let g:easytags_resolve_links = 1 @@ -358,11 +378,11 @@ modes (except of course for the 'Tag' suffix). Passing custom command line arguments to Exuberant Ctags ~ You may want to run Exuberant Ctags with specific command line options, for -example the code_complete [12] plug-in requires the signature field to be +example the code_complete [13] plug-in requires the signature field to be present. To do this you can create a configuration file for Exuberant Ctags, e.g. '~/.ctags' on UNIX or '%USERPROFILE%\ctags.cnf' on Windows. The file should contain one command line option per line. See the Exuberant Ctags -manual [13] for details. +manual [14] for details. =============================================================================== *easytags-troubleshooting* @@ -462,7 +482,7 @@ project directories. ------------------------------------------------------------------------------- The plug-in doesn't seem to work in Cygwin ~ -If you want to use the plug-in with Vim under Cygwin [14], you need to have +If you want to use the plug-in with Vim under Cygwin [15], you need to have the Cygwin version of Ctags installed instead of the Windows version (thanks to Alex Zuroff for reporting this!). @@ -473,13 +493,13 @@ Contact ~ If you have questions, bug reports, suggestions, etc. the author can be contacted at peter@peterodding.com. The latest version is available at http://peterodding.com/code/vim/easytags/ and http://github.com/xolox/vim-easytags. -If you like this plug-in please vote for it on Vim Online [15]. +If you like this plug-in please vote for it on Vim Online [16]. =============================================================================== *easytags-license* License ~ -This software is licensed under the MIT license [16]. Copyright 2011 Peter +This software is licensed under the MIT license [17]. Copyright 2011 Peter Odding <peter@peterodding.com>. =============================================================================== @@ -494,13 +514,14 @@ References ~ [6] http://peterodding.com/code/vim/downloads/easytags.zip [7] http://peterodding.com/code/vim/shell/ [8] http://en.wikipedia.org/wiki/Dynamic-link_library -[9] http://en.wikipedia.org/wiki/Symbolic_link -[10] http://en.wikipedia.org/wiki/Hard_link -[11] http://en.wikipedia.org/wiki/Canonicalization -[12] http://www.vim.org/scripts/script.php?script_id=1764 -[13] http://ctags.sourceforge.net/ctags.html#FILES -[14] http://en.wikipedia.org/wiki/Cygwin -[15] http://www.vim.org/scripts/script.php?script_id=3114 -[16] http://en.wikipedia.org/wiki/MIT_License +[9] http://www.vim.org/scripts/script.php?script_id=2620 +[10] http://en.wikipedia.org/wiki/Symbolic_link +[11] http://en.wikipedia.org/wiki/Hard_link +[12] http://en.wikipedia.org/wiki/Canonicalization +[13] http://www.vim.org/scripts/script.php?script_id=1764 +[14] http://ctags.sourceforge.net/ctags.html#FILES +[15] http://en.wikipedia.org/wiki/Cygwin +[16] http://www.vim.org/scripts/script.php?script_id=3114 +[17] http://en.wikipedia.org/wiki/MIT_License vim: ft=help |