Skip to content

Commit f86e871

Browse files
authored
feat(filesystem): focus new node after copy / move in filesystem (#1228)
closes #1214
1 parent dcd32cd commit f86e871

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lua/neo-tree/sources/filesystem/commands.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ M.clear_filter = function(state)
2929
end
3030

3131
M.copy = function(state)
32-
cc.copy(state, utils.wrap(refresh, state))
32+
cc.copy(state, utils.wrap(fs.focus_destination_children, state))
3333
end
3434

3535
---Marks node as copied, so that it can be pasted somewhere else.
@@ -51,7 +51,7 @@ M.cut_to_clipboard_visual = function(state, selected_nodes)
5151
end
5252

5353
M.move = function(state)
54-
cc.move(state, utils.wrap(refresh, state))
54+
cc.move(state, utils.wrap(fs.focus_destination_children, state))
5555
end
5656

5757
---Pastes all items from the clipboard to the current directory.

lua/neo-tree/sources/filesystem/init.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,10 @@ M.show_new_children = function(state, node_or_path)
254254
M.navigate(state, nil, node_or_path)
255255
end
256256

257+
M.focus_destination_children = function(state, move_from, destination)
258+
return M.show_new_children(state, destination)
259+
end
260+
257261
---Configures the plugin, should be called before the plugin is used.
258262
---@param config table Configuration table containing any keys that the user
259263
--wants to change from the defaults. May be empty to accept default values.

0 commit comments

Comments
 (0)