feat(notify): add notify.threshold (#1693)

* feat: configurable notification level

add `notify.threshold` to setup opts

* feat: configurable notification level: add threshold example doc

* feat: configurable notification level: log always comes last

Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
kylo252
2022-11-01 00:24:40 +01:00
committed by GitHub
parent ada2c6441d
commit 6ca6f99e76
19 changed files with 120 additions and 66 deletions

View File

@@ -3,6 +3,7 @@ local uv = vim.loop
local lib = require "nvim-tree.lib"
local utils = require "nvim-tree.utils"
local events = require "nvim-tree.events"
local notify = require "nvim-tree.notify"
local M = {}
@@ -12,15 +13,15 @@ end
function M.rename(node, to)
if utils.file_exists(to) then
utils.notify.warn(err_fmt(node.absolute_path, to, "file already exists"))
notify.warn(err_fmt(node.absolute_path, to, "file already exists"))
return
end
local success, err = uv.fs_rename(node.absolute_path, to)
if not success then
return utils.notify.warn(err_fmt(node.absolute_path, to, err))
return notify.warn(err_fmt(node.absolute_path, to, err))
end
utils.notify.info(node.absolute_path .. "" .. to)
notify.info(node.absolute_path .. "" .. to)
utils.rename_loaded_buffers(node.absolute_path, to)
events._dispatch_node_renamed(node.absolute_path, to)
end