Skip to content

Commit 573ca57

Browse files
committed
feat(gx): support Windows and WSL for browser opening
- Allows opening the browser in Windows environments. - Supports Microsoft Edge when running in WSL. - Ensures correct command execution based on the environment.
1 parent db08f71 commit 573ca57

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lua/plugins/gx.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,10 @@ return {
133133

134134
-- We're probably running in a Windows environment or in a WSL environment
135135
if vim.fn.env_get("USE_BROWSER") == "edge" then
136+
local is_wsl = os.getenv("WSL_DISTRO_NAME") ~= nil
137+
local is_windows = vim.fn.has("win32") == 1 and not is_wsl
136138
-- Needs full path when running on CommandPrompt
137-
local browser_app = vim.fn.has("win32") and "C:\\Windows\\System32\\cmd.exe" or "cmd.exe"
139+
local browser_app = is_windows and "C:\\Windows\\System32\\cmd.exe" or "cmd.exe"
138140
opts.open_browser_app = browser_app
139141
opts.open_browser_args = { "/C", "start", 'microsoft-edge:"%s"' }
140142
end

0 commit comments

Comments
 (0)