-
-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running MarkdownPreview throws uncaught exception: Error: spawn xdg-open ENOENT in WSL 2 with terminal Vim #199
Comments
I have update README and improve the error message |
It doesn't work well for me now in WSL2.
What can I do to solve it? |
I didn't change my ip:port and it works here with an address of I would try disabling Windows defender / firewall to see if that fixes anything. |
hahahahahhahaha... I have solved it! I have execute Add @iamcco 可以把这加文档里啦,老哥。换windows可搞死我了,wsl(我死了):joy: |
@mrbeardad README 有链接链到这里了 |
I just wanted to mention, using WSL2 (Arch if that makes a difference) the above methods did not work for me. What DID work was to install wslu and set |
There is my solution: |
@ndaman it works on my debian wsl2, mostly perfect except that my terminal window will go blank after i start preview, then it gradually reloads everything when i make some mouse or keyboard movement. no big deal but kinda annoying. |
@XeonChow it can be solved by using wsl-open instead of If you prefer a general vim setting to a WSL specified one, use this trick without modifying sudo rm $(which xdg-open)
sudo ln -s $(which wsl-open) /usr/local/bin/xdg-open Just run |
@qingbyin |
when i tap ':MarkdownPreview' on WSL1 vim. my chrome on windows10 will open with site 'http://127.0.0.1:9410/markdown/16300587241?L2hvbWUvemloYW94aW5nL3NoaW55X3Byb2plY3RzL1N3aW1NYXAvd3d3L3Rlc3QubWQmL2hvbWUvemloYW94aW5nLy52aW0vYnVuZGxlL21hdGhqYXgtc3VwcG9ydC1mb3ItbWtkcC9tYXRoamF4LXN0YXRpYy8=' |
when i tap ':MarkdownPreview' on WSL1 vim. my chrome on windows10 will open with site 'http://127.0.0.1:9410/markdown/16300587241?L2hvbWUvemloYW94aW5nL3NoaW55X3Byb2plY3RzL1N3aW1NYXAvd3d3L3Rlc3QubWQmL2hvbWUvemloYW94aW5nLy52aW0vYnVuZGxlL21hdGhqYXgtc3VwcG9ydC1mb3ItbWtkcC9tYXRoamF4LXN0YXRpYy8=' |
when i tap ':MarkdownPreview' on WSL1 vim. my edge on windows10 will open with site 'http://127.0.0.1:9410/markdown/16300587241?L2hvbWUvemloYW94aW5nL3NoaW55X3Byb2plY3RzL1N3aW1NYXAvd3d3L3Rlc3QubWQmL2hvbWUvemloYW94aW5nLy52aW0vYnVuZGxlL21hdGhqYXgtc3VwcG9ydC1mb3ItbWtkcC9tYXRoamF4LXN0YXRpYy8=' |
If anyone is looking for a solution that doesn't require installing I've been doing this on WSL 2 for months and running |
I use this plugin in WSL1, ubuntu. Every time I input I would like to ask how to make the preview page show automatically? Thank you very much. |
@XeonChow Another way to solve is to This is working on WSL2(Ubuntu 22.04) on a x64 machine. function! MdpOpenPreview(url) abort
let l:mdp_browser = '/mnt/c/Program\ Files/Google/Chrome/Application/chrome.exe'
let l:mdp_browser_opts = '--new-window'
if !filereadable(substitute(l:mdp_browser, '\\ ', ' ', 'g'))
let l:mdp_browser = '/mnt/c/Program\ Files\ \(x86\)/Microsoft/Edge/Application/msedge.exe'
let l:mdp_browser_opts = '--new-window'
endif
execute join(['silent! !', l:mdp_browser, l:mdp_browser_opts, a:url])
redraw!
endfunction
let g:mkdp_browserfunc = 'MdpOpenPreview' |
@johnsonkee I guess your settings is broken. When I was testing, I encountered this as well. And it turned out that I made mistakes. Furthermore, even if |
You solve my problem! Thank you |
Hi,
I'm using Vim 8.1 inside of Ubuntu 20.04 running in WSL 2 using the latest pull from master at the time of writing this comment.
Inside of WSL 1 this plugin worked great. It would open my default browser when running that command without having to do anything custom.
But now within WSL 2 it fails to run
:MarkdownPreview
with:Turns out you need to install
sudo apt-get install -y xdg-utils
, and then things work fine. Although there is a ~5 second delay before it opens where as with WSL 1 it was instant.Might be worth adding something to the docs or wiki for such an issue in a WSL section.
The text was updated successfully, but these errors were encountered: