Skip to content

Commit 061a05b

Browse files
baahrensalex-courtis
baahrens
andauthored
fix(#2132): focus file after rename and paste (#2151)
* feat: Focus file after creation * feat: Focus file after pasting --------- Co-authored-by: Alexander Courtis <[email protected]>
1 parent 71e1c5b commit 061a05b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lua/nvim-tree/actions/fs/copy-paste.lua

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ local core = require "nvim-tree.core"
55
local events = require "nvim-tree.events"
66
local notify = require "nvim-tree.notify"
77

8+
local find_file = require("nvim-tree.actions.finders.find-file").fn
9+
810
local M = {}
911

1012
local clipboard = {
@@ -91,6 +93,8 @@ local function do_single_paste(source, dest, action_type, action_fn)
9193
notify.error("Could not " .. action_type .. " " .. source .. " - " .. (errmsg or "???"))
9294
return false, errmsg
9395
end
96+
97+
find_file(utils.path_remove_trailing(dest))
9498
end
9599

96100
if dest_stats then

lua/nvim-tree/actions/fs/rename-file.lua

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ local utils = require "nvim-tree.utils"
33
local events = require "nvim-tree.events"
44
local notify = require "nvim-tree.notify"
55

6+
local find_file = require("nvim-tree.actions.finders.find-file").fn
7+
68
local M = {}
79

810
local ALLOWED_MODIFIERS = {
@@ -84,6 +86,8 @@ function M.fn(default_modifier)
8486
if M.enable_reload then
8587
require("nvim-tree.actions.reloaders.reloaders").reload_explorer()
8688
end
89+
90+
find_file(utils.path_remove_trailing(new_file_path))
8791
end)
8892
end
8993
end

0 commit comments

Comments
 (0)