diff --git a/lua/toggleterm/terminal.lua b/lua/toggleterm/terminal.lua index e4a154cd..1ad3ce4f 100644 --- a/lua/toggleterm/terminal.lua +++ b/lua/toggleterm/terminal.lua @@ -151,7 +151,7 @@ end ---Terminal buffer autocommands ---@param term Terminal local function setup_buffer_autocommands(term) - api.nvim_create_autocmd("TermClose", { + api.nvim_create_autocmd("BufDelete", { buffer = term.bufnr, group = AUGROUP, callback = function() delete(term.id) end,