From 0883f6db01c3db616290de76b38e177965df1255 Mon Sep 17 00:00:00 2001 From: Lucian Ion Date: Sat, 26 Oct 2024 19:51:17 -0600 Subject: [PATCH] fix(#2969): After a rename, the node loses selection --- lua/nvim-tree/actions/fs/rename-file.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/nvim-tree/actions/fs/rename-file.lua b/lua/nvim-tree/actions/fs/rename-file.lua index da1ca001167..efe40a34dd2 100644 --- a/lua/nvim-tree/actions/fs/rename-file.lua +++ b/lua/nvim-tree/actions/fs/rename-file.lua @@ -161,12 +161,14 @@ function M.fn(default_modifier) return end - M.rename(node, prepend .. new_file_path .. append) + local full_new_path = prepend .. new_file_path .. append + + M.rename(node, full_new_path) if not M.config.filesystem_watchers.enable then explorer:reload_explorer() end - find_file(utils.path_remove_trailing(new_file_path)) + find_file(utils.path_remove_trailing(full_new_path)) end) end end