runtime(openPlugin): add <Plug>-mappings Commit: https://github.com/vim/vim/commit/c877057e8181783000c7050a955b42f4ccf365e1 Author: Mark Woods <mwoods.online...@gmail.com> Date: Sun Jun 22 20:12:16 2025 +0200
runtime(openPlugin): add <Plug>-mappings vim9script <scriptcmd> mappings relying on imports cannot be evaluated outside of the script file with the imports, so do not work with plugins like vim-which-key, which applies the mappings using feedkeys(). Using <Plug> mappings is one way to address this, and has the added benefit of reading like a description for users finding the mappings. related: #17563 Signed-off-by: Mark Woods <mwoods.online...@gmail.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/runtime/plugin/openPlugin.vim b/runtime/plugin/openPlugin.vim index ff9c5a385..b7274aadd 100644 --- a/runtime/plugin/openPlugin.vim +++ b/runtime/plugin/openPlugin.vim @@ -3,7 +3,7 @@ vim9script # Vim runtime support library # # Maintainer: The Vim Project <https://github.com/vim/vim> -# Last Change: 2025 Jun 11 +# Last Change: 2025 Jun 22 if exists("g:loaded_openPlugin") || &cp finish @@ -34,10 +34,12 @@ if !no_gx enddef if maparg('gx', 'n') == "" - nnoremap <unique> gx <scriptcmd>vim9.Open(GetWordUnderCursor())<CR> + nnoremap <Plug>(open-word-under-cursor) <scriptcmd>vim9.Open(GetWordUnderCursor())<CR> + nmap gx <Plug>(open-word-under-cursor) endif if maparg('gx', 'x') == "" - xnoremap <unique> gx <scriptcmd>vim9.Open(getregion(getpos('v'), getpos('.'), { type: mode() })->join())<CR> + xnoremap <Plug>(open-word-under-cursor) <scriptcmd>vim9.Open(getregion(getpos('v'), getpos('.'), { type: mode() })->join())<CR> + xmap gx <Plug>(open-word-under-cursor) endif endif -- -- 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/E1uTPS7-00EV3U-Kr%40256bit.org.