File tree 3 files changed +21
-3
lines changed
3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -2066,9 +2066,15 @@ marks.bulk.delete() *nvim-tree-api.marks.bulk.delete()*
2066
2066
marks.bulk.trash() *nvim-tree-api.marks.bulk.trash()*
2067
2067
Trash all marked. Optionally prompts.
2068
2068
2069
- marks.bulk.move() *nvim-tree-api.marks.bulk.move()*
2069
+ marks.bulk.move({opts} ) *nvim-tree-api.marks.bulk.move()*
2070
2070
Prompts for a directory to move all marked nodes into.
2071
2071
2072
+ Parameters: ~
2073
+ • {opts} (table) optional parameters
2074
+
2075
+ Options: ~
2076
+ • {prompt} (fun(absolute_path: string): string) takes the absolute path of the node under the cursor, returns the absolute path for the prompt
2077
+
2072
2078
marks.navigate.next() *nvim-tree-api.marks.navigate.next()*
2073
2079
Navigate to the next marked node, wraps.
2074
2080
Opens files as per | nvim-tree.actions.open_file |
Original file line number Diff line number Diff line change @@ -238,6 +238,10 @@ Api.marks.toggle = wrap_node(marks.toggle_mark)
238
238
Api .marks .clear = wrap (marks .clear_marks )
239
239
Api .marks .bulk .delete = wrap (marks_bulk_delete .bulk_delete )
240
240
Api .marks .bulk .trash = wrap (marks_bulk_trash .bulk_trash )
241
+
242
+ --- @class ApiTreeBulkMoveOpts
243
+ --- @field prompt fun ( absolute_path : string ): string
244
+
241
245
Api .marks .bulk .move = wrap (marks_bulk_move .bulk_move )
242
246
Api .marks .navigate .next = wrap (marks_navigation .next )
243
247
Api .marks .navigate .prev = wrap (marks_navigation .prev )
Original file line number Diff line number Diff line change @@ -3,20 +3,28 @@ local core = require "nvim-tree.core"
3
3
local utils = require " nvim-tree.utils"
4
4
local rename_file = require " nvim-tree.actions.fs.rename-file"
5
5
local notify = require " nvim-tree.notify"
6
+ local lib = require " nvim-tree.lib"
6
7
7
8
local M = {
8
9
config = {},
9
10
}
10
11
11
- function M .bulk_move ()
12
+ --- @param opts ApiTreeBulkMoveOpts
13
+ function M .bulk_move (opts )
12
14
if # marks .get_marks () == 0 then
13
15
notify .warn " No bookmarks to move."
14
16
return
15
17
end
16
18
19
+ local defaultPrompt = core .get_cwd ()
20
+
21
+ if type (opts ) ~= " table" and opts .prompt and type (opts .prompt ) == " function" then
22
+ defaultPrompt = opts .prompt (lib .get_node_at_cursor ().absolute_path )
23
+ end
24
+
17
25
local input_opts = {
18
26
prompt = " Move to: " ,
19
- default = core . get_cwd () ,
27
+ default = defaultPrompt ,
20
28
completion = " dir" ,
21
29
}
22
30
You can’t perform that action at this time.
0 commit comments