refactor: easier to pass window options for floats

This commit is contained in:
Folke Lemaitre 2023-01-05 16:52:02 +01:00
parent d3b0d3e851
commit 13af39b83e
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
4 changed files with 62 additions and 49 deletions

View file

@ -25,13 +25,17 @@ local M = {}
---@type LazyView
M.view = nil
function M.visible()
return M.view and M.view.win and vim.api.nvim_win_is_valid(M.view.win)
end
---@param mode? string
function M.show(mode)
if Config.headless then
return
end
M.view = (M.view and M.view.win and vim.api.nvim_win_is_valid(M.view.win)) and M.view or M.create()
M.view = M.visible() and M.view or M.create()
if mode then
M.view.state.mode = mode
end