feat(snacks): use snacks notifier instead of nvim-notify

This commit is contained in:
Folke Lemaitre 2024-11-05 16:55:30 +01:00
parent b006ac7afb
commit b6ddeb2341
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 22 additions and 45 deletions

View file

@ -27,9 +27,11 @@ return {
"folke/snacks.nvim", "folke/snacks.nvim",
priority = 1000, priority = 1000,
lazy = false, lazy = false,
opts = function()
---@type snacks.Config ---@type snacks.Config
opts = { return {
toggle = { map = LazyVim.safe_keymap_set }, toggle = { map = LazyVim.safe_keymap_set },
notifier = { enabled = not LazyVim.has("noice.nvim") },
terminal = { terminal = {
win = { win = {
keys = { keys = {
@ -40,6 +42,16 @@ return {
}, },
}, },
}, },
}
end,
keys = {
{
"<leader>un",
function()
Snacks.notifier:hide()
end,
desc = "Dismiss All Notifications",
},
}, },
}, },
} }

View file

@ -1,39 +1,4 @@
return { return {
-- Better `vim.notify()`
{
"rcarriga/nvim-notify",
keys = {
{
"<leader>un",
function()
require("notify").dismiss({ silent = true, pending = true })
end,
desc = "Dismiss All Notifications",
},
},
opts = {
stages = "static",
timeout = 3000,
max_height = function()
return math.floor(vim.o.lines * 0.75)
end,
max_width = function()
return math.floor(vim.o.columns * 0.75)
end,
on_open = function(win)
vim.api.nvim_win_set_config(win, { zindex = 100 })
end,
},
init = function()
-- when noice is not enabled, install notify on VeryLazy
if not LazyVim.has("noice.nvim") then
LazyVim.on_very_lazy(function()
vim.notify = require("notify")
end)
end
end,
},
-- This is what powers LazyVim's fancy-looking -- This is what powers LazyVim's fancy-looking
-- tabs, which include filetype icons and close buttons. -- tabs, which include filetype icons and close buttons.
{ {