]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(autoload/dist): gx may use xdg-open on macOS
authorLifepillar <lifepillar@lifepillar.me>
Wed, 1 Jul 2026 18:24:44 +0000 (18:24 +0000)
committerChristian Brabandt <cb@256bit.org>
Wed, 1 Jul 2026 18:24:44 +0000 (18:24 +0000)
Problem:  gx mapping: when macOS have xdg-open in PATH, that takes
          precedence over open.
Solution: check for 'osx' feature instead of executables, and do it
          before checking for executables.

closes: #20687

Signed-off-by: Lifepillar <lifepillar@lifepillar.me>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/autoload/dist/vim9.vim

index a8bb4f95d0b6c9a8ad79dafef46a506d2b245ece..cb90a955e1f7d6b51c601d6325ff99ff35a03ef1 100644 (file)
@@ -3,7 +3,7 @@ vim9script
 # Vim runtime support library
 #
 # Maintainer:   The Vim Project <https://github.com/vim/vim>
-# Last Change:  2026 May 30
+# Last Change:  2026 Jul 01
 
 export def IsSafeExecutable(filetype: string, executable: string): bool
   if empty(exepath(executable))
@@ -89,15 +89,15 @@ if has('win32unix')
 # Windows
 elseif has('win32')
   os_viewer = '' # Use :!start
+# MacOS
+elseif has('osx')
+  os_viewer = 'open'
 # WSL
 elseif executable('explorer.exe')
   os_viewer = 'explorer.exe'
 # Linux / BSD
 elseif executable('xdg-open')
   os_viewer = 'xdg-open'
-# MacOS
-elseif executable('open')
-  os_viewer = 'open'
 endif
 
 def Viewer(): string