Skip to content

Commit

Permalink
fix: notify-send for vim.notify is boring
Browse files Browse the repository at this point in the history
  • Loading branch information
willruggiano committed Jul 6, 2023
1 parent 46cfede commit 05ec65d
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions plugins/bombadil.lua
Original file line number Diff line number Diff line change
@@ -1,27 +1,3 @@
return function()
vim.cmd.colorscheme "flavours"

local vim_to_sys = {
[vim.log.levels.TRACE] = "low",
[vim.log.levels.DEBUG] = "low",
[vim.log.levels.INFO] = "normal",
[vim.log.levels.WARN] = "normal",
[vim.log.levels.ERROR] = "critical",
}

local notify = vim.notify
local function notify_send(msg, level, opts)
if not pcall(os.execute, string.format("notify-send -u %s Neovim '%s'", vim_to_sys[level], msg)) then
notify(msg, level, opts)
end
end

local notifiers = {
[vim.log.levels.WARN] = notify_send,
[vim.log.levels.ERROR] = notify_send,
}
---@diagnostic disable-next-line: duplicate-set-field
vim.notify = function(msg, level, opts)
(notifiers[level] or notify)(msg, level, opts)
end
end

0 comments on commit 05ec65d

Please sign in to comment.