@@ -222,21 +222,29 @@ Api.fs.copy.absolute_path = wrap_node(wrap_explorer_member("clipboard", "copy_ab
222
222
Api .fs .copy .filename = wrap_node (wrap_explorer_member (" clipboard" , " copy_filename" ))
223
223
Api .fs .copy .basename = wrap_node (wrap_explorer_member (" clipboard" , " copy_basename" ))
224
224
Api .fs .copy .relative_path = wrap_node (wrap_explorer_member (" clipboard" , " copy_path" ))
225
+ ---
226
+ --- @class NodeEditOpts
227
+ --- @field quit_on_open boolean | nil default false
225
228
226
229
--- @param mode string
227
230
--- @param node Node
228
- local function edit (mode , node )
231
+ --- @param edit_opts NodeEditOpts ?
232
+ local function edit (mode , node , edit_opts )
229
233
local file_link = node :as (FileLinkNode )
230
234
local path = file_link and file_link .link_to or node .absolute_path
231
235
actions .node .open_file .fn (mode , path )
236
+
237
+ if edit_opts and edit_opts .quit_on_open then
238
+ view .close ()
239
+ end
232
240
end
233
241
234
242
--- @param mode string
235
243
--- @param toggle_group boolean ?
236
- --- @return fun ( node : Node )
244
+ --- @return fun ( node : Node , edit_opts : NodeEditOpts ? )
237
245
local function open_or_expand_or_dir_up (mode , toggle_group )
238
246
--- @param node Node
239
- return function (node )
247
+ return function (node , edit_opts )
240
248
local root = node :as (RootNode )
241
249
local dir = node :as (DirectoryNode )
242
250
@@ -245,7 +253,7 @@ local function open_or_expand_or_dir_up(mode, toggle_group)
245
253
elseif dir then
246
254
dir :expand_or_collapse (toggle_group )
247
255
elseif not toggle_group then
248
- edit (mode , node )
256
+ edit (mode , node , edit_opts )
249
257
end
250
258
end
251
259
end
0 commit comments