What
Add autocmds that call checktime on FocusGained and BufEnter so that the existing autoread = true setting actually reloads files changed on disk.
Where
lua/config/options.lua:60:
The fix belongs in the same file, near the autoread line.
Why it matters
Neovim's autoread does not poll for file changes on its own — it only reloads when triggered by checktime. Without a checktime call, autoread fires only on a narrow set of events (switching to the file via :edit, or when certain shell commands run via :!). In the typical workflow — edit a file in a terminal, switch back to Neovim — the buffer silently stays stale.
The config sets autoread = true (implying a desire for automatic reload) and also makes heavy use of the terminal (, to open a split terminal, the tabe | te tip documented in init.lua). A FocusGained handler is the natural complement: when you Alt-Tab back to Neovim or close the terminal split, all open buffers check for disk changes.
Suggested implementation
In lua/config/options.lua, after the autoread line:
vim.api.nvim_create_autocmd({ "FocusGained", "BufEnter" }, {
callback = function()
if vim.fn.getcmdwintype() == "" then
vim.cmd("silent! checktime")
end
end,
})
The getcmdwintype() == "" guard skips the checktime call when the command-line window is open (where it would error). silent! suppresses "file changed on disk" prompts for files that haven't actually changed — only files with real changes will prompt.
Notes
BufEnter catches the case where you switch to a buffer in the same Neovim instance (e.g., after a git pull in the terminal split).
FocusGained catches the case where Neovim regains focus from another application.
- This is a zero-dependency, pure-builtin change — no plugins needed.
- Pairs naturally with the existing
autoread setting and the terminal-heavy workflow documented in init.lua.
What
Add autocmds that call
checktimeonFocusGainedandBufEnterso that the existingautoread = truesetting actually reloads files changed on disk.Where
lua/config/options.lua:60:The fix belongs in the same file, near the
autoreadline.Why it matters
Neovim's
autoreaddoes not poll for file changes on its own — it only reloads when triggered bychecktime. Without achecktimecall,autoreadfires only on a narrow set of events (switching to the file via:edit, or when certain shell commands run via:!). In the typical workflow — edit a file in a terminal, switch back to Neovim — the buffer silently stays stale.The config sets
autoread = true(implying a desire for automatic reload) and also makes heavy use of the terminal (,to open a split terminal, thetabe | tetip documented ininit.lua). AFocusGainedhandler is the natural complement: when you Alt-Tab back to Neovim or close the terminal split, all open buffers check for disk changes.Suggested implementation
In
lua/config/options.lua, after theautoreadline:The
getcmdwintype() == ""guard skips thechecktimecall when the command-line window is open (where it would error).silent!suppresses "file changed on disk" prompts for files that haven't actually changed — only files with real changes will prompt.Notes
BufEntercatches the case where you switch to a buffer in the same Neovim instance (e.g., after a git pull in the terminal split).FocusGainedcatches the case where Neovim regains focus from another application.autoreadsetting and the terminal-heavy workflow documented ininit.lua.