refactor(git): share OpenOpts type between status_view open and toggle
This commit is contained in:
@@ -662,7 +662,10 @@ local function set_keymaps(bufnr, placement)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param opts? { placement: ow.Git.StatusView.Placement? }
|
---@class ow.Git.StatusView.OpenOpts
|
||||||
|
---@field placement ow.Git.StatusView.Placement?
|
||||||
|
|
||||||
|
---@param opts? ow.Git.StatusView.OpenOpts
|
||||||
function M.open(opts)
|
function M.open(opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
local placement = opts.placement or "sidebar"
|
local placement = opts.placement or "sidebar"
|
||||||
@@ -765,13 +768,14 @@ function M.read_uri(buf)
|
|||||||
r:refresh()
|
r:refresh()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.toggle()
|
---@param opts? ow.Git.StatusView.OpenOpts
|
||||||
|
function M.toggle(opts)
|
||||||
local existing = find_view()
|
local existing = find_view()
|
||||||
if existing then
|
if existing then
|
||||||
vim.api.nvim_win_close(existing, false)
|
vim.api.nvim_win_close(existing, false)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
M.open({ placement = "sidebar" })
|
M.open(opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
Reference in New Issue
Block a user