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