vim: Use timer instead of autocommand for autoread
This commit is contained in:
@@ -7,3 +7,11 @@ function! CycleSpellLang()
|
|||||||
set spelllang=en
|
set spelllang=en
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Check time every second to read file changes.
|
||||||
|
if (exists('+autoread') && &autoread)
|
||||||
|
function! CheckTime(timer)
|
||||||
|
checktime
|
||||||
|
endfunc
|
||||||
|
execute timer_start(1000, 'CheckTime', {'repeat': -1})
|
||||||
|
endif
|
||||||
|
|||||||
@@ -53,9 +53,3 @@ else
|
|||||||
autocmd VimLeave * silent !echo -ne "\e[5 q"
|
autocmd VimLeave * silent !echo -ne "\e[5 q"
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Read file changes when cursor is not moved for &updatetime ms and then move
|
|
||||||
" cursor to restart the timer
|
|
||||||
if (exists('+autoread') && &autoread)
|
|
||||||
autocmd CursorHold * checktime | call feedkeys('hl')
|
|
||||||
endif
|
|
||||||
|
|||||||
Reference in New Issue
Block a user