mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-24 05:21:07 +00:00
fix(autocmds): buf invalid after vim.schedule
This commit is contained in:
parent
6055e59613
commit
86d9d93e31
1 changed files with 3 additions and 0 deletions
|
|
@ -74,6 +74,9 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||||
callback = function(event)
|
callback = function(event)
|
||||||
vim.bo[event.buf].buflisted = false
|
vim.bo[event.buf].buflisted = false
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
|
if not vim.api.nvim_buf_is_valid(event.buf) then
|
||||||
|
return
|
||||||
|
end
|
||||||
vim.keymap.set("n", "q", function()
|
vim.keymap.set("n", "q", function()
|
||||||
vim.cmd("close")
|
vim.cmd("close")
|
||||||
pcall(vim.api.nvim_buf_delete, event.buf, { force = true })
|
pcall(vim.api.nvim_buf_delete, event.buf, { force = true })
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue