This commit is contained in:
sankalp committed 2024-04-27 00:09:57 +05:45
1 parent 4d702fab7e
commit f0ebf86684
55 files changed
+3839

No files matched your search

+56
View File
@@ -0,0 +1,56 @@
local notify = require('notify')
local icons = require('lib.icons')
notify.setup({
background_colour = '#000',
fps = 30,
icons = {
DEBUG = icons.ui.Bug,
ERROR = icons.diagnostics.Error,
INFO = icons.diagnostics.Information,
TRACE = icons.ui.Bookmark,
WARN = icons.diagnostics.Warning,
},
level = 2,
render = 'default',
stages = 'fade_in_slide_out',
timeout = 2000,
top_down = true,
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,
})
-- Controls noisy notifications
local buffered_messages = {
'Client %d+ quit',
'No node found at cursor',
}
local message_notifications = {}
vim.notify = function(msg, level, opts)
opts = opts or {}
for _, pattern in ipairs(buffered_messages) do
if string.find(msg, pattern) then
if message_notifications[pattern] then
opts.replace = message_notifications[pattern]
end
opts.on_close = function()
message_notifications[pattern] = nil
end
message_notifications[pattern] = notify.notify(msg, level, opts)
return
end
end
notify.notify(msg, level, opts)
end