0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

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.
This commit is contained in:
Bram Moolenaar
2022-01-15 18:26:04 +00:00
parent 069613c9e8
commit e32c3c462c
13 changed files with 113 additions and 22 deletions

View File

@@ -373,6 +373,7 @@ static const struct nv_cmd
{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 @@ nv_colon(cmdarg_T *cap)
{
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 @@ nv_colon(cmdarg_T *cap)
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)