refactor(utils): notify now has title

This commit is contained in:
Smirnov Oleksandr 2023-08-10 11:47:24 +03:00
parent e49ee67ecc
commit e2ef9dbcd7

View file

@ -1,5 +1,7 @@
local utils = {} local utils = {}
local TITLE = "gopher.nvim"
---@param t table ---@param t table
---@return boolean ---@return boolean
function utils.is_tbl_empty(t) function utils.is_tbl_empty(t)
@ -10,13 +12,24 @@ function utils.is_tbl_empty(t)
end end
---@param msg string ---@param msg string
---@param lvl any ---@param lvl number
function utils.deferred_notify(msg, lvl) function utils.deferred_notify(msg, lvl)
vim.defer_fn(function() vim.defer_fn(function()
vim.notify(msg, lvl) vim.notify(msg, lvl, {
title = TITLE,
})
end, 0) end, 0)
end end
---@param msg string
---@param lvl? number
function utils.notify(msg, lvl)
lvl = lvl or vim.log.levels.INFO
vim.notify(msg, lvl, {
title = TITLE,
})
end
-- safe require -- safe require
---@param module string module name ---@param module string module name
function utils.sreq(module) function utils.sreq(module)