refactor(vim9): use 'start' open urls on win32
Commit:
https://github.com/vim/vim/commit/8de7fd0c2090437d8819a61e8c5df74951ac1eb5
Author: Mao-Yining <
101858210+...@users.noreply.github.com>
Date: Sun Dec 21 18:59:48 2025 +0000
refactor(vim9): use 'start' open urls on win32
- Use `:!start` directly, discard the using of `explorer.exe`.
- Update the document in `eval.txt`.
closes: #18985
Signed-off-by: Mao-Yining <
mao.y...@outlook.com>
Signed-off-by: Christian Brabandt <
c...@256bit.org>
diff --git a/runtime/autoload/dist/vim9.vim b/runtime/autoload/dist/vim9.vim
index c02280035..53385e082 100644
--- a/runtime/autoload/dist/vim9.vim
+++ b/runtime/autoload/dist/vim9.vim
@@ -66,9 +66,13 @@ if has('unix')
endif
elseif has('win32')
export def Launch(args: string)
- const shell = (&shell =~? '\<cmd\.exe\>') ? '' : 'cmd.exe /c'
- const quotes = empty(shell) ? '' : '""'
- execute $'silent ! {shell} start {quotes} /b {args} {Redir()}' | redraw!
+ try
+ execute ':silent !start' args | redraw!
+ catch /^Vim(!):E371:/
+ echohl ErrorMsg
+ echom "dist#vim9#Launch(): can not start" args
+ echohl None
+ endtry
enddef
else
export def Launch(dummy: string)
@@ -81,7 +85,10 @@ var os_viewer = null_string
if has('win32unix')
# (cyg)start suffices
os_viewer = ''
-# Windows / WSL
+# Windows
+elseif has('win32')
+ os_viewer = '' # Use :!start
+# WSL
elseif executable('explorer.exe')
os_viewer = 'explorer.exe'
# Linux / BSD
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 04a3de8ca..7c853795e 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt* For Vim version 9.1. Last change: 2025 Dec 19
+*eval.txt* For Vim version 9.1. Last change: 2025 Dec 21
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -5231,7 +5231,7 @@ $VIMRUNTIME/plugin/openPlugin.vim
dist#vim9#Open(file: string) ~
Opens `path` with the system default handler (macOS `open`, Windows
-`explorer.exe`, Linux `xdg-open`, …). If the variable |g:Openprg| exists the
+`start`, Linux `xdg-open`, …). If the variable |g:Openprg| exists the
string specified in the variable is used instead.
The |:Open| user command uses file completion for its argument.