mirror of
https://github.com/akr2002/nv.git
synced 2024-11-09 10:39:44 +00:00
add notifications
This commit is contained in:
parent
c3f591927c
commit
65a2dbe9aa
3 changed files with 50 additions and 3 deletions
|
@ -3,5 +3,6 @@
|
|||
./sets.nix
|
||||
./dap/dap.nix
|
||||
./keymaps.nix
|
||||
./ui/nvim-notify.nix
|
||||
];
|
||||
}
|
||||
|
|
|
@ -245,7 +245,7 @@
|
|||
key = "J";
|
||||
action = "mzJ`z";
|
||||
options = {
|
||||
search = true;
|
||||
silent = true;
|
||||
desc = "Allow cursor to stay in the same place after appending to current line";
|
||||
};
|
||||
}
|
||||
|
@ -279,8 +279,8 @@
|
|||
{
|
||||
mode = "n";
|
||||
key = "k";
|
||||
action._raw = "
|
||||
[[(v.vount > 1 ? 'm`' . v:count : 'g') . 'k']]
|
||||
action.__raw = "
|
||||
[[(v:count > 1 ? 'm`' . v:count : 'g') . 'k']]
|
||||
";
|
||||
options = {
|
||||
expr = true;
|
||||
|
|
46
config/ui/nvim-notify.nix
Normal file
46
config/ui/nvim-notify.nix
Normal file
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
plugins.notify = {
|
||||
enable = true;
|
||||
backgroundColour = "#000000";
|
||||
fps = 60;
|
||||
render = "default";
|
||||
timeout = 500;
|
||||
topDown = true;
|
||||
};
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>un";
|
||||
action = ''
|
||||
<cmd>lua require("notify").dismiss({ silent = true, pending = true})<cr>
|
||||
'';
|
||||
options = {
|
||||
desc = "Dsimiss all notifications";
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
extraConfigLua = ''
|
||||
local notify = require("notify")
|
||||
local filtered_message = { "No information available" }
|
||||
|
||||
-- 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 {})
|
||||
|
||||
for _, msg in ipairs(filtered_message) do
|
||||
if message == msg then
|
||||
return
|
||||
end
|
||||
end
|
||||
return notify(message, level, merged_opts)
|
||||
end
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue