fix: split if nvim-tree is the only window

also fix resize when trying to open but the buffer exists
This commit is contained in:
kiyan
2022-03-09 22:29:26 +01:00
parent 471afc13fe
commit 5af3cfa170

View File

@@ -204,7 +204,7 @@ function M.fn(mode, filename)
end
local cmd
if do_split then
if do_split or #api.nvim_list_wins() == 1 then
cmd = string.format("%ssplit ", vertical and "vertical " or "")
else
cmd = "edit "
@@ -213,9 +213,10 @@ function M.fn(mode, filename)
cmd = cmd .. vim.fn.fnameescape(filename)
api.nvim_set_current_win(target_winid)
pcall(vim.cmd, cmd)
if M.resize_window then
view.resize()
end
end
if M.resize_window then
view.resize()
end
if mode == "preview" then