]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
refactor(vim9): use 'start' open urls on win32
authorMao-Yining <101858210+mao-yining@users.noreply.github.com>
Sun, 21 Dec 2025 18:59:48 +0000 (18:59 +0000)
committerChristian Brabandt <cb@256bit.org>
Sun, 21 Dec 2025 18:59:48 +0000 (18:59 +0000)
- Use `:!start` directly, discard the using of `explorer.exe`.
- Update the document in `eval.txt`.

closes: #18985

Signed-off-by: Mao-Yining <mao.yining@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/autoload/dist/vim9.vim
runtime/doc/eval.txt

index c02280035258f069a1b431d6e955eedd11277286..53385e08244b67ab8f99fc7f77ac9e1325f50585 100644 (file)
@@ -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
index 04a3de8ca0ba6f6e699db7fe1467b6dbc6f9813c..7c853795eec81af91a14b1be07ba8612bdae5aa0 100644 (file)
@@ -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.