File tree Expand file tree Collapse file tree 3 files changed +21
-3
lines changed
Expand file tree Collapse file tree 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()*
20662066marks.bulk.trash() *nvim-tree-api.marks.bulk.trash()*
20672067 Trash all marked. Optionally prompts.
20682068
2069- marks.bulk.move() *nvim-tree-api.marks.bulk.move()*
2069+ marks.bulk.move({opts} ) *nvim-tree-api.marks.bulk.move()*
20702070 Prompts for a directory to move all marked nodes into.
20712071
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+
20722078marks.navigate.next() *nvim-tree-api.marks.navigate.next()*
20732079 Navigate to the next marked node, wraps.
20742080 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)
238238Api .marks .clear = wrap (marks .clear_marks )
239239Api .marks .bulk .delete = wrap (marks_bulk_delete .bulk_delete )
240240Api .marks .bulk .trash = wrap (marks_bulk_trash .bulk_trash )
241+
242+ --- @class ApiTreeBulkMoveOpts
243+ --- @field prompt fun ( absolute_path : string ): string
244+
241245Api .marks .bulk .move = wrap (marks_bulk_move .bulk_move )
242246Api .marks .navigate .next = wrap (marks_navigation .next )
243247Api .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"
33local utils = require " nvim-tree.utils"
44local rename_file = require " nvim-tree.actions.fs.rename-file"
55local notify = require " nvim-tree.notify"
6+ local lib = require " nvim-tree.lib"
67
78local M = {
89 config = {},
910}
1011
11- function M .bulk_move ()
12+ --- @param opts ApiTreeBulkMoveOpts
13+ function M .bulk_move (opts )
1214 if # marks .get_marks () == 0 then
1315 notify .warn " No bookmarks to move."
1416 return
1517 end
1618
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+
1725 local input_opts = {
1826 prompt = " Move to: " ,
19- default = core . get_cwd () ,
27+ default = defaultPrompt ,
2028 completion = " dir" ,
2129 }
2230
You can’t perform that action at this time.
0 commit comments