aboutsummaryrefslogtreecommitdiffstats
path: root/autoload/xolox/easytags.vim
diff options
context:
space:
mode:
Diffstat (limited to 'autoload/xolox/easytags.vim')
-rw-r--r--autoload/xolox/easytags.vim37
1 files changed, 30 insertions, 7 deletions
diff --git a/autoload/xolox/easytags.vim b/autoload/xolox/easytags.vim
index 001a81f..1cd6071 100644
--- a/autoload/xolox/easytags.vim
+++ b/autoload/xolox/easytags.vim
@@ -1,6 +1,6 @@
" Vim script
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: June 22, 2014
+" Last Change: June 29, 2014
" URL: http://peterodding.com/code/vim/easytags/
let g:xolox#easytags#version = '3.5'
@@ -117,7 +117,8 @@ endfunction
function! xolox#easytags#autoload(event) " {{{2
try
- let do_update = xolox#misc#option#get('easytags_auto_update', 1)
+ let session_loading = xolox#easytags#session_is_loading() && a:event == 'BufReadPost'
+ let do_update = xolox#misc#option#get('easytags_auto_update', 1) && !session_loading
let do_highlight = xolox#misc#option#get('easytags_auto_highlight', 1) && &eventignore !~? '\<syntax\>'
" Don't execute this function for unsupported file types (doesn't load
" the list of file types if updates and highlighting are both disabled).
@@ -173,7 +174,7 @@ function! xolox#easytags#update(silent, filter_tags, filenames) " {{{2
let params['directory'] = xolox#misc#path#absolute(g:easytags_by_filetype)
let params['filetypes'] = g:xolox#easytags#filetypes#ctags_to_vim
else
- let params['tagsfile'] = (async ? fnamemodify(tagsfile, ':p') : tagsfile) " Need to pass full absolute path to the forked process.
+ let params['tagsfile'] = tagsfile
endif
if async
call xolox#misc#async#call({'function': 'xolox#easytags#update#with_vim', 'arguments': [params], 'callback': 'xolox#easytags#async_callback'})
@@ -326,7 +327,11 @@ function! xolox#easytags#highlight() " {{{2
endif
endif
endfor
- redraw
+ " Avoid flashing each highlighted buffer in front of the user when
+ " loading a session.
+ if !xolox#easytags#session_is_loading()
+ redraw
+ endif
let bufname = expand('%:p:~')
if bufname == ''
let bufname = 'unnamed buffer #' . bufnr('%')
@@ -373,7 +378,7 @@ function! xolox#easytags#get_tagsfile() " {{{2
let message = "The tags file %s isn't writable!"
throw printf(message, fnamemodify(tagsfile, ':~'))
endif
- return tagsfile
+ return xolox#misc#path#absolute(tagsfile)
endfunction
function! xolox#easytags#syntax_groups_to_ignore() " {{{2
@@ -408,6 +413,22 @@ function! xolox#easytags#async_callback(response) " {{{2
endif
endfunction
+function! xolox#easytags#session_is_loading() " {{{2
+ return exists('g:SessionLoad')
+endfunction
+
+function! xolox#easytags#disable_automatic_updates() " {{{2
+ let s:easytags_auto_update_save = xolox#misc#option#get('easytags_auto_update', 1)
+ let g:easytags_auto_update = 0
+endfunction
+
+function! xolox#easytags#restore_automatic_updates() " {{{2
+ if exists('s:easytags_auto_update_save')
+ let g:easytags_auto_update = s:easytags_auto_update_save
+ unlet s:easytags_auto_update_save
+ else
+endfunction
+
" Public API for definition of file type specific dynamic syntax highlighting. {{{1
function! xolox#easytags#define_tagkind(object) " {{{2
@@ -425,7 +446,7 @@ endfunction
" Miscellaneous script-local functions. {{{1
-function! s:report_results(response, async) " {{{1
+function! s:report_results(response, async) " {{{2
let actions = []
if a:response['num_updated'] > 0
call add(actions, printf('updated %i tags', a:response['num_updated']))
@@ -434,8 +455,10 @@ function! s:report_results(response, async) " {{{1
call add(actions, printf('filtered %i invalid tags', a:response['num_filtered']))
endif
if !empty(actions)
+ let function = a:async ? 'xolox#misc#msg#debug' : 'xolox#misc#msg#info'
let actions_string = xolox#misc#str#ucfirst(join(actions, ' and '))
- call xolox#misc#msg#info("easytags.vim %s: %s in %s (%s).", g:xolox#easytags#version, actions_string, a:response['elapsed_time'], a:async ? 'asynchronously' : 'synchronously')
+ let command_type = a:async ? 'asynchronously' : 'synchronously'
+ call call(function, ["easytags.vim %s: %s in %s (%s).", g:xolox#easytags#version, actions_string, a:response['elapsed_time'], command_type])
endif
endfunction