feat(remove-file): use vim.ui.select
This commit is contained in:
@@ -68,10 +68,8 @@ function M.fn(node)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
print("Remove " .. node.name .. " ? y/n")
|
vim.ui.select({ "y", "n" }, { prompt = "Remove " .. node.name .. " ?" }, function(choice)
|
||||||
local ans = utils.get_user_input_char()
|
if choice == "y" then
|
||||||
utils.clear_prompt()
|
|
||||||
if ans:match "^y" then
|
|
||||||
if node.nodes ~= nil and not node.link_to then
|
if node.nodes ~= nil and not node.link_to then
|
||||||
local success = remove_dir(node.absolute_path)
|
local success = remove_dir(node.absolute_path)
|
||||||
if not success then
|
if not success then
|
||||||
@@ -91,6 +89,7 @@ function M.fn(node)
|
|||||||
require("nvim-tree.actions.reloaders.reloaders").reload_explorer()
|
require("nvim-tree.actions.reloaders.reloaders").reload_explorer()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.setup(opts)
|
function M.setup(opts)
|
||||||
|
|||||||
Reference in New Issue
Block a user