nichts/modules/editors/nixvim/plug/ui/nvim-notify.nix

48 lines
1.2 KiB
Nix
Raw Normal View History

2024-05-22 10:43:46 +02:00
{
2024-05-22 14:04:58 +02:00
programs.nixvim = {
2024-05-22 14:29:45 +02:00
plugins.notify = {
enable = true;
backgroundColour = "#000000";
fps = 60;
render = "default";
timeout = 1000;
topDown = true;
};
keymaps = [
{
mode = "n";
key = "<leader>un";
action = ''
<cmd>lua require("notify").dismiss({ silent = true, pending = true })<cr>
'';
options = {
desc = "Dismiss All Notifications";
};
}
];
extraConfigLua = ''
local notify = require("notify")
2024-05-22 10:43:46 +02:00
2024-05-22 14:29:45 +02:00
local filtered_message = { "No information available" }
2024-05-22 10:43:46 +02:00
2024-05-22 14:29:45 +02:00
-- Override notify function to filter out messages
---@diagnostic disable-next-line: duplicate-set-field
vim.notify = function(message, level, opts)
local merged_opts = vim.tbl_extend("force", {
on_open = function(win)
local buf = vim.api.nvim_win_get_buf(win)
vim.api.nvim_buf_set_option(buf, "filetype", "markdown")
end,
}, opts or {})
2024-05-22 10:43:46 +02:00
2024-05-22 14:29:45 +02:00
for _, msg in ipairs(filtered_message) do
if message == msg then
return
end
end
return notify(message, level, merged_opts)
end
'';
};
2024-05-22 10:43:46 +02:00
}