Skip to content

Commit 00e15ca

Browse files
committed
feat(nvim-tree#2395): changes bulk_move to allow users to add custom logic to the default path resolution; adds bulk_move_get_default_path option
1 parent d52fdeb commit 00e15ca

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

lua/nvim-tree.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
350350
reload_on_bufenter = false,
351351
respect_buf_cwd = false,
352352
select_prompts = false,
353+
bulk_move_get_default_path = nil,
353354
sort = {
354355
sorter = "name",
355356
folders_first = true,
@@ -608,6 +609,7 @@ local ACCEPTED_TYPES = {
608609
sort = {
609610
sorter = { "function", "string" },
610611
},
612+
bulk_move_get_default_path = { "function" },
611613
view = {
612614
width = {
613615
"string",

lua/nvim-tree/marks/bulk-move.lua

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ local rename_file = require "nvim-tree.actions.fs.rename-file"
55
local notify = require "nvim-tree.notify"
66

77
local M = {
8-
config = {},
8+
config = {
9+
bulk_move_get_default_path = core.get_cwd
10+
},
911
}
1012

1113
function M.bulk_move()
@@ -14,9 +16,11 @@ function M.bulk_move()
1416
return
1517
end
1618

19+
local defaultPath = M.config.bulk_move_get_default_path()
20+
1721
local input_opts = {
1822
prompt = "Move to: ",
19-
default = core.get_cwd(),
23+
default = defaultPath,
2024
completion = "dir",
2125
}
2226

@@ -47,6 +51,9 @@ end
4751

4852
function M.setup(opts)
4953
M.config.filesystem_watchers = opts.filesystem_watchers
54+
if opts.bulk_move_get_default_path ~= nil then
55+
M.config.bulk_move_get_default_path = opts.bulk_move_get_default_path
56+
end
5057
end
5158

5259
return M

0 commit comments

Comments
 (0)