mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 18:58:12 +00:00
feat(notifier): added global keep config option
This commit is contained in:
parent
1e9580039b
commit
f32d82d1b7
1 changed files with 2 additions and 0 deletions
|
@ -57,6 +57,7 @@ M.styles = {
|
|||
}
|
||||
|
||||
---@class snacks.notifier.Config
|
||||
---@field keep? fun(notif: snacks.notifier.Notif): boolean
|
||||
local defaults = {
|
||||
timeout = 3000,
|
||||
width = { min = 40, max = 0.4 },
|
||||
|
@ -217,6 +218,7 @@ function M:update()
|
|||
local keep = not notif.shown -- not shown yet
|
||||
or (notif.win and notif.win:win_valid() and vim.api.nvim_get_current_win() == notif.win.win) -- current window
|
||||
or (notif.keep and notif.keep(notif)) -- custom keep
|
||||
or (self.opts.keep and self.opts.keep(notif)) -- global keep
|
||||
or (notif.shown + timeout > now) -- not timed out
|
||||
if not keep and notif.win then
|
||||
notif.win:close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue