diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-04-29 20:50:14 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-04-29 21:12:48 +0800 |
commit | 98f62a2cfa98363217fdfcf96b6c636e91dba84d (patch) | |
tree | e3b037813de3eb2f0133608d2a5d3df6bd9ef123 /src/nvim/getchar.c | |
parent | 8c548c9e5416b4e25b51c018ceaa433756ee99b1 (diff) | |
download | rneovim-98f62a2cfa98363217fdfcf96b6c636e91dba84d.tar.gz rneovim-98f62a2cfa98363217fdfcf96b6c636e91dba84d.tar.bz2 rneovim-98f62a2cfa98363217fdfcf96b6c636e91dba84d.zip |
feat(mappings): allow special keys and modifiers in <Cmd> mapping
Diffstat (limited to 'src/nvim/getchar.c')
-rw-r--r-- | src/nvim/getchar.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index eb78317ee7..0ce8f6e715 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -4861,15 +4861,21 @@ char_u *getcmdkeycmd(int promptc, void *cookie, int indent, bool do_concat) // special case to give nicer error message emsg(e_cmdmap_repeated); aborted = true; - } else if (IS_SPECIAL(c1)) { - if (c1 == K_SNR) { - ga_concat(&line_ga, "<SNR>"); + } else if (c1 == K_SNR) { + ga_concat(&line_ga, "<SNR>"); + } else { + if (cmod != 0) { + ga_append(&line_ga, (char)K_SPECIAL); + ga_append(&line_ga, (char)KS_MODIFIER); + ga_append(&line_ga, (char)cmod); + } + if (IS_SPECIAL(c1)) { + ga_append(&line_ga, (char)K_SPECIAL); + ga_append(&line_ga, (char)K_SECOND(c1)); + ga_append(&line_ga, (char)K_THIRD(c1)); } else { - semsg(e_cmdmap_key, get_special_key_name(c1, cmod)); - aborted = true; + ga_append(&line_ga, (char)c1); } - } else { - ga_append(&line_ga, (char)c1); } cmod = 0; |