From 99d4c8c29c4a9371c268cc20e4805709d86fb686 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 20 Feb 2016 17:09:15 -0500 Subject: keymap: Support (super/command key). Adds support for: - api:vim_input("") - ":nnoremap " and permutations thereof UIs must capture the modifier and send it as "" to vim_input(). Note: Before this commit, any arbitrary ":nnoremap <{foo}-{bar}>" mapping could already be invoked with feedkeys("\<{foo}-{bar}>"). This commit supports "D-" as a modifier that can be combined with "C-", "A-", "S-" in any order. For non-GUI (terminal) support, user must: :set ={CSI sequence} then send the {CSI sequence} from their terminal. But this does not work yet (regression #2204). Closes #2190 --- src/nvim/edit.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/nvim/edit.c') diff --git a/src/nvim/edit.c b/src/nvim/edit.c index d3b556f669..a983fa5772 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -4947,15 +4947,10 @@ int get_literal(void) return cc; } -/* - * Insert character, taking care of special keys and mod_mask - */ -static void -insert_special ( - int c, - int allow_modmask, - int ctrlv /* c was typed after CTRL-V */ -) +/// Insert character, taking care of special keys and mod_mask +/// +/// @param ctrlv `c` was typed after CTRL-V +static void insert_special(int c, int allow_modmask, int ctrlv) { char_u *p; int len; @@ -4967,6 +4962,9 @@ insert_special ( * Only use mod_mask for special keys, to avoid things like , * unless 'allow_modmask' is TRUE. */ + if (mod_mask & MOD_MASK_CMD) { // Command-key never produces a normal key. + allow_modmask = true; + } if (IS_SPECIAL(c) || (mod_mask && allow_modmask)) { p = get_special_key_name(c, mod_mask); len = (int)STRLEN(p); -- cgit