From 8e2046f3d02a80558802b6cbcd4c8f7d44f7b6b4 Mon Sep 17 00:00:00 2001 From: Frederick Zhang Date: Mon, 22 Jan 2024 06:20:54 +1100 Subject: [PATCH] fix(autocmds): avoid checktime when buftype=nofile (#2270) 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 bedea2e7..e3fb1fda 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