diff --git a/runtime/lua/vim/_core/help.lua b/runtime/lua/vim/_core/help.lua index 87f9d462de..cc410daf17 100644 --- a/runtime/lua/vim/_core/help.lua +++ b/runtime/lua/vim/_core/help.lua @@ -108,7 +108,7 @@ function M.escape_subject(word) -- E.g. 'iCTRL-GCTRL-J' --> 'i_CTRL-G_CTRL-J' -- Only exception: 'CTRL-{character}' word = word:gsub('([^_])CTRL%-', '%1_CTRL-') - word = word:gsub('(CTRL%-[^{])([^_\\])', '%1_%2') + word = word:gsub('(CTRL%-[^{])([^-_\\])', '%1_%2') -- Skip function arguments -- E.g. 'abs({expr})' --> 'abs' diff --git a/test/functional/ex_cmds/help_spec.lua b/test/functional/ex_cmds/help_spec.lua index ffec9e50b0..7edb0556c5 100644 --- a/test/functional/ex_cmds/help_spec.lua +++ b/test/functional/ex_cmds/help_spec.lua @@ -130,6 +130,7 @@ describe(':help', function() check_tag('help <>', '*<>*') check_tag([[help i^x^y]], '*i_CTRL-X_CTRL-Y*') check_tag([[help CTRL-\_CTRL-N]], [[*CTRL-\_CTRL-N*]]) + check_tag([[help i_CTRL-U-default]], [[*i_CTRL-U-default*]]) check_tag([[exe "help i\\"]], [[*i_CTRL-\_CTRL-G*]]) check_tag([[exe "help \"]], '*CTRL-V*')