nvim-tree.lua/lua/nvim-tree/notify.lua
Kasper Kondzielski 68f485b454
fix(#1697): remove notify plugin auto-detection (#2135)
* feat: Remove nvim-notify auto-detection

* feat: Remove nvim-notify auto-detection: stylua

---------

Co-authored-by: ghostbuster91 <ghostbuster91@users.noreply.github.com>
Co-authored-by: Alexander Courtis <alex@courtis.org>
2023-04-15 15:18:05 +10:00

39 lines
782 B
Lua

local M = {}
local config = {
threshold = vim.log.levels.INFO,
}
local modes = {
{ name = "trace", level = vim.log.levels.TRACE },
{ name = "debug", level = vim.log.levels.DEBUG },
{ name = "info", level = vim.log.levels.INFO },
{ name = "warn", level = vim.log.levels.WARN },
{ name = "error", level = vim.log.levels.ERROR },
}
do
local dispatch = function(level, msg)
if level < config.threshold then
return
end
vim.schedule(function()
vim.notify(msg, level, { title = "NvimTree" })
end)
end
for _, x in ipairs(modes) do
M[x.name] = function(msg)
return dispatch(x.level, msg)
end
end
end
function M.setup(opts)
opts = opts or {}
config.threshold = opts.notify.threshold or vim.log.levels.INFO
end
return M