Re: netrw gx on win7 fails when shellslash is set
- On Wednesday, January 30, 2013 7:32:08 PM UTC-6, Steven Mueller wrote:
> Hi Chip,Something like this will be needed, there is a known issue in :help todo about it:
> I sometimes use gvim on Windows (win7 64-bit). There, I found that netrw's gx (netrw#NetrwBrowseX) on an URL fails to launch the page in my browser when shellslash is set: netrw posts the message "Press <cr> to continue" to the cmd window, but nothing else happens.
> Hacking autoload/netrw.vim to save off shellslash and unset it allows the command to work. The difference seems to be in the type of quoting used by shellescape(): single quotes are used when shellslash is set, but double quotes are used otherwise.
> This patch (also attached in case it gets munged) fixes the issue for me, based off version 140 of netrw as packaged with Vim 7.3 at patchlevel 46:
> --- C:/Program Files (x86)/Vim/vim73/autoload/netrw.vim 2013-01-30 16:11:55.780200900 -0800
> +++ netrw.vim 2013-01-30 17:17:44.890628000 -0800
> @@ -3385,6 +3385,12 @@
> let ret= v:shell_error
> elseif has("win32") || has("win64")
> + " shellslash must be unset so the quotes around the filename/URL end up as
> + " double quotes. Otherwise start and rundll32 get confused by the single
> + " quotes that shellescape produces.
> + let shellslash_keep = &shellslash
> + setlocal noshellslash
> if executable("start")
> " call Decho('exe silent !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1))
> exe 'silent !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)
> @@ -3394,6 +3400,7 @@
> call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74)
> + let &shellslash = shellslash_keep
> call inputsave()|call input("Press <cr> to continue")|call inputrestore()
> let ret= v:shell_error
> shellescape() depends on 'shellshash' for quoting. That doesn't work whenIf I understand correctly:
> 'shellslash' is set but using cmd.exe. (Ben Fritz)
> Use a different option or let it depend on whether 'shell' looks like a
> unix-like shell?
> Also, I found that doing executable("start") returns 0 on my system, though using :!start directly works just fine. Using start is preferable to rundll32 because the latter pops up an intermediate window. For now, I've also hacked my netrw.vim to just use start exclusively (and also to avoid the "Press <cr> to continue" prompt). I don't have a good patch for this because I don't know the correct way to test whether start will work or not. (Maybe we can just try it and see if it fails?)
:!start is handled internally by Vim, it doesn't actually invoke "start".
:! start will directly invoke "start"
See :help :!start
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
For more options, visit https://groups.google.com/groups/opt_out.