feat: add ui.confirm.remove and ui.confirm.trash, deprecate trash.require_confirm (#1887)

* Implement turning off y/n prompt for file deletion

* Refactor different prompt configs to single ui table

* Remove unused fields

* add ui.confirm doc, format/tidy

* trash.require_confirm -> ui.confirm.trash

* Fix nil value trash field

Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
Telman Babayev
2023-01-08 10:43:01 +04:00
committed by GitHub
parent 5b554a9e2d
commit ccb6d8a518
5 changed files with 66 additions and 31 deletions

View File

@@ -32,8 +32,8 @@ function M.fn(node)
if M.config.trash.cmd == nil then
M.config.trash.cmd = "trash"
end
if M.config.trash.require_confirm == nil then
M.config.trash.require_confirm = true
if M.config.ui.confirm.trash == nil then
M.config.ui.confirm.trash = true
end
else
notify.warn "Trash is currently a UNIX only feature!"
@@ -87,7 +87,7 @@ function M.fn(node)
end
end
if M.config.trash.require_confirm then
if M.config.ui.confirm.trash then
local prompt_select = "Trash " .. node.name .. " ?"
local prompt_input = prompt_select .. " y/n: "
lib.prompt(prompt_input, prompt_select, { "y", "n" }, { "Yes", "No" }, function(item_short)
@@ -103,6 +103,7 @@ end
function M.setup(opts)
M.config = {}
M.config.ui = opts.ui or {}
M.config.trash = opts.trash or {}
M.enable_reload = not opts.filesystem_watchers.enable
end