* Changed the default y/n prompt to default to N in most cases(all delete cases) and made it so that the copy paste same name conflict defaults to R(ename) * Removed all No conditions as they are not used and not needed * Made item_short into lowercase and also fixed prompts in dressing.nvim and telescope-select.nvim * Fixed the exception which occurs on pressing esc in the prompt and also made rename to be blank or r.*/R.*
53 lines
1.3 KiB
Lua
53 lines
1.3 KiB
Lua
local marks = require "nvim-tree.marks"
|
|
local utils = require "nvim-tree.utils"
|
|
local remove_file = require "nvim-tree.actions.fs.remove-file"
|
|
local notify = require "nvim-tree.notify"
|
|
local lib = require "nvim-tree.lib"
|
|
|
|
local M = {
|
|
config = {},
|
|
}
|
|
|
|
--- Delete nodes; each removal will be optionally notified
|
|
--- @param nodes table
|
|
local function do_delete(nodes)
|
|
for _, node in pairs(nodes) do
|
|
remove_file.remove(node)
|
|
end
|
|
|
|
marks.clear_marks()
|
|
|
|
if not M.config.filesystem_watchers.enable then
|
|
require("nvim-tree.actions.reloaders.reloaders").reload_explorer()
|
|
end
|
|
end
|
|
|
|
--- Delete marked nodes, optionally prompting
|
|
function M.bulk_delete()
|
|
local nodes = marks.get_marks()
|
|
if not nodes or #nodes == 0 then
|
|
notify.warn "No bookmarksed to delete."
|
|
return
|
|
end
|
|
|
|
if M.config.ui.confirm.remove then
|
|
local prompt_select = "Remove bookmarked ?"
|
|
local prompt_input = prompt_select .. " y/N: "
|
|
lib.prompt(prompt_input, prompt_select, { "", "y" }, { "No", "Yes" }, function(item_short)
|
|
utils.clear_prompt()
|
|
if item_short == "y" then
|
|
do_delete(nodes)
|
|
end
|
|
end)
|
|
else
|
|
do_delete(nodes)
|
|
end
|
|
end
|
|
|
|
function M.setup(opts)
|
|
M.config.ui = opts.ui
|
|
M.config.filesystem_watchers = opts.filesystem_watchers
|
|
end
|
|
|
|
return M
|