fix(autocmds): avoid checktime when buftype=nofile (#2270)

It triggered an 'E11: Invalid in command-line window; <CR> executes,
CTRL-C quits' error when Neovim was in Command Line window and
FocusGained.
This commit is contained in:
Frederick Zhang 2024-01-22 06:20:54 +11:00 committed by GitHub
parent c72db4938c
commit 8e2046f3d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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