feat: added notifier

This commit is contained in:
Folke Lemaitre 2024-11-05 16:54:56 +01:00
parent 0209e95f6d
commit 44011ddf0d
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
3 changed files with 390 additions and 0 deletions

View file

@ -13,6 +13,7 @@
---@field notify snacks.notify
---@field debug snacks.debug
---@field toggle snacks.toggle
---@field notifier snacks.notifier
local M = {}
setmetatable(M, {
@ -35,6 +36,7 @@ _G.Snacks = M
---@field lazygit snacks.lazygit.Config
---@field gitbrowse snacks.gitbrowse.Config
---@field views table<string, snacks.win.Config>
---@field notifier snacks.notifier.Config | { enabled: boolean }
---@field toggle snacks.toggle.Config
local config = {
bigfile = { enabled = true },
@ -42,6 +44,7 @@ local config = {
statuscolumn = { enabled = true },
words = { enabled = true },
views = {},
notifier = { enabled = true },
}
---@class snacks.Config: snacks.Opts
@ -103,6 +106,11 @@ function M.setup(opts)
if M.config.statuscolumn.enabled then
vim.o.statuscolumn = [[%!v:lua.require'snacks.statuscolumn'.get()]]
end
if M.config.notifier.enabled then
vim.notify = function(msg, level, o)
return Snacks.notifier:notify(msg, level, o)
end
end
end
return M