How does Vim's autoread work?

后端 未结 7 1669
[愿得一人]
[愿得一人] 2021-01-30 10:13

:h autoread says:

When a file has been detected to have been changed outside of Vim and it has not been changed inside of Vim, automatically

7条回答
  •  旧巷少年郎
    2021-01-30 10:56

    A bit late to the party, but vim nowadays has timers, and you can do:

    if ! exists("g:CheckUpdateStarted")
        let g:CheckUpdateStarted=1
        call timer_start(1,'CheckUpdate')
    endif
    function! CheckUpdate(timer)
        silent! checktime
        call timer_start(1000,'CheckUpdate')
    endfunction
    

提交回复
热议问题