Skip to content

Commit

Permalink
fix: disable noice on VimLeavePre so that the user can see exit errors
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jun 3, 2024
1 parent 69c6ad5 commit 31ec80c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions lua/noice/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ function M.cmd(name)
end

function M.enable()
vim.api.nvim_create_autocmd("VimLeavePre", {
group = vim.api.nvim_create_augroup("NoiceVimLeavePre", { clear = true }),
callback = function()
if Config.is_running() then
pcall(M.disable)
end
end,
})
Config._running = true
if Config.options.notify.enabled then
require("noice.source.notify").enable()
Expand Down
2 changes: 1 addition & 1 deletion lua/noice/util/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ function M.read_file(file)
end

function M.is_exiting()
return vim.v.exiting ~= vim.NIL
return vim.v.exiting ~= vim.NIL or vim.v.dying ~= vim.NIL
end

function M.write_file(file, data)
Expand Down

0 comments on commit 31ec80c

Please sign in to comment.