neovide
neovide copied to clipboard
Neovide is ignoring `set autoread`, i.e. reloading the currently edited file when activated
Describe the bug MacVim and gVim automatically reload the buffer from disk when they are activated (i.e. clicked into). Neovide is not doing this for me.
To Reproduce
Make sure :set autoread
is in your vimrc.
echo "Hello World" > /tmp/blub.txt
neovide /tmp/blub.txt
vim /tmp/blub.txt -> and change a bunch of stuff, save the file
Click on neovide -> it still shows the original content
Expected behavior The buffer should be updated from the contents from disk, as long as it has not been changed in Neovide. If it has, an error should be shown.
Desktop (please complete the following information):
- OS: Mac OS, but I doubt it matters
- Neovide Version: not sure, the latest version downloaded 22-08-12
- Neovim Version: 0.6.0
Please run neovide --log
and paste the contents of the .log
file created in the current directory here:
/Volumes/Neovide/Neovide.app/Contents/MacOS/neovide --log
does not run for me - due to CodeSign it seems. How do I get the commandline to run?
neovim bug: https://github.com/neovim/neovim/issues/20082
I added this line to my config and it works fine according to this comment https://github.com/neovim/neovim/issues/20082#issuecomment-1288228566:
autocmd FocusGained * checktime
closing as upstream not related to us.
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.
Re-opening this, we should call nvim_ui_set_focus
.
If someone wants to do it, I think, just replacing these lines with nvim_ui_set_focus
should do it.
https://github.com/neovide/neovide/blob/39af18d647b4aeff43d6829f43fe4e57628691c0/src/bridge/ui_commands.rs#L141-L148
That's awesome they added nvim_ui_set_focus
... subscribing for later
Ok im trying to do this one myself. it looks like this was recently just added to nvim-rs
yesterday, so is it safe to increment 0.5.0 to 0.6.0? I dont know quite the nuance of updating rust packages
https://github.com/KillTheMule/nvim-rs/commit/79222f46f493ad541d6114f4dc30756c545ff6b6#diff-a9e0be44830ddcfa682e957ead7ed8cbb16ab285c4cdc4bd385a59079570c300R1230-R1237
@9mm, yes, you can update to 0.6.0. There's another change we need as well, this one https://github.com/KillTheMule/nvim-rs/pull/46.
Both changes are in 0.6.0.