Skip to content

Commit

Permalink
feat(notify): Added Highlighting calls and placeholder func.
Browse files Browse the repository at this point in the history
  • Loading branch information
DrKJeff16 committed Apr 10, 2024
1 parent e5aadb2 commit 8b4022b
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions lua/lazy_cfg/notify/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,53 @@ local Opts = {
Notify.setup(Opts)

vim.notify = Notify

---@param msg string
---@param lvl? 'info'|'error'|'warn'
---@param opts? table
function _G.anotify(msg, lvl, opts)
local notify = vim.notify
local async = require('plenary.async').run

lvl = lvl or 'warn'
if not vim.tbl_contains({ 'info', 'warn', 'ertor' }, lvl) then
lvl = 'warn'
end

opts = opts or nil
if opts == nil or type(opts) ~= 'table' or vim.tbl_isempty(opts) then
opts = {
title = 'Attention!'
}
end

async(function()
notify(msg, lvl, opts)
end)
end

---@type HlPair[]
local NotifyHl = {
{ name = 'NotifyERRORBorder', opts = { fg = '#8A1F1F' } },
{ name = 'NotifyWARNBorder', opts = { fg = '#79491D' } },
{ name = 'NotifyINFOBorder', opts = { fg = '#4F6752' } },
{ name = 'NotifyDEBUGBorder', opts = { fg = '#8B8B8B' } },
{ name = 'NotifyTRACEBorder', opts = { fg = '#4F3552' } },
{ name = 'NotifyERRORIcon', opts = { fg = '#F70067' } },
{ name = 'NotifyWARNIcon', opts = { fg = '#F79000' } },
{ name = 'NotifyINFOIcon', opts = { fg = '#A9FF68' } },
{ name = 'NotifyDEBUGIcon', opts = { fg = '#8B8B8B' } },
{ name = 'NotifyTRACEIcon', opts = { fg = '#D484FF' } },
{ name = 'NotifyERRORTitle', opts = { fg = '#F70067' } },
{ name = 'NotifyWARNTitle', opts = { fg = '#F79000' } },
{ name = 'NotifyINFOTitle', opts = { fg = '#A9FF68' } },
{ name = 'NotifyDEBUGTitle', opts = { fg = '#8B8B8B' } },
{ name = 'NotifyTRACETitle', opts = { fg = '#D484FF' } },
{ name = 'NotifyERRORBody', opts = { link = 'Normal' } },
{ name = 'NotifyWARNBody', opts = { link = 'Normal' } },
{ name = 'NotifyINFOBody', opts = { link = 'Normal' } },
{ name = 'NotifyDEBUGBody', opts = { link = 'Normal' } },
{ name = 'NotifyTRACEBody', opts = { link = 'Normal' } },
}

hl(NotifyHl)

0 comments on commit 8b4022b

Please sign in to comment.