feat: add cwd arg to open_replacing_current_buffer: retain existing valid buffer check
This commit is contained in:
parent
f262236107
commit
6548287e8b
@ -102,13 +102,12 @@ function M.open_replacing_current_buffer(cwd)
|
|||||||
|
|
||||||
local buf = api.nvim_get_current_buf()
|
local buf = api.nvim_get_current_buf()
|
||||||
local bufname = api.nvim_buf_get_name(buf)
|
local bufname = api.nvim_buf_get_name(buf)
|
||||||
|
if bufname == "" or vim.loop.fs_stat(bufname) == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if cwd == "" or cwd == nil then
|
if cwd == "" or cwd == nil then
|
||||||
if bufname ~= "" and vim.loop.fs_stat(bufname) ~= nil then
|
cwd = vim.fn.fnamemodify(bufname, ":p:h")
|
||||||
cwd = vim.fn.fnamemodify(bufname, ":p:h")
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if not core.get_explorer() or cwd ~= core.get_cwd() then
|
if not core.get_explorer() or cwd ~= core.get_cwd() then
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user