patch 8.2.4099: Vim9: cannot use Vim9 syntax in mapping
Problem: Vim9: cannot use Vim9 syntax in mapping.
Solution: Add <ScriptCmd> to use the script context for a command.
diff --git a/src/normal.c b/src/normal.c
index df7ae56..efc7cfd 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -373,6 +373,7 @@
{K_CURSORHOLD, nv_cursorhold, NV_KEEPREG, 0},
{K_PS, nv_edit, 0, 0},
{K_COMMAND, nv_colon, 0, 0},
+ {K_SCRIPT_COMMAND, nv_colon, 0, 0},
};
// Number of commands in nv_cmds[].
@@ -3429,7 +3430,9 @@
{
int old_p_im;
int cmd_result;
- int is_cmdkey = cap->cmdchar == K_COMMAND;
+ int is_cmdkey = cap->cmdchar == K_COMMAND
+ || cap->cmdchar == K_SCRIPT_COMMAND;
+ int flags;
if (VIsual_active && !is_cmdkey)
nv_operator(cap);
@@ -3459,8 +3462,11 @@
old_p_im = p_im;
// get a command line and execute it
- cmd_result = do_cmdline(NULL, is_cmdkey ? getcmdkeycmd : getexline, NULL,
- cap->oap->op_type != OP_NOP ? DOCMD_KEEPLINE : 0);
+ flags = cap->oap->op_type != OP_NOP ? DOCMD_KEEPLINE : 0;
+ if (is_cmdkey)
+ cmd_result = do_cmdkey_command(cap->cmdchar, flags);
+ else
+ cmd_result = do_cmdline(NULL, getexline, NULL, flags);
// If 'insertmode' changed, enter or exit Insert mode
if (p_im != old_p_im)