feat(remove-file): use vim.ui.select

This commit is contained in:
kiyan
2022-07-18 14:28:08 +02:00
parent 7cffe14743
commit 2d629cab78

View File

@@ -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)