Skip to content

Commit

Permalink
feat(esupports.hop): support os_open_link for WSL (#963)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShangjinTang committed Jul 7, 2023
1 parent 95ec60f commit 628ba9f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions lua/neorg/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ neorg.configuration.os_info = (function()
elseif os == "darwin" then
return "mac"
elseif os == "linux" then
local f = io.open('/proc/version', 'r')
if f ~= nil then
local version = f:read('*all')
f:close()
if version:find('microsoft') then
return "wsl"
end
end
return "linux"
end
end)()
Expand Down
2 changes: 1 addition & 1 deletion lua/neorg/external/helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ neorg.utils = {
return ""
end

if current_os == "linux" or current_os == "mac" then
if current_os == "linux" or current_os == "mac" or current_os == "wsl" then
return os.getenv("USER") or ""
elseif current_os == "windows" then
return os.getenv("username") or ""
Expand Down
2 changes: 2 additions & 0 deletions lua/neorg/modules/core/esupports/hop/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ module.public = {
o.command = "xdg-open"
elseif neorg.configuration.os_info == "mac" then
o.command = "open"
elseif neorg.configuration.os_info == "wsl" then
o.command = "explorer.exe"
end
o.args = { link_location }
end
Expand Down

0 comments on commit 628ba9f

Please sign in to comment.