From 3099630a11ff64797deb4864193c37b3e4074e05 Mon Sep 17 00:00:00 2001 From: Robert Verst Date: Thu, 24 Jun 2021 04:23:43 +0200 Subject: [PATCH] [Keymap] Feature/extend keymap (#12778) * Add F13-F24 * Add nvim macros * Add debug switch * Switch mode every time, add debug print --- keyboards/id80/keymaps/rverst/keymap.c | 18 +++--- keyboards/id80/keymaps/rverst/rverst.json | 68 +++++++++++------------ users/rverst/rules.mk | 2 + users/rverst/rverst.c | 33 ++++++++++- users/rverst/rverst.h | 6 +- 5 files changed, 80 insertions(+), 47 deletions(-) diff --git a/keyboards/id80/keymaps/rverst/keymap.c b/keyboards/id80/keymaps/rverst/keymap.c index 73bf8899acd..3656f48dfeb 100644 --- a/keyboards/id80/keymaps/rverst/keymap.c +++ b/keyboards/id80/keymaps/rverst/keymap.c @@ -29,11 +29,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LALT, KC_LGUI, KC_SPC , OSL(1) , KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT ), [1] = LAYOUT( - RV_SNAP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, + RV_SNAP, KC_F13 , KC_F14 , KC_F15 , KC_F16 , KC_F17 , KC_F18 , KC_F19 , KC_F20 , KC_F21 , KC_F22 , KC_F23 , KC_F24 , KC_TRNS, KC_MUTE, RV_DEG , RV_SUP1, RV_SUP2, RV_SUP3, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RV_UNEQ, RV_PM , KC_TRNS, KC_VOLU, - KC_TRNS, KC_TRNS, KC_TRNS, RV_EUR , RV_RT , RV_TM , KC_TRNS, RV_UUML, KC_TRNS, RV_OUML, KC_TRNS, KC_TRNS, KC_PEQL, KC_TRNS, KC_VOLD, - KC_CAPS, RV_AUML, RV_SZ , KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RV_LOCK, KC_TRNS, KC_PAST, KC_PENT, - KC_TRNS, KC_TRNS, KC_TRNS, RV_CC , KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PDOT, KC_PSLS, KC_TRNS, KC_MSTP, + KC_TRNS, KC_TRNS, KC_TRNS, RV_EUR , RV_RT , RV_TM , KC_TRNS, RV_UUML, KC_TRNS, RV_OUML, KC_TRNS, RV_VDEC, RV_VINC, RV_SEQU, KC_VOLD, + KC_CAPS, RV_AUML, RV_SZ , KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RV_LOCK, KC_TRNS, RV_SINC, KC_PENT, + KC_TRNS, KC_TRNS, KC_TRNS, RV_CC , KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RV_SDEC, KC_TRNS, KC_MSTP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_RGUI, KC_MPRV, KC_MPLY, KC_MNXT ), [2] = LAYOUT( @@ -45,15 +45,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LALT, KC_LGUI, KC_SPC , OSL(3) , KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT ), [3] = LAYOUT( - RV_SNAP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, + RV_SNAP, KC_F13 , KC_F14 , KC_F15 , KC_F16 , KC_F17 , KC_F18 , KC_F19 , KC_F20 , KC_F21 , KC_F22 , KC_F23 , KC_F24 , KC_TRNS, KC_MUTE, RV_DEG , RV_SUP1, RV_SUP2, RV_SUP3, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RV_UNEQ, RV_PM , KC_TRNS, KC_VOLU, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RV_LOCK, RV_UUML, KC_TRNS, KC_TRNS, KC_TRNS, KC_PEQL, KC_TRNS, KC_VOLD, - KC_CAPS, RV_AUML, RV_RT , RV_SZ , RV_TM , KC_TRNS, KC_TRNS, KC_TRNS, RV_EUR , KC_TRNS, RV_OUML, KC_PAST, KC_PENT, - KC_TRNS, KC_TRNS, KC_TRNS, RV_CC , KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PDOT, KC_PSLS, KC_TRNS, KC_MSTP, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RV_LOCK, RV_UUML, KC_TRNS, KC_TRNS, RV_VDEC, RV_VINC, RV_SEQU, KC_VOLD, + KC_CAPS, RV_AUML, RV_RT , RV_SZ , RV_TM , KC_TRNS, KC_TRNS, KC_TRNS, RV_EUR , KC_TRNS, RV_OUML, RV_SINC, KC_PENT, + KC_TRNS, KC_TRNS, KC_TRNS, RV_CC , KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RV_SDEC, KC_TRNS, KC_MSTP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_RGUI, KC_MPRV, KC_MPLY, KC_MNXT ), [4] = LAYOUT( - EEP_RST, RV_SM0 , RV_SM1 , RV_SM2 , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , DF(0) , DF(2) , KC_TRNS, MO(5) , + DEBUG , RV_SM0 , RV_SM1 , RV_SM2 , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , DF(0) , DF(2) , KC_TRNS, MO(5) , RV_SAYM, RV_SM3 , RV_SM4 , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , diff --git a/keyboards/id80/keymaps/rverst/rverst.json b/keyboards/id80/keymaps/rverst/rverst.json index 804a7d93c80..50235498fed 100644 --- a/keyboards/id80/keymaps/rverst/rverst.json +++ b/keyboards/id80/keymaps/rverst/rverst.json @@ -87,18 +87,18 @@ ], [ "RV_SNAP", - "KC_TRNS", - "KC_TRNS", - "KC_TRNS", - "KC_TRNS", - "KC_TRNS", - "KC_TRNS", - "KC_TRNS", - "KC_TRNS", - "KC_TRNS", - "KC_TRNS", - "KC_TRNS", - "KC_TRNS", + "KC_F13", + "KC_F14", + "KC_F15", + "KC_F16", + "KC_F17", + "KC_F18", + "KC_F19", + "KC_F20", + "KC_F21", + "KC_F22", + "KC_F23", + "KC_F24", "KC_TRNS", "KC_MUTE", "RV_DEG", @@ -127,9 +127,9 @@ "KC_TRNS", "RV_OUML", "KC_TRNS", - "KC_TRNS", - "KC_PEQL", - "KC_TRNS", + "RV_VDEC", + "RV_VINC", + "RV_SEQU", "KC_VOLD", "KC_CAPS", "RV_AUML", @@ -142,7 +142,7 @@ "KC_TRNS", "RV_LOCK", "KC_TRNS", - "KC_PAST", + "RV_SINC", "KC_PENT", "KC_TRNS", "KC_TRNS", @@ -154,7 +154,7 @@ "KC_TRNS", "KC_TRNS", "KC_PDOT", - "KC_PSLS", + "RV_SDEC", "KC_TRNS", "KC_MSTP", "KC_TRNS", @@ -251,18 +251,18 @@ ], [ "RV_SNAP", - "KC_TRNS", - "KC_TRNS", - "KC_TRNS", - "KC_TRNS", - "KC_TRNS", - "KC_TRNS", - "KC_TRNS", - "KC_TRNS", - "KC_TRNS", - "KC_TRNS", - "KC_TRNS", - "KC_TRNS", + "KC_F13", + "KC_F14", + "KC_F15", + "KC_F16", + "KC_F17", + "KC_F18", + "KC_F19", + "KC_F20", + "KC_F21", + "KC_F22", + "KC_F23", + "KC_F24", "KC_TRNS", "KC_MUTE", "RV_DEG", @@ -291,9 +291,9 @@ "RV_UUML", "KC_TRNS", "KC_TRNS", - "KC_TRNS", - "KC_PEQL", - "KC_TRNS", + "RV_VDEC", + "RV_VINC", + "RV_SEQU", "KC_VOLD", "KC_CAPS", "RV_AUML", @@ -306,7 +306,7 @@ "RV_EUR", "KC_TRNS", "RV_OUML", - "KC_PAST", + "RV_SINC", "KC_PENT", "KC_TRNS", "KC_TRNS", @@ -318,7 +318,7 @@ "KC_TRNS", "KC_TRNS", "KC_PDOT", - "KC_PSLS", + "RV_SDEC", "KC_TRNS", "KC_MSTP", "KC_TRNS", diff --git a/users/rverst/rules.mk b/users/rverst/rules.mk index 91b096aede8..2b8fe92959f 100644 --- a/users/rverst/rules.mk +++ b/users/rverst/rules.mk @@ -5,3 +5,5 @@ MOUSEKEY_ENABLE = no LTO_ENABLE = yes CONSOLE_ENABLE = yes UNICODEMAP_ENABLE = yes +COMMAND_ENABLE = no + diff --git a/users/rverst/rverst.c b/users/rverst/rverst.c index 23391caa6a6..2cbffbc4788 100644 --- a/users/rverst/rverst.c +++ b/users/rverst/rverst.c @@ -39,9 +39,7 @@ uint8_t get_mode(void) { } void set_mode(uint8_t mode, bool save) { - if (mode == get_mode()) { - return; - } + dprintf("set_mode - mode: %d, save: %s\n", mode, save ? "true" : "false"); switch_mode(mode); if (mode > 7) { @@ -392,6 +390,35 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { send_unicode_string("³"); } return false; + // vim equal split + case RV_SEQU: + tap_code16(C(KC_W)); + tap_code(KC_EQL); + return false; + // vim vertical split increase + case RV_VINC: + tap_code16(C(KC_W)); + tap_code(KC_4); + tap_code16(S(KC_DOT)); + return false; + // vim vertical split decrease + case RV_VDEC: + tap_code16(C(KC_W)); + tap_code(KC_4); + tap_code16(S(KC_COMM)); + return false; + // vim split increase + case RV_SINC: + tap_code16(C(KC_W)); + tap_code(KC_4); + tap_code16(S(KC_EQL)); + return false; + // vim split decrease + case RV_SDEC: + tap_code16(C(KC_W)); + tap_code(KC_4); + tap_code(KC_MINS); + return false; } return true; diff --git a/users/rverst/rverst.h b/users/rverst/rverst.h index b7aea556c20..2e46d41d066 100644 --- a/users/rverst/rverst.h +++ b/users/rverst/rverst.h @@ -55,7 +55,11 @@ enum userspace_keycodes { RV_SUP1, // ¹ RV_SUP2, // ² RV_SUP3, // ³ - + RV_VINC, // vim increase vertical split size ( 4>) + RV_VDEC, // vim decrease vertical split size ( 4<) + RV_SINC, // vim increase vertical split size ( 4+) + RV_SDEC, // vim decrease vertical split size ( 4-) + RV_SEQU, // vim equal split size ( =) }; typedef union {