Skip to content

Commit

Permalink
Add easytags_auto_update/auto_highlight options
Browse files Browse the repository at this point in the history
  • Loading branch information
xolox committed Jun 26, 2011
1 parent 4cf1efd commit 67616b2
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 19 deletions.
20 changes: 20 additions & 0 deletions README.md
Expand Up @@ -96,6 +96,26 @@ 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_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:

:let g:easytags_auto_update = 0

If you want to disable automatic updating for a single file you can execute the following command while editing the file:

:let b:easytags_auto_update = 0

### The `g:easytags_auto_highlight` 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 highlighting while keeping automatic updating enabled you can set this option to false:

:let g:easytags_auto_highlight = 0

If you want to disable automatic highlighting for a single file you can execute the following command while editing the file:

:let b:easytags_auto_highlight = 0

### The `g:easytags_autorecurse` option

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):
Expand Down
38 changes: 21 additions & 17 deletions autoload/xolox/easytags.vim
@@ -1,6 +1,6 @@
" Vim script
" Author: Peter Odding <peter@peterodding.com>
" Last Change: June 24, 2011
" Last Change: June 26, 2011
" URL: http://peterodding.com/code/vim/easytags/

" Public interface through (automatic) commands. {{{1
Expand Down Expand Up @@ -35,26 +35,30 @@ endfunction
function! xolox#easytags#autoload() " {{{2
try
" Update entries for current file in tags file?
let pathname = s:resolve(expand('%:p'))
if pathname != ''
let tags_outdated = getftime(pathname) > getftime(xolox#easytags#get_tagsfile())
if tags_outdated || !xolox#easytags#file_has_tags(pathname)
call xolox#easytags#update(1, 0, [])
if xolox#misc#option#get('easytags_auto_update', 1)
let pathname = s:resolve(expand('%:p'))
if pathname != ''
let tags_outdated = getftime(pathname) > getftime(xolox#easytags#get_tagsfile())
if tags_outdated || !xolox#easytags#file_has_tags(pathname)
call xolox#easytags#update(1, 0, [])
endif
endif
endif
" Apply highlighting of tags to current buffer?
if &eventignore !~? '\<syntax\>'
if !exists('b:easytags_last_highlighted')
call xolox#easytags#highlight()
else
for tagfile in tagfiles()
if getftime(tagfile) > b:easytags_last_highlighted
call xolox#easytags#highlight()
break
endif
endfor
if xolox#misc#option#get('easytags_auto_highlight', 1)
if &eventignore !~? '\<syntax\>'
if !exists('b:easytags_last_highlighted')
call xolox#easytags#highlight()
else
for tagfile in tagfiles()
if getftime(tagfile) > b:easytags_last_highlighted
call xolox#easytags#highlight()
break
endif
endfor
endif
let b:easytags_last_highlighted = localtime()
endif
let b:easytags_last_highlighted = localtime()
endif
catch
call xolox#misc#msg#warn("easytags.vim %s: %s (at %s)", g:easytags_version, v:exception, v:throwpoint)
Expand Down
28 changes: 28 additions & 0 deletions doc/easytags.txt
Expand Up @@ -198,6 +198,34 @@ 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.

-------------------------------------------------------------------------------
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:
>
:let g:easytags_auto_update = 0
If you want to disable automatic updating for a single file you can execute
the following command while editing the file:
>
:let b:easytags_auto_update = 0
-------------------------------------------------------------------------------
The *g:easytags_auto_highlight* 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 highlighting while
keeping automatic updating enabled you can set this option to false:
>
:let g:easytags_auto_highlight = 0
If you want to disable automatic highlighting for a single file you can
execute the following command while editing the file:
>
:let b:easytags_auto_highlight = 0
-------------------------------------------------------------------------------
The *g:easytags_autorecurse* option

Expand Down
4 changes: 2 additions & 2 deletions plugin/easytags.vim
@@ -1,6 +1,6 @@
" Vim plug-in
" Author: Peter Odding <peter@peterodding.com>
" Last Change: June 24, 2011
" Last Change: June 26, 2011
" URL: http://peterodding.com/code/vim/easytags/
" Requires: Exuberant Ctags (http://ctags.sf.net)

Expand All @@ -12,7 +12,7 @@ if &cp || exists('g:loaded_easytags')
finish
endif

let g:easytags_version = '2.4.6'
let g:easytags_version = '2.4.7'

" Configuration defaults and initialization. {{{1

Expand Down

0 comments on commit 67616b2

Please sign in to comment.