junegunn / fzf-git.sh

bash and zsh key bindings for Git objects, powered by fzf
612 stars 53 forks source link

[WSL] Open in browser does not work #40

Open ishaan-kapoor opened 5 months ago

ishaan-kapoor commented 5 months ago

I am using bash with vi mode, in wsl and $BROWSER env variable is set. When I press Ctrl+O, nothing happens, I also treid changing BROWSER to vim and still nothing changed.

junegunn commented 5 months ago

We use open on macOS and xdg-open in other systems to open URLs.

https://github.com/junegunn/fzf-git.sh/blob/23a74efafac72b0a131a9f897a5da2fc9bbc04ee/fzf-git.sh#L107-L110

Maybe xdg-open is not available on your system? Please open a pull request if a different command is required.

ishaan-kapoor commented 5 months ago

I use WSL and I have replaced the switch-case statement with the following line in my local copy

$BROWSER"$url$path"

And the BROWSER environment variable is set to 'explorer.exe microsoft-edge:'.

Note: There is no space between $BROWSER and "$url$path"

Should I identify WSL by uname -r and add a PR?

junegunn commented 5 months ago

A pull request is welcome.

By the way, I'm not sure why you're mentioning $BROWSER. This project doesn't use the variable.

ishaan-kapoor commented 5 months ago

I am using the shell variable $BROWSER (set in my .bashrc) and as per this thread on SO, it is common practice.

junegunn commented 5 months ago

it is common practice

Maybe, but not on this project.

Note: There is no space between $BROWSER and "$url$path"

The examples shown in the linked SO thread all seem to require a space after it to work with arguments. e.g. export BROWSER='/home/username/lynx.sh'. So even if a program implements $BROWSER scheme, it will unlikely work for you as it will run something like $BROWSER "$url".

ishaan-kapoor commented 5 months ago

It's a WSL issue, more specifically, I am using the browser form my native windows, and accessing it through WSL. It seems like this is not a common practice as a minority of users have this configuration and this might create bugs for other WSL users who use browsers installed in WSL itself.