Skip to content

feat: Focus file after rename and paste #2151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lua/nvim-tree/actions/fs/copy-paste.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ local core = require "nvim-tree.core"
local events = require "nvim-tree.events"
local notify = require "nvim-tree.notify"

local find_file = require("nvim-tree.actions.finders.find-file").fn

local M = {}

local clipboard = {
Expand Down Expand Up @@ -91,6 +93,8 @@ local function do_single_paste(source, dest, action_type, action_fn)
notify.error("Could not " .. action_type .. " " .. source .. " - " .. (errmsg or "???"))
return false, errmsg
end

find_file(utils.path_remove_trailing(dest))
end

if dest_stats then
Expand Down
4 changes: 4 additions & 0 deletions lua/nvim-tree/actions/fs/rename-file.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ local utils = require "nvim-tree.utils"
local events = require "nvim-tree.events"
local notify = require "nvim-tree.notify"

local find_file = require("nvim-tree.actions.finders.find-file").fn

local M = {}

local ALLOWED_MODIFIERS = {
Expand Down Expand Up @@ -84,6 +86,8 @@ function M.fn(default_modifier)
if M.enable_reload then
require("nvim-tree.actions.reloaders.reloaders").reload_explorer()
end

find_file(utils.path_remove_trailing(new_file_path))
end)
end
end
Expand Down