diff options
| author | Thomas Vanbesien <tvanbesi@proton.me> | 2026-06-30 19:57:15 +0200 |
|---|---|---|
| committer | Thomas Vanbesien <tvanbesi@proton.me> | 2026-06-30 21:22:27 +0200 |
| commit | 1f793d38bd4273f00a8b93ea20dfddccf53af47b (patch) | |
| tree | 0c5b1a1ed3a326044991fef2d3969148c2397b20 /init.lua | |
| parent | 02d5258db8eafd9bf978af555dd30a3b840ff0b0 (diff) | |
| download | nvim-config-1f793d38bd4273f00a8b93ea20dfddccf53af47b.tar.gz nvim-config-1f793d38bd4273f00a8b93ea20dfddccf53af47b.zip | |
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.
Diffstat (limited to 'init.lua')
| -rw-r--r-- | init.lua | 22 |
1 files changed, 0 insertions, 22 deletions
@@ -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) ------------------------------------------------------------------------------------------------------------------------ |
