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:
@@ -204,7 +204,7 @@ function M.fn(mode, filename)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local cmd
|
local cmd
|
||||||
if do_split then
|
if do_split or #api.nvim_list_wins() == 1 then
|
||||||
cmd = string.format("%ssplit ", vertical and "vertical " or "")
|
cmd = string.format("%ssplit ", vertical and "vertical " or "")
|
||||||
else
|
else
|
||||||
cmd = "edit "
|
cmd = "edit "
|
||||||
@@ -213,10 +213,11 @@ function M.fn(mode, filename)
|
|||||||
cmd = cmd .. vim.fn.fnameescape(filename)
|
cmd = cmd .. vim.fn.fnameescape(filename)
|
||||||
api.nvim_set_current_win(target_winid)
|
api.nvim_set_current_win(target_winid)
|
||||||
pcall(vim.cmd, cmd)
|
pcall(vim.cmd, cmd)
|
||||||
|
end
|
||||||
|
|
||||||
if M.resize_window then
|
if M.resize_window then
|
||||||
view.resize()
|
view.resize()
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if mode == "preview" then
|
if mode == "preview" then
|
||||||
view.focus()
|
view.focus()
|
||||||
|
|||||||
Reference in New Issue
Block a user