[vim/vim] Bug of gx (dist#vim9#Open()) when setting shellslash on Windows (Issue #17995)

7 views
Skip to first unread message

毛逸宁

unread,
Aug 13, 2025, 9:25:47 PMAug 13
to vim/vim, Subscribed
mao-yining created an issue (vim/vim#17995)

Steps to reproduce

  1. set shellslash
  2. call dist#vim9#Open("explorer.exe 'https://github.com/vim/vim/blob/master/runtime/doc/todo.txt'")
  3. you open explorer.exe and it open the "~/Document"

Expected behaviour

Open the website

Version of Vim

gvim_9.1.1623_x86.exe

Environment

Microsoft Windows [10.0.26100.4652]
cmd.exe

Logs and stack traces

I read the source code and the document. I found that when set shellslash.

> On MS-Windows, when 'shellslash' is not set, it will enclose
> {string} in double quotes and double all double quotes within
> {string}.

and I tried.


# Wrong
start /b explorer.exe 'https://github.com/vim/vim/blob/master/runtime/doc/todo.txt' >nul 2>&1

# Right
start /b explorer.exe "https://github.com/vim/vim/blob/master/runtime/doc/todo.txt" >nul 2>&1


That's what happening. Maybe I can make a pull request to fix this issue. Before that I want to discuss about how to fix it. Because I am a high school student, who didn't have PR experiment before.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17995@github.com>

Christian Brabandt

unread,
Aug 14, 2025, 4:48:31 PMAug 14
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#17995)

call dist#vim9#Open("explorer.exe 'https://github.com/vim/vim'")

I guess that should have been:

call dist#vim9#Open('https://github.com/vim/vim') ?

Hm, that is nasty. Does that depend on the shell?

If you want to contribute a PR, that would be great. Perhaps you can start here:

diff --git a/runtime/autoload/dist/vim9.vim b/runtime/autoload/dist/vim9.vim
index 6d4079ea3..7a4b44c63 100644
--- a/runtime/autoload/dist/vim9.vim
+++ b/runtime/autoload/dist/vim9.vim
@@ -121,6 +121,10 @@ def Viewer(): string
 enddef

 export def Open(file: string)
+  if exists('+shellslash') && &shellslash
+    &shellslash=0
+    defer setbufvar('%', '&shellslash', true)
+  endif
   Launch($"{Viewer()} {shellescape(file, 1)}")
 enddef

Don't forget to add a comment why this is necessary. thanks!


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17995/3189830963@github.com>

Christian Brabandt

unread,
Aug 16, 2025, 11:40:48 AMAug 16
to vim/vim, Subscribed

Closed #17995 as completed via 39f9298.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/17995/issue_event/19187159851@github.com>

Reply all
Reply to author
Forward
0 new messages