mirror of https://github.com/folke/lazy.nvim.git
feat(ui): make brower configurable. Fixes #248
This commit is contained in:
parent
730bb84364
commit
679d85c9ff
|
@ -345,6 +345,9 @@ return {
|
||||||
"‒",
|
"‒",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
-- leave nil, to automatically select a browser depending on your OS.
|
||||||
|
-- If you want to use a specific browser, you can define it here
|
||||||
|
browser = nil, ---@type string?
|
||||||
throttle = 20, -- how frequently should the ui process render events
|
throttle = 20, -- how frequently should the ui process render events
|
||||||
custom_keys = {
|
custom_keys = {
|
||||||
-- you can define custom key maps here.
|
-- you can define custom key maps here.
|
||||||
|
|
|
@ -59,6 +59,9 @@ M.defaults = {
|
||||||
"‒",
|
"‒",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
-- leave nil, to automatically select a browser depending on your OS.
|
||||||
|
-- If you want to use a specific browser, you can define it here
|
||||||
|
browser = nil, ---@type string?
|
||||||
throttle = 20, -- how frequently should the ui process render events
|
throttle = 20, -- how frequently should the ui process render events
|
||||||
custom_keys = {
|
custom_keys = {
|
||||||
-- you can define custom key maps here.
|
-- you can define custom key maps here.
|
||||||
|
|
|
@ -18,14 +18,20 @@ function M.open(uri)
|
||||||
if M.file_exists(uri) then
|
if M.file_exists(uri) then
|
||||||
return M.float({ win_opts = { style = "" }, file = uri })
|
return M.float({ win_opts = { style = "" }, file = uri })
|
||||||
end
|
end
|
||||||
|
local Config = require("lazy.core.config")
|
||||||
local cmd
|
local cmd
|
||||||
if vim.fn.has("win32") == 1 then
|
if Config.options.ui.browser then
|
||||||
|
cmd = { Config.options.ui.browser, uri }
|
||||||
|
elseif vim.fn.has("win32") == 1 then
|
||||||
cmd = { "explorer", uri }
|
cmd = { "explorer", uri }
|
||||||
-- cmd = { 'cmd.exe', '/c', 'start', '""', uri }
|
|
||||||
elseif vim.fn.has("macunix") == 1 then
|
elseif vim.fn.has("macunix") == 1 then
|
||||||
cmd = { "open", uri }
|
cmd = { "open", uri }
|
||||||
else
|
else
|
||||||
cmd = { "xdg-open", uri }
|
if vim.fn.executable("xdg-open") then
|
||||||
|
cmd = { "xdg-open", uri }
|
||||||
|
else
|
||||||
|
cmd = { "open", uri }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local ret = vim.fn.jobstart(cmd, { detach = true })
|
local ret = vim.fn.jobstart(cmd, { detach = true })
|
||||||
|
|
Loading…
Reference in New Issue