diff options
| author | srdusr <trevorgray@srdusr.com> | 2025-09-24 04:19:28 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2025-09-24 04:19:28 +0200 |
| commit | e95332b121672abaf9fd02692d81869b1e46c02d (patch) | |
| tree | 9dc0def690d7941b18783733045ba091112e9452 /common/config/nvim/lua/plugins/notify.lua | |
| parent | 0f6cee92221dc517bd756083e260dd9373851b82 (diff) | |
| parent | 7ed2303648bf83bb081d9bd863660ebf2344ce47 (diff) | |
| download | dotfiles-e95332b121672abaf9fd02692d81869b1e46c02d.tar.gz dotfiles-e95332b121672abaf9fd02692d81869b1e46c02d.zip | |
Merge commit '7ed2303648bf83bb081d9bd863660ebf2344ce47'
Diffstat (limited to 'common/config/nvim/lua/plugins/notify.lua')
| -rwxr-xr-x[-rw-r--r--] | common/config/nvim/lua/plugins/notify.lua | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/common/config/nvim/lua/plugins/notify.lua b/common/config/nvim/lua/plugins/notify.lua index dcb496a..62a8f47 100644..100755 --- a/common/config/nvim/lua/plugins/notify.lua +++ b/common/config/nvim/lua/plugins/notify.lua @@ -1,18 +1,36 @@ -require('notify').setup({ - background_colour = '#000000', - icons = { - ERROR = '', - WARN = '', - INFO = '', - DEBUG = '', - TRACE = '✎', - }, -}) +local M = {} -vim.api.nvim_command('hi default link NotifyERRORBody Normal') -vim.api.nvim_command('hi default link NotifyWARNBody Normal') -vim.api.nvim_command('hi default link NotifyINFOBody Normal') -vim.api.nvim_command('hi default link NotifyDEBUGBody Normal') -vim.api.nvim_command('hi default link NotifyTRACEBody Normal') -vim.api.nvim_command('hi default link NotifyLogTime Comment') -vim.api.nvim_command('hi default link NotifyLogTitle Special') +function M.setup() + local ok, notify = pcall(require, 'notify') + if not ok or not notify then + return false + end + + notify.setup({ + background_colour = '#000000', + icons = { + ERROR = '', + WARN = '', + INFO = '', + DEBUG = '', + TRACE = '✎', + } + }) + + -- Set highlight groups safely + local function set_hl(group, link) + vim.cmd(('hi default link %s %s'):format(group, link)) + end + + set_hl('NotifyERRORBody', 'Normal') + set_hl('NotifyWARNBody', 'Normal') + set_hl('NotifyINFOBody', 'Normal') + set_hl('NotifyDEBUGBody', 'Normal') + set_hl('NotifyTRACEBody', 'Normal') + set_hl('NotifyLogTime', 'Comment') + set_hl('NotifyLogTitle', 'Special') + + return true +end + +return M |
