aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/keymap.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/keymap.h')
-rw-r--r--src/nvim/keymap.h46
1 files changed, 28 insertions, 18 deletions
diff --git a/src/nvim/keymap.h b/src/nvim/keymap.h
index 766362d145..bb8ba84a6a 100644
--- a/src/nvim/keymap.h
+++ b/src/nvim/keymap.h
@@ -1,6 +1,8 @@
#ifndef NVIM_KEYMAP_H
#define NVIM_KEYMAP_H
+#include "nvim/strings.h"
+
/*
* Keycode definitions for special keys.
*
@@ -112,11 +114,11 @@
#define TO_SPECIAL(a, b) ((a) == KS_SPECIAL ? K_SPECIAL : (a) == \
KS_ZERO ? K_ZERO : TERMCAP2KEY(a, b))
-/*
- * Codes for keys that do not have a termcap name.
- *
- * K_SPECIAL KS_EXTRA KE_xxx
- */
+// Codes for keys that do not have a termcap name.
+//
+// K_SPECIAL KS_EXTRA KE_xxx
+//
+// Entries must be in the range 0x02-0x7f (see comment at K_SPECIAL).
enum key_extra {
KE_NAME = 3 /* name of this terminal entry */
@@ -436,11 +438,12 @@ enum key_extra {
/* 0x01 cannot be used, because the modifier must be 0x02 or higher */
#define MOD_MASK_SHIFT 0x02
#define MOD_MASK_CTRL 0x04
-#define MOD_MASK_ALT 0x08 /* aka META */
-#define MOD_MASK_META 0x10 /* META when it's different from ALT */
-#define MOD_MASK_2CLICK 0x20 /* use MOD_MASK_MULTI_CLICK */
-#define MOD_MASK_3CLICK 0x40 /* use MOD_MASK_MULTI_CLICK */
-#define MOD_MASK_4CLICK 0x60 /* use MOD_MASK_MULTI_CLICK */
+#define MOD_MASK_ALT 0x08 // aka META
+#define MOD_MASK_META 0x10 // META when it's different from ALT
+#define MOD_MASK_2CLICK 0x20 // use MOD_MASK_MULTI_CLICK
+#define MOD_MASK_3CLICK 0x40 // use MOD_MASK_MULTI_CLICK
+#define MOD_MASK_4CLICK 0x60 // use MOD_MASK_MULTI_CLICK
+#define MOD_MASK_CMD 0x80 // "super" key (OSX/Mac: command-key)
#define MOD_MASK_MULTI_CLICK (MOD_MASK_2CLICK|MOD_MASK_3CLICK| \
MOD_MASK_4CLICK)
@@ -451,16 +454,23 @@ enum key_extra {
*/
#define MAX_KEY_NAME_LEN 25
-/* Maximum length of a special key event as tokens. This includes modifiers.
- * The longest event is something like <M-C-S-T-4-LeftDrag> which would be the
- * following string of tokens:
- *
- * <K_SPECIAL> <KS_MODIFIER> bitmask <K_SPECIAL> <KS_EXTRA> <KT_LEFTDRAG>.
- *
- * This is a total of 6 tokens, and is currently the longest one possible.
- */
+// Maximum length of a special key event as tokens. This includes modifiers.
+// The longest event is something like <M-C-S-T-4-LeftDrag> which would be the
+// following string of tokens:
+//
+// <K_SPECIAL> <KS_MODIFIER> bitmask <K_SPECIAL> <KS_EXTRA> <KE_LEFTDRAG>.
+//
+// This is a total of 6 tokens, and is currently the longest one possible.
#define MAX_KEY_CODE_LEN 6
+#define FLAG_CPO_BSLASH 0x01
+#define FLAG_CPO_SPECI 0x02
+#define CPO_TO_CPO_FLAGS (((vim_strchr(p_cpo, CPO_BSLASH) == NULL) \
+ ? 0 \
+ : FLAG_CPO_BSLASH)| \
+ (vim_strchr(p_cpo, CPO_SPECI) == NULL \
+ ? 0 \
+ : FLAG_CPO_SPECI))
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "keymap.h.generated.h"