feat: util method to open a float

This commit is contained in:
Folke Lemaitre 2022-12-24 11:26:29 +01:00
parent b34e25873a
commit 7c2eb15444
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 9 additions and 0 deletions

View File

@ -5,6 +5,15 @@ function M.file_exists(file)
return vim.loop.fs_stat(file) ~= nil return vim.loop.fs_stat(file) ~= nil
end end
---@param opts? LazyViewOptions
function M.float(opts)
opts = vim.tbl_deep_extend("force", {
win_opts = { zindex = 60, border = "none" },
margin = { top = 3, left = 2, right = 2 },
}, opts or {})
return require("lazy.view.float")(opts)
end
function M.open(uri) function M.open(uri)
if M.file_exists(uri) then if M.file_exists(uri) then
vim.cmd.split() vim.cmd.split()