diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim old mode 100644 new mode 100755 index 9f619e6b..11d5b26c --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -2646,6 +2646,8 @@ endfunction " Helper functions {{{1 " s:AutoUpdate() {{{2 +" use timer_start to let tagbar async, this can increase vim open file performance and +" fix windows blink when open some file. function! s:AutoUpdate(fname, force, ...) abort call tagbar#debug#log('AutoUpdate called [' . a:fname . ']') @@ -2653,6 +2655,17 @@ function! s:AutoUpdate(fname, force, ...) abort " update the fileinfo let no_display = a:0 > 0 ? a:1 : 0 + if !has('win32') && has('lambda') && has('timers') + call tagbar#debug#log('Performing async call to AutoUpdate_CB') + call timer_start(0, { -> AutoUpdate_CB(a:fname, a:force, no_display)}) + else + call tagbar#debug#log('Performing sync call to AutoUpdate_CB') + call AutoUpdate_CB(a:fname, a:force, no_display) + endif +endfunc + +function! AutoUpdate_CB(fname, force, no_display) abort + " This file is being loaded due to a quickfix command like vimgrep, so " don't process it if exists('s:tagbar_qf_active') @@ -2713,7 +2726,7 @@ function! s:AutoUpdate(fname, force, ...) abort let updated = 1 endif - if no_display + if a:no_display return endif