fix(#1615): focus created file when command line prompt requires confirmation (#1622)

* fix(#1615): focus created file when command line prompt requires confirmation

* fix(#1615): focus created file when command line prompt requires confirmation
This commit is contained in:
Alexander Courtis
2022-10-08 14:26:31 +11:00
committed by GitHub
parent c5536db0b7
commit be2b4f58e6
2 changed files with 7 additions and 6 deletions

View File

@@ -4,6 +4,7 @@ local utils = require "nvim-tree.utils"
local events = require "nvim-tree.events"
local lib = require "nvim-tree.lib"
local core = require "nvim-tree.core"
local watch = require "nvim-tree.explorer.watch"
local M = {}
@@ -107,11 +108,11 @@ function M.fn(node)
events._dispatch_folder_created(new_file_path)
if M.enable_reload then
require("nvim-tree.actions.reloaders.reloaders").reload_explorer()
else
-- synchronous call required so that we may focus the file now
watch.refresh_path(node.absolute_path)
end
-- INFO: defer needed when reload is automatic (watchers)
vim.defer_fn(function()
utils.focus_file(utils.path_remove_trailing(new_file_path))
end, 150)
utils.focus_file(utils.path_remove_trailing(new_file_path))
end)
end