From 1f793d38bd4273f00a8b93ea20dfddccf53af47b Mon Sep 17 00:00:00 2001 From: Thomas Vanbesien Date: Tue, 30 Jun 2026 19:57:15 +0200 Subject: fix(autoreload): reload silently instead of prompting The checktime autocmds were not nested, so the FileChangedShell they trigger was suppressed and Neovim fell back to its default change prompt instead of running the autoreload handler. Mark them nested and consolidate the external-change handling (autoread, checktime triggers, the FileChangedShell handler) from init.lua into the autoreload plugin. --- init.lua | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index c9ed8c6..8fdeca0 100644 --- a/init.lua +++ b/init.lua @@ -123,28 +123,6 @@ vim.api.nvim_create_autocmd("TextYankPost", { end, }) --- Reload file when changed outside of nvim -vim.opt.autoread = false -- Must be false for FileChangedShell to trigger when the buffer was not changed --- The manual says that FileChangedShell is triggered on FocusGained but it's not true. This function actually triggers --- the next FileChangedShell when the buffer has unsaved changes and the file was modified outside of nvim. -vim.api.nvim_create_autocmd({ "FocusGained" }, { - desc = "Trigger buffer reload when file is edited outside of nvim", - group = vim.g.dotfiles.augroup, - callback = function() - vim.cmd.checktime() - end, -}) -vim.api.nvim_create_autocmd({ "FileChangedShell" }, { - desc = "Prompt user to reload buffer when modified outside of nvim", - group = vim.g.dotfiles.augroup, - pattern = "*", - callback = function() - if vim.v.fcs_reason == "conflict" or vim.v.fcs_reason == "changed" then - vim.v.fcs_choice = "ask" - end - end, -}) - ------------------------------------------------------------------------------------------------------------------------ -- Commands (there's more in the different plugins) ------------------------------------------------------------------------------------------------------------------------ -- cgit v1.3.1