fix(#2132): focus file after rename and paste (#2151)

* feat: Focus file after creation

* feat: Focus file after pasting

---------

Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
baahrens 2023-04-23 05:59:16 +02:00 committed by GitHub
parent 71e1c5bdc2
commit 061a05bfd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -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 = {
@ -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

View File

@ -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 = {
@ -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