diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-02-20 17:09:15 -0500 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-02-22 02:41:40 -0500 |
commit | 99d4c8c29c4a9371c268cc20e4805709d86fb686 (patch) | |
tree | 6bedd829ee9f073f7940a2ed09ad6829318d71b5 /src/nvim/edit.c | |
parent | 9403ce82bce1a2dcda4b01b10b2c01ee42bb4034 (diff) | |
download | rneovim-99d4c8c29c4a9371c268cc20e4805709d86fb686.tar.gz rneovim-99d4c8c29c4a9371c268cc20e4805709d86fb686.tar.bz2 rneovim-99d4c8c29c4a9371c268cc20e4805709d86fb686.zip |
keymap: Support <D-...> (super/command key).
Adds support for:
- api:vim_input("<D-a>")
- ":nnoremap <C-D-S-...>" and permutations thereof
UIs must capture the modifier and send it as "<D-...>" 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 <D-a>={CSI sequence}
then send the {CSI sequence} from their terminal. But this does not work
yet (regression #2204).
Closes #2190
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r-- | src/nvim/edit.c | 16 |
1 files changed, 7 insertions, 9 deletions
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 <S-Space>, * 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); |