Add wsl support

This commit is contained in:
ec965 2022-10-06 22:15:21 -07:00
parent 14b63af28f
commit 2507c1e2f0

View file

@ -80,22 +80,19 @@ end
-- opens a url in the correct OS -- opens a url in the correct OS
function M.open_url(url) function M.open_url(url)
local os = vim.loop.os_uname().sysname if vim.fn.has("mac") then
if os == "Darwin" then
io.popen("open " .. url) io.popen("open " .. url)
return true return true
end elseif vim.fn.has("win64") or vim.fn.has("win32") then
if os == "Windows" then
io.popen("start " .. url) io.popen("start " .. url)
return true return true
end elseif vim.fn.has("wsl") then
io.popen("explorer.exe " .. url)
if os == "Linux" then elseif vim.fn.has("linux") then
io.popen("xdg-open " .. url) io.popen("xdg-open " .. url)
return true return true
end end
return false return false
end end