Compare commits

...

3 Commits

Author SHA1 Message Date
Guilherme Soares d4bc55ca25
Merge 9fd9d87880 into 60cf258a9a 2024-11-10 16:24:31 +00:00
Folke Lemaitre 60cf258a9a
fix(docs): always update helptags for local plugins 2024-11-10 07:28:51 +01:00
Guilherme Soares 9fd9d87880 feat(util): add more handlers to util.open 2024-10-21 18:58:11 +01:00
2 changed files with 18 additions and 10 deletions

View File

@ -87,7 +87,7 @@ M.build = {
M.docs = { M.docs = {
skip = function(plugin) skip = function(plugin)
return not plugin._.dirty return not plugin._.is_local and not plugin._.dirty
end, end,
run = function(self) run = function(self)
local docs = self.plugin.dir .. "/doc" local docs = self.plugin.dir .. "/doc"

View File

@ -29,18 +29,26 @@ function M.open(uri, opts)
local cmd local cmd
if not opts.system and 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("mac") == 1 then
cmd = { "explorer", uri }
elseif vim.fn.has("macunix") == 1 then
cmd = { "open", uri } cmd = { "open", uri }
elseif vim.fn.has("win32") == 1 then
if vim.fn.executable("rundll32") == 1 then
cmd = { "rundll32", "url.dll,FileProtocolHandler", uri }
else else
if vim.fn.executable("xdg-open") == 1 then vim.notify("rundll32 not found", vim.log.levels.ERROR)
return
end
elseif vim.fn.executable("xdg-open") == 1 then
cmd = { "xdg-open", uri } cmd = { "xdg-open", uri }
elseif vim.fn.executable("wslview") == 1 then elseif vim.fn.executable("wslview") == 1 then
cmd = { "wslview", uri } cmd = { "wslview", uri }
elseif vim.fn.executable("explorer.exe") == 1 then
cmd = { "explorer.exe", uri }
elseif vim.fn.executable("lemonade") == 1 then
cmd = { "lemonade", "open", uri }
else else
cmd = { "open", uri } vim.notify("no handler found (tried: wslview, explorer.exe, xdg-open, lemonade)", vim.log.levels.ERROR)
end return
end end
local ret = vim.fn.jobstart(cmd, { detach = true }) local ret = vim.fn.jobstart(cmd, { detach = true })