From 2507c1e2f053068c5edee00472fd5279cb803393 Mon Sep 17 00:00:00 2001 From: ec965 <22567131+ec965@users.noreply.github.com> Date: Thu, 6 Oct 2022 22:15:21 -0700 Subject: [PATCH] Add wsl support --- lua/openingh/utils.lua | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lua/openingh/utils.lua b/lua/openingh/utils.lua index 38191ad..7d68235 100644 --- a/lua/openingh/utils.lua +++ b/lua/openingh/utils.lua @@ -80,22 +80,19 @@ end -- opens a url in the correct OS function M.open_url(url) - local os = vim.loop.os_uname().sysname - if os == "Darwin" then + if vim.fn.has("mac") then io.popen("open " .. url) return true - end - - if os == "Windows" then + elseif vim.fn.has("win64") or vim.fn.has("win32") then io.popen("start " .. url) return true - end - - if os == "Linux" then + elseif vim.fn.has("wsl") then + io.popen("explorer.exe " .. url) + elseif vim.fn.has("linux") then io.popen("xdg-open " .. url) return true end - + return false end