Skip to content

Commit 67616b2

Browse files
committed
Add easytags_auto_update/auto_highlight options
1 parent 4cf1efd commit 67616b2

File tree

4 files changed

+71
-19
lines changed

4 files changed

+71
-19
lines changed

README.md

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

9797
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].
9898

99+
### The `g:easytags_auto_update` option
100+
101+
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:
102+
103+
:let g:easytags_auto_update = 0
104+
105+
If you want to disable automatic updating for a single file you can execute the following command while editing the file:
106+
107+
:let b:easytags_auto_update = 0
108+
109+
### The `g:easytags_auto_highlight` option
110+
111+
By default the plug-in automatically updates and highlights your tags when you stop typing for a moment. If you want to disable automatic highlighting while keeping automatic updating enabled you can set this option to false:
112+
113+
:let g:easytags_auto_highlight = 0
114+
115+
If you want to disable automatic highlighting for a single file you can execute the following command while editing the file:
116+
117+
:let b:easytags_auto_highlight = 0
118+
99119
### The `g:easytags_autorecurse` option
100120

101121
When the `:UpdateTags` command is executed automatically or without arguments, it defaults to updating just the tags for the current file. If you'd rather have it recursively scan everything below the directory of the current file then set this option to true (1):

autoload/xolox/easytags.vim

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

66
" Public interface through (automatic) commands. {{{1
@@ -35,26 +35,30 @@ endfunction
3535
function! xolox#easytags#autoload() " {{{2
3636
try
3737
" Update entries for current file in tags file?
38-
let pathname = s:resolve(expand('%:p'))
39-
if pathname != ''
40-
let tags_outdated = getftime(pathname) > getftime(xolox#easytags#get_tagsfile())
41-
if tags_outdated || !xolox#easytags#file_has_tags(pathname)
42-
call xolox#easytags#update(1, 0, [])
38+
if xolox#misc#option#get('easytags_auto_update', 1)
39+
let pathname = s:resolve(expand('%:p'))
40+
if pathname != ''
41+
let tags_outdated = getftime(pathname) > getftime(xolox#easytags#get_tagsfile())
42+
if tags_outdated || !xolox#easytags#file_has_tags(pathname)
43+
call xolox#easytags#update(1, 0, [])
44+
endif
4345
endif
4446
endif
4547
" Apply highlighting of tags to current buffer?
46-
if &eventignore !~? '\<syntax\>'
47-
if !exists('b:easytags_last_highlighted')
48-
call xolox#easytags#highlight()
49-
else
50-
for tagfile in tagfiles()
51-
if getftime(tagfile) > b:easytags_last_highlighted
52-
call xolox#easytags#highlight()
53-
break
54-
endif
55-
endfor
48+
if xolox#misc#option#get('easytags_auto_highlight', 1)
49+
if &eventignore !~? '\<syntax\>'
50+
if !exists('b:easytags_last_highlighted')
51+
call xolox#easytags#highlight()
52+
else
53+
for tagfile in tagfiles()
54+
if getftime(tagfile) > b:easytags_last_highlighted
55+
call xolox#easytags#highlight()
56+
break
57+
endif
58+
endfor
59+
endif
60+
let b:easytags_last_highlighted = localtime()
5661
endif
57-
let b:easytags_last_highlighted = localtime()
5862
endif
5963
catch
6064
call xolox#misc#msg#warn("easytags.vim %s: %s (at %s)", g:easytags_version, v:exception, v:throwpoint)

doc/easytags.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,34 @@ Note: Like the |g:easytags_always_enabled| option, if you change this option
198198
it won't apply until you restart Vim, so you'll have to set this option in
199199
your |vimrc| script.
200200

201+
-------------------------------------------------------------------------------
202+
The *g:easytags_auto_update* option
203+
204+
By default the plug-in automatically updates and highlights your tags when you
205+
stop typing for a moment. If you want to disable automatic updating while
206+
keeping automatic highlighting enabled you can set this option to false:
207+
>
208+
:let g:easytags_auto_update = 0
209+
210+
If you want to disable automatic updating for a single file you can execute
211+
the following command while editing the file:
212+
>
213+
:let b:easytags_auto_update = 0
214+
215+
-------------------------------------------------------------------------------
216+
The *g:easytags_auto_highlight* option
217+
218+
By default the plug-in automatically updates and highlights your tags when you
219+
stop typing for a moment. If you want to disable automatic highlighting while
220+
keeping automatic updating enabled you can set this option to false:
221+
>
222+
:let g:easytags_auto_highlight = 0
223+
224+
If you want to disable automatic highlighting for a single file you can
225+
execute the following command while editing the file:
226+
>
227+
:let b:easytags_auto_highlight = 0
228+
201229
-------------------------------------------------------------------------------
202230
The *g:easytags_autorecurse* option
203231

plugin/easytags.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" Vim plug-in
22
" Author: Peter Odding <peter@peterodding.com>
3-
" Last Change: June 24, 2011
3+
" Last Change: June 26, 2011
44
" URL: http://peterodding.com/code/vim/easytags/
55
" Requires: Exuberant Ctags (http://ctags.sf.net)
66

@@ -12,7 +12,7 @@ if &cp || exists('g:loaded_easytags')
1212
finish
1313
endif
1414

15-
let g:easytags_version = '2.4.6'
15+
let g:easytags_version = '2.4.7'
1616

1717
" Configuration defaults and initialization. {{{1
1818

0 commit comments

Comments
 (0)