mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
Use timer instead of autocmd to defer startup processing
If the user has removed the "gitgutter CursorHold" autocommand, which is the documented way to turn off automatic refreshing, calling the autocommand at start up will fail. Use a timer instead. This implementation also changes the processing delay to 1ms instead of 'updatetime'. See #840.
This commit is contained in:
@@ -245,8 +245,8 @@ function! s:on_bufenter()
|
||||
" been any changes to the buffer since the first round, the second round
|
||||
" will be cheap.
|
||||
if has('vim_starting') && !$VIM_GITGUTTER_TEST
|
||||
if exists('*timer_start')
|
||||
call timer_start(&updatetime, 'GitGutterCursorHold')
|
||||
if exists('*timer_start') && has('lambda')
|
||||
call s:next_tick("call gitgutter#process_buffer(+".bufnr('').", 0)")
|
||||
endif
|
||||
return
|
||||
endif
|
||||
@@ -259,10 +259,6 @@ function! s:on_bufenter()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! GitGutterCursorHold(timer)
|
||||
execute 'doautocmd' s:nomodeline 'gitgutter CursorHold'
|
||||
endfunction
|
||||
|
||||
function! s:next_tick(cmd)
|
||||
call timer_start(1, {-> execute(a:cmd)})
|
||||
endfunction
|
||||
|
||||
Reference in New Issue
Block a user