Open przepompownia opened 3 years ago
I have to run :checktime manually or write autocommand for nvim-qt only. Is it intentional?
No, I dont think it is.
In nvim the autoread check is triggered in check_timestamps
(among other places) called when there is a focus change (do_autocmd_focusgained
).
Since #329 the focus events are implemented as an autocommand
As far as i can see the focus auto commands are working properly, but the autoread option is not.
There are a couple of conditions in nvim which can cause autoread to be skipped
and as you already pointed out calling :checktime
does work, and is very similar
I would have to trace nvim to figure out why this is not being called.
As far as i can see the focus auto commands are working properly, but the autoread option is not.
You are right. While I used https://github.com/tmux-plugins/vim-tmux-focus-events it executed :checktime
on FocusGained with autocommand. The problem was revealed after removing this autocommand along with the plugin. Now the event is triggered but autoread
does not work on it.
The bug is still present on recent master versions of both Neovim and Neovim-qt.
The 'autoread'
feature does not work out-of-the-box for both nvim-qt
and neovide
:
The 'autoread'
feature does work for nvim
's TUI.
The reason it works for the TUI is mentioned in this now-closed Neovim issue: https://github.com/neovim/neovim/issues/20082#issuecomment-1236324274
No. I just noticed that neovide already triggers
FocusGained
, and that triggeringFocusGained
from:doautocmd
doesn't actually trigger a timestamp check. With TUI a timestamp check is done the same time asFocusGained
, but it is not an autocommand callback, but something triggered the same time as the autocommand.
In that issue, Neovim maintainer @justinmk has commented on the 'autoread'
feature:
https://github.com/neovim/neovim/issues/20082#issuecomment-1288913518
As mentioned above, FocusGained can be used to opt-in to the behavior you want.
The general story of improving autoread is tracked in https://github.com/neovim/neovim/issues/1380
This refers to having GUI users add this to their configuration:
autocmd FocusGained * checktime
I can confirm that this work-around does restore the 'autoread'
functionality for me, with both GUIs.
It's unclear to me whether there is a long-term plan to restore the 'autoread'
feature for Neovim GUIs users without requiring the above work-around.
Thanks for that summary @drmikehenry . As noted in https://github.com/neovide/neovide/issues/1477 , the GUI just needs to call nvim_ui_set_focus
.
nvim-qt -- --clean -c 'set autoread' /tmp/test
/tmp/test
I have to run
:checktime
manually or write autocommand for nvim-qt only. Is it intentional?There is no such need on pure nvim.