|
1 | 1 | " Vim script |
2 | 2 | " Author: Peter Odding <peter@peterodding.com> |
3 | | -" Last Change: May 13, 2013 |
| 3 | +" Last Change: May 19, 2013 |
4 | 4 | " URL: http://peterodding.com/code/vim/easytags/ |
5 | 5 |
|
6 | | -let g:xolox#easytags#version = '3.3' |
| 6 | +let g:xolox#easytags#version = '3.3.1' |
7 | 7 |
|
8 | 8 | call xolox#misc#compat#check('easytags', 3) |
9 | 9 |
|
@@ -41,34 +41,35 @@ let s:last_automatic_run = 0 |
41 | 41 |
|
42 | 42 | function! xolox#easytags#autoload(event) " {{{2 |
43 | 43 | try |
44 | | - if a:event =~? 'cursorhold' |
45 | | - " Only for the CursorHold automatic command: check for unreasonable |
46 | | - " &updatetime values. The minimum value 4000 is kind of arbitrary |
47 | | - " (apart from being Vim's default) so I made it configurable. |
48 | | - let updatetime_min = xolox#misc#option#get('easytags_updatetime_min', 4000) |
49 | | - if &updatetime < updatetime_min |
50 | | - if s:last_automatic_run == 0 |
51 | | - " Warn once about the low &updatetime value. |
52 | | - 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) |
53 | | - let s:last_automatic_run = localtime() |
54 | | - else |
55 | | - let next_scheduled_run = s:last_automatic_run + max([1, updatetime_min / 1000]) |
56 | | - if localtime() < next_scheduled_run |
57 | | - " It's not our time yet; wait for the next event. |
58 | | - call xolox#misc#msg#debug("easytags.vim %s: Skipping this beat of 'updatetime' to compensate for low value.", g:xolox#easytags#version) |
59 | | - return |
60 | | - else |
61 | | - call xolox#misc#msg#debug("easytags.vim %s: This is our beat of 'updatetime'!", g:xolox#easytags#version) |
62 | | - let s:last_automatic_run = localtime() |
63 | | - endif |
64 | | - endif |
65 | | - endif |
66 | | - endif |
67 | 44 | let do_update = xolox#misc#option#get('easytags_auto_update', 1) |
68 | 45 | let do_highlight = xolox#misc#option#get('easytags_auto_highlight', 1) && &eventignore !~? '\<syntax\>' |
69 | 46 | " Don't execute this function for unsupported file types (doesn't load |
70 | 47 | " the list of file types if updates and highlighting are both disabled). |
71 | 48 | if (do_update || do_highlight) && !empty(xolox#easytags#select_supported_filetypes(&ft)) |
| 49 | + if a:event =~? 'cursorhold' |
| 50 | + " Only for the CursorHold automatic command: check for unreasonable |
| 51 | + " &updatetime values. The minimum value 4000 is kind of arbitrary |
| 52 | + " (apart from being Vim's default) so I made it configurable. |
| 53 | + let updatetime_min = xolox#misc#option#get('easytags_updatetime_min', 4000) |
| 54 | + if &updatetime < updatetime_min |
| 55 | + if s:last_automatic_run == 0 |
| 56 | + " Warn once about the low &updatetime value. |
| 57 | + 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) |
| 58 | + let s:last_automatic_run = localtime() |
| 59 | + else |
| 60 | + let next_scheduled_run = s:last_automatic_run + max([1, updatetime_min / 1000]) |
| 61 | + if localtime() < next_scheduled_run |
| 62 | + " It's not our time yet; wait for the next event. |
| 63 | + call xolox#misc#msg#debug("easytags.vim %s: Skipping this beat of 'updatetime' to compensate for low value.", g:xolox#easytags#version) |
| 64 | + " Shortcut to break out of xolox#easytags#autoload(). |
| 65 | + return |
| 66 | + else |
| 67 | + call xolox#misc#msg#debug("easytags.vim %s: This is our beat of 'updatetime'!", g:xolox#easytags#version) |
| 68 | + let s:last_automatic_run = localtime() |
| 69 | + endif |
| 70 | + endif |
| 71 | + endif |
| 72 | + endif |
72 | 73 | " Update entries for current file in tags file? |
73 | 74 | if do_update |
74 | 75 | let pathname = s:resolve(expand('%:p')) |
|
0 commit comments