runtime(openPlugin): Add URLOpen to not expand special chars Commit: https://github.com/vim/vim/commit/a2dd40c057f6b53295f38adfcc69907620200acc Author: Christian Brabandt <c...@256bit.org> Date: Wed Jun 4 21:59:01 2025 +0200
runtime(openPlugin): Add URLOpen to not expand special chars closes: https://github.com/vim/vim/issues/17424 Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 170d2d037..492a4444a 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 Apr 02 +*eval.txt* For Vim version 9.1. Last change: 2025 Jun 04 VIM REFERENCE MANUAL by Bram Moolenaar @@ -5149,6 +5149,10 @@ executable. It takes the following arguments: filetype string executable string + *package-open* +The |:Open| and |:Launch| command are provided by the included plugin +$VIMRUNTIME/plugin/openPlugin.vim + *dist#vim9#Open()* *:Open* *:URLOpen* *g:Openprg* *gx* dist#vim9#Open(file: string) ~ @@ -5159,6 +5163,9 @@ string specified in the variable is used instead. The |:Open| user command uses file completion for its argument. +The |:URLOpen| user command works the same but does not perform file +completion and therefore does not expand special characters |cmdline-special|. + This function is by default called using the gx mapping. In visual mode tries to open the visually selected text. @@ -5176,11 +5183,8 @@ NOTE: Escaping of the path is automatically applied. Usage: >vim :call dist#vim9#Open(<path>) :Open <path> + :URLOpen <path> < - *package-open* -The |:Open| and |:Launch| command are provided by the included plugin -$VIMRUNTIME/plugin/openPlugin.vim - *dist#vim9#Launch()* *:Launch* dist#vim9#Launch(file: string) ~ diff --git a/runtime/plugin/openPlugin.vim b/runtime/plugin/openPlugin.vim index 09f5ad2c4..8e0ae4b99 100644 --- a/runtime/plugin/openPlugin.vim +++ b/runtime/plugin/openPlugin.vim @@ -17,6 +17,9 @@ command -complete=shellcmd -nargs=1 Launch vim9.Launch(trim(<q-args>)) # technically, -nargs=1 is correct, but this throws E480: No match # when the argument contains a wildchar on Windows command -complete=file -nargs=* Open vim9.Open(trim(<q-args>)) +# Use URLOpen when you don't want completion to happen +# (or because you want to avoid cmdline-special) +command -nargs=1 URLOpen vim9.Open(trim(<q-args>)) const no_gx = get(g:, "nogx", get(g:, "netrw_nogx", false)) if !no_gx -- -- 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 vim_dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1uMuVr-0006w0-J5%40256bit.org.