Skip to content

Instantly share code, notes, and snippets.

@hellwolf
Created June 6, 2022 09:58
Show Gist options
  • Save hellwolf/af459cc214415e9c3efc92b9eb78ad72 to your computer and use it in GitHub Desktop.
Save hellwolf/af459cc214415e9c3efc92b9eb78ad72 to your computer and use it in GitHub Desktop.
emacs browse-url for wsl
(setq
browse-url-generic-program "/bin/sh"
browse-url-generic-args '("-c" "wslviewpath $@" "--")
browse-url-browser-function #'browse-url-generic)
#!/bin/sh
if [ -z "${1#file://*}" ];then
#echo "file _$@_" > ~/tmp/test.txt
wslview "$(wslpath -w "$(echo $1 | sed -E 's|^file://||')")"
else
#echo "other _$@_" > ~/tmp/test.txt
wslview "$1"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment