Skip to content

Commit

Permalink
Add g:easytags_updatetime_warn option, improve documentation (issue #47)
Browse files Browse the repository at this point in the history
Issue #47 on GitHub:
  #47
  • Loading branch information
xolox committed May 19, 2013
1 parent bff179d commit 384ebf4
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 23 deletions.
17 changes: 15 additions & 2 deletions README.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -125,9 +125,21 @@ Note: Like the `g:easytags_always_enabled` option, if you change this option it


### The `g:easytags_updatetime_min` option ### 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 compensates by keeping track of when it was last executed. You'll get one warning when the plug-in first notices the low value, after that it will shut up. The default value of this option is 4000 milliseconds (4 seconds). Vim's ['updatetime'] [updatetime] option controls how often the easytags plug-in is automatically executed. A lot of popular Vim plug-ins manipulate this option to control how often they are called. Unfortunately some of those plug-ins set ['updatetime'] [updatetime] to a very low value (less than a second) and this can break the easytags plug-in.


If you really want the plug-in to be executed more than once every 4 seconds you can lower the minimum acceptable updatetime by setting this option (as the number of milliseconds) however note that subsecond granularity is not supported. Because of this the easytags plug-in compensates by keeping track of when it was last executed. You'll get one warning when the plug-in first notices a very low value of ['updatetime'] [updatetime], after that the plug-in will shut up (until you restart Vim) and simply compensate by not executing until its time has come. If you want to silence the warning message forever, see the `g:easytags_updatetime_warn` option.

The default value of Vim's ['updatetime] [updatetime] option *and* the `g:easytags_updatetime_min` option is 4000 milliseconds (4 seconds).

If you know what you're doing and you really want the easytags plug-in to be executed more than once every 4 seconds you can lower the minimum acceptable updatetime by setting `g:easytags_updatetime_min` to the number of milliseconds (an integer).

Note that although `g:easytags_updatetime_min` counts in milliseconds, the easytags plug-in does not support subsecond granularity because it is limited by Vim's [localtime()] [localtime] function which has one-second resolution.

### The `g:easytags_updatetime_warn` option

Since the easytags plug-in now compensates for low ['updatetime'] [updatetime] values (see the `g:easytags_updatetime_min` option above) the warning message shown by the easytags plug-in has become kind of redundant (and probably annoying?). For now it can be completely disabled by setting `g:easytags_updatetime_warn` to 0 (false).

When the feature that compensates for low ['updatetime'] [updatetime] values has proven to be a reliable workaround I will probably remove the warning message and the `g:easytags_updatetime_warn` option.


### The `g:easytags_auto_update` option ### The `g:easytags_auto_update` option


Expand Down Expand Up @@ -297,6 +309,7 @@ This software is licensed under the [MIT license](http://en.wikipedia.org/wiki/M
[hlinks]: http://en.wikipedia.org/wiki/Hard_link [hlinks]: http://en.wikipedia.org/wiki/Hard_link
[ide]: http://en.wikipedia.org/wiki/Integrated_development_environment [ide]: http://en.wikipedia.org/wiki/Integrated_development_environment
[jsctags]: https://npmjs.org/package/jsctags [jsctags]: https://npmjs.org/package/jsctags
[localtime]: http://vimdoc.sourceforge.net/htmldoc/eval.html#localtime()
[messages]: http://vimdoc.sourceforge.net/htmldoc/message.html#:messages [messages]: http://vimdoc.sourceforge.net/htmldoc/message.html#:messages
[neocomplcache]: http://www.vim.org/scripts/script.php?script_id=2620 [neocomplcache]: http://www.vim.org/scripts/script.php?script_id=2620
[shell]: http://peterodding.com/code/vim/shell/ [shell]: http://peterodding.com/code/vim/shell/
Expand Down
8 changes: 5 additions & 3 deletions autoload/xolox/easytags.vim
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
" Last Change: May 19, 2013 " Last Change: May 19, 2013
" URL: http://peterodding.com/code/vim/easytags/ " URL: http://peterodding.com/code/vim/easytags/


let g:xolox#easytags#version = '3.3.1' let g:xolox#easytags#version = '3.3.2'


call xolox#misc#compat#check('easytags', 3) call xolox#misc#compat#check('easytags', 3)


Expand Down Expand Up @@ -53,8 +53,10 @@ function! xolox#easytags#autoload(event) " {{{2
let updatetime_min = xolox#misc#option#get('easytags_updatetime_min', 4000) let updatetime_min = xolox#misc#option#get('easytags_updatetime_min', 4000)
if &updatetime < updatetime_min if &updatetime < updatetime_min
if s:last_automatic_run == 0 if s:last_automatic_run == 0
" Warn once about the low &updatetime value. " Warn once about the low &updatetime value?
call xolox#misc#msg#warn("easytags.vim %s: The 'updatetime' option has an unreasonably low value, so I'll start compensating (see the easytags_updatetime_min option).", g:xolox#easytags#version) if xolox#misc#option#get('easytags_updatetime_warn', 1)
call xolox#misc#msg#warn("easytags.vim %s: The 'updatetime' option has an unreasonably low value, so I'll start compensating (see the easytags_updatetime_min option).", g:xolox#easytags#version)
endif
let s:last_automatic_run = localtime() let s:last_automatic_run = localtime()
else else
let next_scheduled_run = s:last_automatic_run + max([1, updatetime_min / 1000]) let next_scheduled_run = s:last_automatic_run + max([1, updatetime_min / 1000])
Expand Down
63 changes: 45 additions & 18 deletions doc/easytags.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ Contents ~
6. The |g:easytags_always_enabled| option 6. The |g:easytags_always_enabled| option
7. The |g:easytags_on_cursorhold| option 7. The |g:easytags_on_cursorhold| option
8. The |g:easytags_updatetime_min| option 8. The |g:easytags_updatetime_min| option
9. The |g:easytags_auto_update| option 9. The |g:easytags_updatetime_warn| option
10. The |g:easytags_auto_highlight| option 10. The |g:easytags_auto_update| option
11. The |g:easytags_autorecurse| option 11. The |g:easytags_auto_highlight| option
12. The |g:easytags_include_members| option 12. The |g:easytags_autorecurse| option
13. The |g:easytags_resolve_links| option 13. The |g:easytags_include_members| option
14. The |g:easytags_suppress_ctags_warning| option 14. The |g:easytags_resolve_links| option
15. The |g:easytags_ignored_syntax_groups| option 15. The |g:easytags_suppress_ctags_warning| option
16. The |g:easytags_ignored_syntax_groups| option
5. Faster syntax highlighting using Python |easytags-faster-syntax-highlighting-using-python| 5. Faster syntax highlighting using Python |easytags-faster-syntax-highlighting-using-python|
1. The |g:easytags_python_enabled| option 1. The |g:easytags_python_enabled| option
2. The |g:easytags_python_script| option 2. The |g:easytags_python_script| option
Expand Down Expand Up @@ -291,17 +292,43 @@ your |vimrc| script.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
The *g:easytags_updatetime_min* option The *g:easytags_updatetime_min* option


Vim has a setting which influences how often the plug-in is automatically Vim's |'updatetime'| option controls how often the easytags plug-in is
executed. When this setting is too low, the plug-in can break. For this reason automatically executed. A lot of popular Vim plug-ins manipulate this option
the plug-in compensates by keeping track of when it was last executed. You'll to control how often they are called. Unfortunately some of those plug-ins set
get one warning when the plug-in first notices the low value, after that it |'updatetime'| to a very low value (less than a second) and this can break the
will shut up. The default value of this option is 4000 milliseconds (4 easytags plug-in.
seconds).

Because of this the easytags plug-in compensates by keeping track of when it
If you really want the plug-in to be executed more than once every 4 seconds was last executed. You'll get one warning when the plug-in first notices a
you can lower the minimum acceptable updatetime by setting this option (as the very low value of |'updatetime'|, after that the plug-in will shut up (until you
number of milliseconds) however note that subsecond granularity is not restart Vim) and simply compensate by not executing until its time has come.
supported. If you want to silence the warning message forever, see the |g:easytags_updatetime_warn|
option.

The default value of Vim's 'updatetime (see |'updatetime'|) option and the
|g:easytags_updatetime_min| option is 4000 milliseconds (4 seconds).

If you know what you're doing and you really want the easytags plug-in to be
executed more than once every 4 seconds you can lower the minimum acceptable
updatetime by setting |g:easytags_updatetime_min| to the number of
milliseconds (an integer).

Note that although |g:easytags_updatetime_min| counts in milliseconds, the
easytags plug-in does not support subsecond granularity because it is limited
by Vim's |localtime()| function which has one-second resolution.

-------------------------------------------------------------------------------
The *g:easytags_updatetime_warn* option

Since the easytags plug-in now compensates for low |'updatetime'| values (see
the |g:easytags_updatetime_min| option above) the warning message shown by the
easytags plug-in has become kind of redundant (and probably annoying?). For
now it can be completely disabled by setting |g:easytags_updatetime_warn| to 0
(false).

When the feature that compensates for low |'updatetime'| values has proven to be
a reliable workaround I will probably remove the warning message and the
|g:easytags_updatetime_warn| option.


------------------------------------------------------------------------------- -------------------------------------------------------------------------------
The *g:easytags_auto_update* option The *g:easytags_auto_update* option
Expand Down

0 comments on commit 384ebf4

Please sign in to comment.