From 303f31895e7ce10df250c88c7a5f7d8d9c56f0fc Mon Sep 17 00:00:00 2001 From: Steven Arcangeli Date: Sun, 19 Nov 2023 21:10:37 -0800 Subject: [PATCH] fix: buffer data cleared when setting buflisted = false For posterity: this was a very painful lesson. Turns out "BufDelete" doesn't mean "buffer was deleted", it means "buffer was deleted from the buffer list". If you set nobuflisted, BufDelete will be triggered even though the buffer is still loaded and active. --- lua/oil/view.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/oil/view.lua b/lua/oil/view.lua index e3a4b494..e2a05f97 100644 --- a/lua/oil/view.lua +++ b/lua/oil/view.lua @@ -317,7 +317,7 @@ M.initialize = function(bufnr) end, 100) end, }) - vim.api.nvim_create_autocmd("BufDelete", { + vim.api.nvim_create_autocmd("BufUnload", { group = "Oil", nested = true, once = true,