From 88fef0b968df327d680e90a329029cbc9a0a2f4d Mon Sep 17 00:00:00 2001 From: Frederick Zhang Date: Sat, 30 Dec 2023 01:51:37 +1100 Subject: [PATCH] fix(autocmds): avoid checktime when buftype=nofile It triggered an 'E11: Invalid in command-line window; executes, CTRL-C quits' error when Neovim was in Command Line window and FocusGained. --- lua/lazyvim/config/autocmds.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index 4cc6f1ec..81285f18 100644 --- a/lua/lazyvim/config/autocmds.lua +++ b/lua/lazyvim/config/autocmds.lua @@ -7,7 +7,11 @@ end -- Check if we need to reload the file when it changed vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave" }, { group = augroup("checktime"), - command = "checktime", + callback = function() + if vim.o.buftype ~= 'nofile' then + vim.cmd('checktime') + end + end }) -- Highlight on yank