feat: add cwd arg to open_replacing_current_buffer: retain existing valid buffer check

This commit is contained in:
Alexander Courtis 2022-06-20 09:52:56 +10:00
parent f262236107
commit 6548287e8b

View File

@ -102,13 +102,12 @@ function M.open_replacing_current_buffer(cwd)
local buf = api.nvim_get_current_buf()
local bufname = api.nvim_buf_get_name(buf)
if cwd == "" or cwd == nil then
if bufname ~= "" and vim.loop.fs_stat(bufname) ~= nil then
cwd = vim.fn.fnamemodify(bufname, ":p:h")
else
if bufname == "" or vim.loop.fs_stat(bufname) == nil then
return
end
if cwd == "" or cwd == nil then
cwd = vim.fn.fnamemodify(bufname, ":p:h")
end
if not core.get_explorer() or cwd ~= core.get_cwd() then