mirror of https://github.com/folke/lazy.nvim.git
feat(util): option to force system app for util.open
This commit is contained in:
parent
8134f2ac04
commit
66466a2594
|
@ -19,13 +19,15 @@ function M.wo(win, k, v)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.open(uri)
|
---@param opts? {system?:boolean}
|
||||||
if M.file_exists(uri) then
|
function M.open(uri, opts)
|
||||||
|
opts = opts or {}
|
||||||
|
if not opts.system and M.file_exists(uri) then
|
||||||
return M.float({ style = "", file = uri })
|
return M.float({ style = "", file = uri })
|
||||||
end
|
end
|
||||||
local Config = require("lazy.core.config")
|
local Config = require("lazy.core.config")
|
||||||
local cmd
|
local cmd
|
||||||
if Config.options.ui.browser then
|
if not opts.system and Config.options.ui.browser then
|
||||||
cmd = { Config.options.ui.browser, uri }
|
cmd = { Config.options.ui.browser, uri }
|
||||||
elseif vim.fn.has("win32") == 1 then
|
elseif vim.fn.has("win32") == 1 then
|
||||||
cmd = { "explorer", uri }
|
cmd = { "explorer", uri }
|
||||||
|
|
Loading…
Reference in New Issue