From c877057e8181783000c7050a955b42f4ccf365e1 Mon Sep 17 00:00:00 2001 From: Mark Woods Date: Sun, 22 Jun 2025 20:12:16 +0200 Subject: [PATCH] runtime(openPlugin): add -mappings vim9script 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 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 Signed-off-by: Christian Brabandt --- runtime/plugin/openPlugin.vim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/runtime/plugin/openPlugin.vim b/runtime/plugin/openPlugin.vim index ff9c5a3857..b7274aadda 100644 --- a/runtime/plugin/openPlugin.vim +++ b/runtime/plugin/openPlugin.vim @@ -3,7 +3,7 @@ vim9script # Vim runtime support library # # Maintainer: The Vim Project -# 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 gx vim9.Open(GetWordUnderCursor()) + nnoremap (open-word-under-cursor) vim9.Open(GetWordUnderCursor()) + nmap gx (open-word-under-cursor) endif if maparg('gx', 'x') == "" - xnoremap gx vim9.Open(getregion(getpos('v'), getpos('.'), { type: mode() })->join()) + xnoremap (open-word-under-cursor) vim9.Open(getregion(getpos('v'), getpos('.'), { type: mode() })->join()) + xmap gx (open-word-under-cursor) endif endif -- 2.47.2