runtime(vim9): remove extra escaping in Open
Commit:
https://github.com/vim/vim/commit/30d42855eb7e938883b7bef48477fad65f49107f
Author: Keith Smiley <[email protected]>
Date: Fri Apr 17 15:02:39 2026 +0000
runtime(vim9): remove extra escaping in Open
Before 71fd19d7ac9e83bf63d7bad337f43cd830a5b5bd this function went
through a `:!` command on all platforms, so it needed special escaping for
`#` and
others. After that commit it doesn't go through that path on unix
platforms. Then with 48581f2ba96550f5499cc322647b2ff1df5ad4ed this
escaping was re-added on unix and it's needs since it goes through
`sh -c`, but it should not have the extra escaping specific to `:!`.
Specifically my original broken command is:
```
PATH=/usr/bin:/bin VIMRUNTIME=~/dev/vim/runtime ./src/vim -u NONE -c 'call
dist#vim9#Open("https://github.com/keith/dotfiles/blob/7bce9f5c697df6a549cf97bf5606d8b639e5bf5a/vimrc#L19")'
```
Where the `#L19` ends up being opened as `%5C#L19`. But I verified this
case still works as well:
```
PATH=/usr/bin:/bin VIMRUNTIME=~/dev/vim/runtime ./src/vim -u NONE -c 'call
dist#vim9#Open("foo bar.txt")'
```
Which is what would otherwise break if we weren't doing any shell
escaping on unix.
closes: #19996
Signed-off-by: Keith Smiley <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/runtime/autoload/dist/vim9.vim b/runtime/autoload/dist/vim9.vim
index d82467391..4d8785d4a 100644
--- a/runtime/autoload/dist/vim9.vim
+++ b/runtime/autoload/dist/vim9.vim
@@ -3,7 +3,7 @@ vim9script
# Vim runtime support library
#
# Maintainer: The Vim Project <https://github.com/vim/vim>
-# Last Change: 2026 Apr 06
+# Last Change: 2026 Apr 17
export def IsSafeExecutable(filetype: string, executable: string): bool
if empty(exepath(executable))
@@ -139,7 +139,11 @@ export def Open(file: string)
setlocal shell&
defer setbufvar('%', '&shell', shell)
endif
- Launch($"{Viewer()} {shellescape(file, 1)}")
+ if has('unix') && !has('win32unix') && !exists('$WSL_DISTRO_NAME')
+ Launch($"{Viewer()} {shellescape(file)}")
+ else
+ Launch($"{Viewer()} {shellescape(file, 1)}")
+ endif
enddef
# Uncomment this line to check for compilation errors early
--
--
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 [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1wDkuN-007U3R-As%40256bit.org.