mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 10:30:05 +08:00
perf(neo-tree): add force_change_cwd opt
This commit is contained in:
parent
a7194fbafa
commit
0166de7597
@ -191,14 +191,20 @@ handle_reveal = function(args, state)
|
||||
elseif not utils.is_subpath(cwd, path) then
|
||||
-- force was not specified, so we need to ask the user
|
||||
cwd, _ = utils.split_path(path)
|
||||
inputs.confirm("File not in cwd. Change cwd to " .. cwd .. "?", function(response)
|
||||
if response == true then
|
||||
args.dir = cwd
|
||||
else
|
||||
args.reveal_file = nil
|
||||
end
|
||||
local nt = require("neo-tree")
|
||||
if nt.config.force_change_cwd then
|
||||
args.dir = cwd
|
||||
do_show_or_focus(args, state, true)
|
||||
end)
|
||||
else
|
||||
inputs.confirm("File not in cwd. Change cwd to " .. cwd .. "?", function(response)
|
||||
if response == true then
|
||||
args.dir = cwd
|
||||
else
|
||||
args.reveal_file = nil
|
||||
end
|
||||
do_show_or_focus(args, state, true)
|
||||
end)
|
||||
end
|
||||
return
|
||||
else
|
||||
do_show_or_focus(args, state, true)
|
||||
|
@ -542,14 +542,20 @@ M.reveal_current_file = function(source_name, callback, force_cwd)
|
||||
end
|
||||
elseif not utils.is_subpath(cwd, path) then
|
||||
cwd, _ = utils.split_path(path)
|
||||
inputs.confirm("File not in cwd. Change cwd to " .. cwd .. "?", function(response)
|
||||
if response == true then
|
||||
state.path = cwd
|
||||
M.focus(source_name, path, callback)
|
||||
else
|
||||
M.focus(source_name, nil, callback)
|
||||
end
|
||||
end)
|
||||
local nt = require("neo-tree")
|
||||
if nt.config.force_change_cwd then
|
||||
state.path = cwd
|
||||
M.focus(source_name, path, callback)
|
||||
else
|
||||
inputs.confirm("File not in cwd. Change cwd to " .. cwd .. "?", function(response)
|
||||
if response == true then
|
||||
state.path = cwd
|
||||
M.focus(source_name, path, callback)
|
||||
else
|
||||
M.focus(source_name, nil, callback)
|
||||
end
|
||||
end)
|
||||
end
|
||||
return
|
||||
end
|
||||
if path then
|
||||
|
@ -3,6 +3,7 @@ require('neo-tree').setup({
|
||||
close_if_last_window = true, -- Close Neo-tree if it is the last window left in the tab
|
||||
popup_border_style = 'rounded',
|
||||
enable_git_status = true,
|
||||
force_change_cwd = true, -- force change cmd when switch project
|
||||
enable_diagnostics = true,
|
||||
open_files_do_not_replace_types = { 'terminal', 'trouble', 'qf' }, -- when opening files, do not use windows containing these filetypes or buftypes
|
||||
sort_case_insensitive = false, -- used when sorting files and directories in the tree
|
||||
|
Loading…
Reference in New Issue
Block a user