Skip to content

Commit

Permalink
feat(util): option to force system app for util.open
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Mar 22, 2024
1 parent 8134f2a commit 66466a2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lua/lazy/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ function M.wo(win, k, v)
end
end

function M.open(uri)
if M.file_exists(uri) then
---@param opts? {system?:boolean}
function M.open(uri, opts)
opts = opts or {}
if not opts.system and M.file_exists(uri) then
return M.float({ style = "", file = uri })
end
local Config = require("lazy.core.config")
local cmd
if Config.options.ui.browser then
if not opts.system and Config.options.ui.browser then
cmd = { Config.options.ui.browser, uri }
elseif vim.fn.has("win32") == 1 then
cmd = { "explorer", uri }
Expand Down

0 comments on commit 66466a2

Please sign in to comment.