diff options
author | Ryan <fauxpark@gmail.com> | 2023-02-13 03:19:02 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-13 03:19:02 +1100 |
commit | bbf7a20b33de2d203518687cb5cd1aa85005ea27 (patch) | |
tree | ee1a5c412a02021d085c81a26321c3424eca7022 /users | |
parent | d10350cd2ceb2b9d80522cdec3ea908118f7fd35 (diff) |
Refactor Leader key feature (#19632)
Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'users')
-rw-r--r-- | users/alfrdmalr/alfrdmalr.c | 16 | ||||
-rw-r--r-- | users/arkag/arkag.c | 257 | ||||
-rw-r--r-- | users/curry/leader.c | 24 | ||||
-rw-r--r-- | users/curry/leader_user.c | 31 | ||||
-rw-r--r-- | users/curry/leader_user.h (renamed from users/curry/leader.h) | 0 | ||||
-rw-r--r-- | users/curry/rules.mk | 2 | ||||
-rw-r--r-- | users/danielo515/danielo515.c | 171 | ||||
-rw-r--r-- | users/jjerrell/jjerrell.c | 65 | ||||
-rw-r--r-- | users/kuatsure/kuatsure.c | 141 | ||||
-rw-r--r-- | users/kuchosauronad0/leader.c | 116 | ||||
-rw-r--r-- | users/kuchosauronad0/leader_user.c | 113 | ||||
-rw-r--r-- | users/kuchosauronad0/leader_user.h (renamed from users/kuchosauronad0/leader.h) | 2 | ||||
-rw-r--r-- | users/kuchosauronad0/readme.md | 4 | ||||
-rw-r--r-- | users/kuchosauronad0/rgblight_user.c | 2 | ||||
-rw-r--r-- | users/kuchosauronad0/rules.mk | 2 | ||||
-rw-r--r-- | users/sigma/sigma.c | 33 | ||||
-rw-r--r-- | users/uqs/uqs.c | 45 | ||||
-rw-r--r-- | users/yet-another-developer/leader.c | 46 | ||||
-rw-r--r-- | users/yet-another-developer/leader_user.c | 41 | ||||
-rw-r--r-- | users/yet-another-developer/leader_user.h (renamed from users/yet-another-developer/leader.h) | 2 | ||||
-rw-r--r-- | users/yet-another-developer/rules.mk | 2 |
21 files changed, 555 insertions, 560 deletions
diff --git a/users/alfrdmalr/alfrdmalr.c b/users/alfrdmalr/alfrdmalr.c index 18ce8bad7c..7bc04fb55c 100644 --- a/users/alfrdmalr/alfrdmalr.c +++ b/users/alfrdmalr/alfrdmalr.c @@ -7,7 +7,12 @@ uint16_t muse_counter = 0; uint8_t muse_offset = 70; uint16_t muse_tempo = 50; -LEADER_EXTERNS(); +void leader_end_user(void) { + // reset keyboard to bootloader + if (leader_sequence_five_keys(KC_R, KC_E, KC_S, KC_E, KC_T)) { + reset_keyboard(); + } +} void matrix_scan_user(void) { #ifdef AUDIO_ENABLE @@ -28,15 +33,6 @@ void matrix_scan_user(void) { } } #endif - - LEADER_DICTIONARY() { - leading = false; - // reset keyboard to bootloader - SEQ_FIVE_KEYS(KC_R, KC_E, KC_S, KC_E, KC_T) { - reset_keyboard(); - } - leader_end(); - } } bool syml_pressed = false; diff --git a/users/arkag/arkag.c b/users/arkag/arkag.c index 7074da18eb..4e80b318a7 100644 --- a/users/arkag/arkag.c +++ b/users/arkag/arkag.c @@ -303,146 +303,141 @@ void pri_mod_keystroke(uint16_t key) { pri_mod(false); } +void leader_end_user(void) { + // begin OS functions + if (leader_sequence_two_keys(KC_P, KC_B)) { + if (current_os == OS_WIN) { + long_keystroke(2, (uint16_t[]){KC_LGUI, KC_PAUSE}); + } else { + return; + } + } + if (leader_sequence_two_keys(KC_S, KC_S)) { + if (current_os == OS_MAC) { + long_keystroke(3, (uint16_t[]){KC_LGUI, KC_LSFT, KC_4}); + } else if (current_os == OS_WIN) { + long_keystroke(3, (uint16_t[]){KC_LGUI, KC_LSFT, KC_S}); + } else { + return; + } + } + if (leader_sequence_three_keys(KC_C, KC_A, KC_D)) { + if (current_os == OS_WIN) { + long_keystroke(3, (uint16_t[]){KC_LCTL, KC_LALT, KC_DEL}); + } else { + } + } + if (leader_sequence_three_keys(KC_C, KC_A, KC_E)) { + if (current_os == OS_WIN) { + long_keystroke(3, (uint16_t[]){KC_LCTL, KC_LALT, KC_END}); + } else { + } + } + // end OS functions + + // begin format functions + if (leader_sequence_one_key(KC_B)) { + surround_type(2, KC_8, true); + } + if (leader_sequence_one_key(KC_I)) { + surround_type(2, KC_MINS, true); + } + if (leader_sequence_one_key(KC_U)) { + surround_type(4, KC_MINS, true); + } + if (leader_sequence_one_key(KC_S)) { + surround_type(4, KC_GRAVE, true); + } + if (leader_sequence_one_key(KC_C)) { + register_unicode(0x00E7); // ç + } + if (leader_sequence_two_keys(KC_A, KC_V)) { + surround_type(2, KC_QUOT, true); + pair_surround_type(2, KC_LCBR, true); + surround_type(2, KC_SPC, false); + } + if (leader_sequence_two_keys(KC_M, KC_L)) { + pair_surround_type(1, KC_LBRC, false); + SEND_STRING("LINK_NAME"); + tap_code(KC_RGHT); + pair_surround_type(1, KC_LPRN, true); + pri_mod_keystroke(KC_V); + } + if (leader_sequence_two_keys(KC_C, KC_C)) { + surround_type(2, KC_GRAVE, false); + } + if (leader_sequence_three_keys(KC_C, KC_C, KC_C)) { + surround_type(6, KC_GRAVE, false); + } + if (leader_sequence_one_key(KC_E)) { + register_unicode(0x00E8); // è + } + if (leader_sequence_two_keys(KC_E, KC_E)) { + register_unicode(0x00E9); // é + } + // end format functions + + // start fancy functions + if (leader_sequence_two_keys(KC_V, KC_P)) { + SEND_STRING("ggvG}x:set paste\ni"); + pri_mod_keystroke(KC_V); + } + if (leader_sequence_three_keys(KC_C, KC_C, KC_ENT)) { + surround_type(6, KC_GRAVE, false); + pri_mod_keystroke(KC_V); + multi_tap(3, KC_RGHT, false); + tap_code(KC_ENTER); + } + if (leader_sequence_three_keys(KC_T, KC_C, KC_ENT)) { + multi_tap(3, KC_GRAVE, false); + pri_mod_keystroke(KC_V); + multi_tap(2, KC_ENTER, false); + } + // end fancy functions + + // start typing functions + if (leader_sequence_two_keys(KC_T, KC_M)) { + register_unicode(0x2122); // ™ + } + if (leader_sequence_two_keys(KC_D, KC_D)) { + SEND_STRING(".\\Administrator"); + } + if (leader_sequence_three_keys(KC_D, KC_D, KC_D)) { + SEND_STRING(".\\Administrator"); + tap_code(KC_TAB); + pri_mod_keystroke(KC_V); + tap_code(KC_ENTER); + } + if (leader_sequence_three_keys(KC_L, KC_O, KC_D)) { + send_unicode_string("ಠ__ಠ"); + } + if (leader_sequence_three_keys(KC_M, KC_A, KC_P)) { + SEND_STRING("https://github.com/qmk/qmk_firmware/tree/master/users/arkag"); + } + if (leader_sequence_two_keys(KC_F, KC_F)) { + send_unicode_string("(╯‵Д′)╯彡┻━┻"); + } + if (leader_sequence_three_keys(KC_F, KC_F, KC_F)) { + send_unicode_string("┬─┬ノ( º _ º ノ)"); + } + if (leader_sequence_three_keys(KC_L, KC_O, KC_L)) { + send_unicode_string("( ͡° ͜ʖ ͡°)"); + } + if (leader_sequence_three_keys(KC_S, KC_S, KC_S)) { + send_unicode_string("¯\\_(ツ)_/¯"); + } + // end typing functions +} + void matrix_init_user(void) { current_os = eeprom_read_byte(EECONFIG_USERSPACE); set_os(current_os, false); } -LEADER_EXTERNS(); - void matrix_scan_user(void) { check_state(); flash_rgb(); fade_rgb(); - LEADER_DICTIONARY() { - leading = false; - leader_end(); - - // begin OS functions - SEQ_TWO_KEYS(KC_P, KC_B) { - if (current_os == OS_WIN) { - long_keystroke(2, (uint16_t[]){KC_LGUI, KC_PAUSE}); - } else { - return; - } - } - SEQ_TWO_KEYS(KC_S, KC_S) { - if (current_os == OS_MAC) { - long_keystroke(3, (uint16_t[]){KC_LGUI, KC_LSFT, KC_4}); - } else if (current_os == OS_WIN) { - long_keystroke(3, (uint16_t[]){KC_LGUI, KC_LSFT, KC_S}); - } else { - return; - } - } - SEQ_THREE_KEYS(KC_C, KC_A, KC_D) { - if (current_os == OS_WIN) { - long_keystroke(3, (uint16_t[]){KC_LCTL, KC_LALT, KC_DEL}); - } else { - } - } - SEQ_THREE_KEYS(KC_C, KC_A, KC_E) { - if (current_os == OS_WIN) { - long_keystroke(3, (uint16_t[]){KC_LCTL, KC_LALT, KC_END}); - } else { - } - } - // end OS functions - - // begin format functions - SEQ_ONE_KEY(KC_B) { - surround_type(2, KC_8, true); - } - SEQ_ONE_KEY(KC_I) { - surround_type(2, KC_MINS, true); - } - SEQ_ONE_KEY(KC_U) { - surround_type(4, KC_MINS, true); - } - SEQ_ONE_KEY(KC_S) { - surround_type(4, KC_GRAVE, true); - } - SEQ_ONE_KEY(KC_C) { - register_unicode(0x00E7); // ç - } - SEQ_TWO_KEYS(KC_A, KC_V) { - surround_type(2, KC_QUOT, true); - pair_surround_type(2, KC_LCBR, true); - surround_type(2, KC_SPC, false); - } - SEQ_TWO_KEYS(KC_M, KC_L) { - pair_surround_type(1, KC_LBRC, false); - SEND_STRING("LINK_NAME"); - tap_code(KC_RGHT); - pair_surround_type(1, KC_LPRN, true); - pri_mod_keystroke(KC_V); - } - SEQ_TWO_KEYS(KC_C, KC_C) { - surround_type(2, KC_GRAVE, false); - } - SEQ_THREE_KEYS(KC_C, KC_C, KC_C) { - surround_type(6, KC_GRAVE, false); - } - SEQ_ONE_KEY(KC_E) { - register_unicode(0x00E8); // è - } - SEQ_TWO_KEYS(KC_E, KC_E) { - register_unicode(0x00E9); // é - } - // end format functions - - // start fancy functions - SEQ_TWO_KEYS(KC_V, KC_P) { - SEND_STRING("ggvG}x:set paste\ni"); - pri_mod_keystroke(KC_V); - } - SEQ_THREE_KEYS(KC_C, KC_C, KC_ENT) { - surround_type(6, KC_GRAVE, false); - pri_mod_keystroke(KC_V); - multi_tap(3, KC_RGHT, false); - tap_code(KC_ENTER); - } - SEQ_THREE_KEYS(KC_T, KC_C, KC_ENT) { - multi_tap(3, KC_GRAVE, false); - pri_mod_keystroke(KC_V); - multi_tap(2, KC_ENTER, false); - } - // end fancy functions - - // start typing functions - SEQ_TWO_KEYS(KC_T, KC_M) { - register_unicode(0x2122); // ™ - } - SEQ_TWO_KEYS(KC_D, KC_D) { - SEND_STRING(".\\Administrator"); - } - SEQ_THREE_KEYS(KC_D, KC_D, KC_D) { - SEND_STRING(".\\Administrator"); - tap_code(KC_TAB); - pri_mod_keystroke(KC_V); - tap_code(KC_ENTER); - } - SEQ_THREE_KEYS(KC_L, KC_O, KC_D) { - send_unicode_string("ಠ__ಠ"); - } - SEQ_THREE_KEYS(KC_M, KC_A, KC_P) { - SEND_STRING("https://github.com/qmk/qmk_firmware/tree/master/users/arkag"); - } - SEQ_TWO_KEYS(KC_F, KC_F) { - send_unicode_string("(╯‵Д′)╯彡┻━┻"); - } - SEQ_THREE_KEYS(KC_F, KC_F, KC_F) { - send_unicode_string("┬─┬ノ( º _ º ノ)"); - } - SEQ_THREE_KEYS(KC_L, KC_O, KC_L) { - send_unicode_string("( ͡° ͜ʖ ͡°)"); - } - SEQ_THREE_KEYS(KC_S, KC_S, KC_S) { - send_unicode_string("¯\\_(ツ)_/¯"); - } - // end typing functions - - } } bool process_record_user(uint16_t keycode, keyrecord_t *record) { diff --git a/users/curry/leader.c b/users/curry/leader.c deleted file mode 100644 index 3fca6a2ec3..0000000000 --- a/users/curry/leader.c +++ /dev/null @@ -1,24 +0,0 @@ -#include "curry.h" -#include "leader.h" - -LEADER_EXTERNS(); - -void matrix_scan_user(void) { - static bool has_ran_yet; - if (!has_ran_yet) { - has_ran_yet = true; - startup_user(); - } - -#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) - matrix_scan_rgb(); -#endif // RGBLIGHT_ENABLE - LEADER_DICTIONARY() { - leading = false; - leader_end(); - SEQ_ONE_KEY(KC_F) { SEND_STRING(SS_LCTL("akf")); } // Select all and format - SEQ_ONE_KEY(KC_P) { SEND_STRING(SS_LCTL(SS_LSFT("4"))); } // Screenshot region - SEQ_TWO_KEYS(KC_D, KC_D) { SEND_STRING(SS_LCTL("ac")); } // Copy all - } - matrix_scan_keymap(); -} diff --git a/users/curry/leader_user.c b/users/curry/leader_user.c new file mode 100644 index 0000000000..9cee19af49 --- /dev/null +++ b/users/curry/leader_user.c @@ -0,0 +1,31 @@ +#include "curry.h" +#include "leader_user.h" + +void leader_end_user(void) { + if (leader_sequence_one_key(KC_F)) { + // Select all and format + SEND_STRING(SS_LCTL("akf")); + } + if (leader_sequence_one_key(KC_P)) { + // Screenshot region + SEND_STRING(SS_LCTL(SS_LSFT("4"))); + } + if (leader_sequence_two_keys(KC_D, KC_D)) { + // Copy all + SEND_STRING(SS_LCTL("ac")); + } +} + +void matrix_scan_user(void) { + static bool has_ran_yet; + if (!has_ran_yet) { + has_ran_yet = true; + startup_user(); + } + +#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) + matrix_scan_rgb(); +#endif // RGBLIGHT_ENABLE + + matrix_scan_keymap(); +} diff --git a/users/curry/leader.h b/users/curry/leader_user.h index f215893b9e..f215893b9e 100644 --- a/users/curry/leader.h +++ b/users/curry/leader_user.h diff --git a/users/curry/rules.mk b/users/curry/rules.mk index 724f97f5eb..aa89110276 100644 --- a/users/curry/rules.mk +++ b/users/curry/rules.mk @@ -29,7 +29,7 @@ ifeq ($(strip $(OLED_ENABLE)), yes) endif ifeq ($(strip $(LEADER_ENABLE)), yes) - SRC += leader.c + SRC += leader_user.c endif ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) diff --git a/users/danielo515/danielo515.c b/users/danielo515/danielo515.c index 1c7718f1d2..aa33f55d66 100644 --- a/users/danielo515/danielo515.c +++ b/users/danielo515/danielo515.c @@ -4,84 +4,121 @@ bool onMac = true; //**************** LEADER *********************// #ifdef LEADER_ENABLE -LEADER_EXTERNS(); +void leader_start_user(vodi) { # ifdef RGBLIGHT_ENABLE - -void leader_start_user(void) { rgblight_setrgb_range(5, 100, 199, 10, 15); }; - -void leader_end_user(void) { rgblight_setrgb_range(200, 200, 255, 10, 15); }; + rgblight_setrgb_range(5, 100, 199, 10, 15); # endif +} -void matrix_scan_user(void) { - if (leading && leader_sequence_size > 0 && timer_elapsed(leader_time) > LEADER_TIMEOUT) { - leading = false; - SEQ_ONE_KEY(KC_T) { SEND_STRING("``" SS_TAP(X_LEFT)); } - // Triple ticks - SEQ_TWO_KEYS(KC_T, KC_T) { SEND_STRING("```" SS_TAP(X_ENTER) SS_TAP(X_ENTER) "```" SS_TAP(X_UP)); } - // ==== International spanish accent vowels ==== - SEQ_ONE_KEY(KC_A) { SEND_STRING(SS_LALT("e") "a"); } - SEQ_ONE_KEY(KC_E) { SEND_STRING(SS_LALT("e") "e"); } - SEQ_ONE_KEY(KC_I) { SEND_STRING(SS_LALT("e") "i"); } - SEQ_ONE_KEY(KC_O) { SEND_STRING(SS_LALT("e") "o"); } - SEQ_ONE_KEY(KC_U) { SEND_STRING(SS_LALT("e") "u"); } - SEQ_ONE_KEY(KC_N) { SEND_STRING(SS_LALT("n") "n"); } - // ==== MACROS === - SEQ_ONE_KEY(KC_G) { SEND_STRING(" | grep "); } - SEQ_ONE_KEY(KC_K) { onMac ? SEND_STRING(SS_LCTL(" ")) : SEND_STRING(SS_LCTL("f")); } - // vim delete all - SEQ_TWO_KEYS(KC_D, KC_G) { - if (onMac) { - SEND_STRING(SS_LGUI("a") SS_TAP(X_D)); - } else { - SEND_STRING(SS_LCTL("a") SS_TAP(X_D)); - } +void leader_end_user() { + if (leader_sequence_one_key(KC_T)) { + SEND_STRING("``" SS_TAP(X_LEFT)); + } + // Triple ticks + if (leader_sequence_two_keys(KC_T, KC_T)) { + SEND_STRING("```" SS_TAP(X_ENTER) SS_TAP(X_ENTER) "```" SS_TAP(X_UP)); + } + // ==== International spanish accent vowels ==== + if (leader_sequence_one_key(KC_A)) { + SEND_STRING(SS_LALT("e") "a"); + } + if (leader_sequence_one_key(KC_E)) { + SEND_STRING(SS_LALT("e") "e"); + } + if (leader_sequence_one_key(KC_I)) { + SEND_STRING(SS_LALT("e") "i"); + } + if (leader_sequence_one_key(KC_O)) { + SEND_STRING(SS_LALT("e") "o"); + } + if (leader_sequence_one_key(KC_U)) { + SEND_STRING(SS_LALT("e") "u"); + } + if (leader_sequence_one_key(KC_N)) { + SEND_STRING(SS_LALT("n") "n"); + } + // ==== MACROS === + if (leader_sequence_one_key(KC_G)) { + SEND_STRING(" | grep "); + } + if (leader_sequence_one_key(KC_K)) { + onMac ? SEND_STRING(SS_LCTL(" ")) : SEND_STRING(SS_LCTL("f")); + } + // vim delete all + if (leader_sequence_two_keys(KC_D, KC_G)) { + if (onMac) { + SEND_STRING(SS_LGUI("a") SS_TAP(X_D)); + } else { + SEND_STRING(SS_LCTL("a") SS_TAP(X_D)); } - // tripe delete! - SEQ_ONE_KEY(KC_BACKSPACE) { SEND_STRING(SS_TAP(X_BACKSPACE) SS_TAP(X_BACKSPACE) SS_TAP(X_BACKSPACE)); } - SEQ_TWO_KEYS(KC_P, KC_G) { SEND_STRING("ps -ef | grep "); } - SEQ_TWO_KEYS(KC_J, KC_A) { SEND_STRING("() => {}" SS_TAP(X_LEFT) SS_TAP(X_LEFT) SS_TAP(X_LEFT) SS_TAP(X_LEFT) SS_TAP(X_LEFT) SS_TAP(X_LEFT) SS_TAP(X_LEFT)); } - // this is a pain to type - SEQ_TWO_KEYS(KC_S, KC_S) { SEND_STRING("~/.ssh/ "); } - SEQ_TWO_KEYS(KC_F, KC_T) { SEND_STRING("feat():" SS_TAP(X_LEFT) SS_TAP(X_LEFT)); } - // ### LAYER CHANGE - SEQ_ONE_KEY(KC_1) { layer_on(1); } - // control enter, because yes - SEQ_ONE_KEY(KC_H) { SEND_STRING(SS_DOWN(X_LCTL) SS_TAP(X_ENTER) SS_UP(X_LCTL)); } - // paste all - SEQ_ONE_KEY(KC_P) { - if (onMac) { - SEND_STRING(SS_LGUI("a") SS_LGUI("v")); - } else { - SEND_STRING(SS_LCTL("a") SS_LCTL("v")); - } + } + // tripe delete! + if (leader_sequence_one_key(KC_BACKSPACE)) { + SEND_STRING(SS_TAP(X_BACKSPACE) SS_TAP(X_BACKSPACE) SS_TAP(X_BACKSPACE)); + } + if (leader_sequence_two_keys(KC_P, KC_G)) { + SEND_STRING("ps -ef | grep "); + } + if (leader_sequence_two_keys(KC_J, KC_A)) { + SEND_STRING("() => {}" SS_TAP(X_LEFT) SS_TAP(X_LEFT) SS_TAP(X_LEFT) SS_TAP(X_LEFT) SS_TAP(X_LEFT) SS_TAP(X_LEFT) SS_TAP(X_LEFT)); + } + // this is a pain to type + if (leader_sequence_two_keys(KC_S, KC_S)) { + SEND_STRING("~/.ssh/ "); + } + if (leader_sequence_two_keys(KC_F, KC_T)) { + SEND_STRING("feat():" SS_TAP(X_LEFT) SS_TAP(X_LEFT)); + } + // ### LAYER CHANGE + if (leader_sequence_one_key(KC_1)) { + layer_on(1); + } + // control enter, because yes + if (leader_sequence_one_key(KC_H)) { + SEND_STRING(SS_DOWN(X_LCTL) SS_TAP(X_ENTER) SS_UP(X_LCTL)); + } + // paste all + if (leader_sequence_one_key(KC_P)) { + if (onMac) { + SEND_STRING(SS_LGUI("a") SS_LGUI("v")); + } else { + SEND_STRING(SS_LCTL("a") SS_LCTL("v")); } - SEQ_THREE_KEYS(KC_M, KC_A, KC_C) { - onMac = true; + } + if (leader_sequence_three_keys(KC_M, KC_A, KC_C)) { + onMac = true; # ifdef RGBLIGHT_ENABLE - rgblight_setrgb(255, 255, 255); + rgblight_setrgb(255, 255, 255); # endif - } - SEQ_THREE_KEYS(KC_W, KC_I, KC_N) { - onMac = false; + } + if (leader_sequence_three_keys(KC_W, KC_I, KC_N)) { + onMac = false; # ifdef RGBLIGHT_ENABLE - rgblight_setrgb(255, 255, 0); + rgblight_setrgb(255, 255, 0); # endif + } + /* Copy all */ + if (leader_sequence_one_key(KC_Y)) { + if (onMac) { + SEND_STRING(SS_LGUI("a") SS_LGUI("c")); + } else { + SEND_STRING(SS_LCTL("a") SS_LCTL("c")); } - /* Copy all */ - SEQ_ONE_KEY(KC_Y) { - if (onMac) { - SEND_STRING(SS_LGUI("a") SS_LGUI("c")); - } else { - SEND_STRING(SS_LCTL("a") SS_LCTL("c")); - } - } - // emoji bar - SEQ_TWO_KEYS(KC_E, KC_E) { SEND_STRING(SS_DOWN(X_LGUI) SS_LCTL(" ") SS_UP(X_LGUI)); } - - SEQ_TWO_KEYS(KC_F, KC_F) { SEND_STRING("ps -ef | grep "); } - SEQ_TWO_KEYS(KC_H, KC_T) { SEND_STRING("https://"); } + } + // emoji bar + if (leader_sequence_two_keys(KC_E, KC_E)) { + SEND_STRING(SS_DOWN(X_LGUI) SS_LCTL(" ") SS_UP(X_LGUI)); + } - leader_end(); + if (leader_sequence_two_keys(KC_F, KC_F)) { + SEND_STRING("ps -ef | grep "); } + if (leader_sequence_two_keys(KC_H, KC_T)) { + SEND_STRING("https://"); + } + +# ifdef RGBLIGHT_ENABLE + rgblight_setrgb_range(200, 200, 255, 10, 15); +# endif } #endif // LEADER diff --git a/users/jjerrell/jjerrell.c b/users/jjerrell/jjerrell.c index 95c2acba5e..47aa9bc042 100644 --- a/users/jjerrell/jjerrell.c +++ b/users/jjerrell/jjerrell.c @@ -23,41 +23,36 @@ __attribute__((weak)) void matrix_scan_keymap(void) {} __attribute__((weak)) void leader_scan_secrets(void) {} #ifdef LEADER_ENABLE - LEADER_EXTERNS(); - void matrix_scan_leader(void) { - static uint8_t mods = 0; - mods = get_mods(); - LEADER_DICTIONARY() { - leading = false; - leader_end(); - clear_mods(); - - // Website Refresh / XCode "Run" - SEQ_ONE_KEY(KC_R) { - SEND_STRING(SS_LGUI("r")); - } - - SEQ_TWO_KEYS(KC_B, KC_D) { - send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION " Built at: " QMK_BUILDDATE), TAP_CODE_DELAY); - } - - SEQ_TWO_KEYS(KC_L, KC_C) { - send_string_with_delay("/** */", TAP_CODE_DELAY); - wait_ms(TAPPING_TERM); - tap_code(KC_LEFT); - tap_code(KC_LEFT); - tap_code(KC_LEFT); - if (!(mods & MOD_MASK_SHIFT)) { - tap_code(KC_ENT); - } - } - - set_mods(mods); - #ifndef NO_SECRETS - leader_scan_secrets(); - #endif // !NO_SECRETS +void leader_end_user(void) { + static uint8_t mods = 0; + mods = get_mods(); + clear_mods(); + + // Website Refresh / XCode "Run" + if (leader_sequence_one_key(KC_R)) { + SEND_STRING(SS_LGUI("r")); + } + + if (leader_sequence_two_keys(KC_B, KC_D)) { + send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION " Built at: " QMK_BUILDDATE), TAP_CODE_DELAY); + } + + if (leader_sequence_two_keys(KC_L, KC_C)) { + send_string_with_delay("/** */", TAP_CODE_DELAY); + wait_ms(TAPPING_TERM); + tap_code(KC_LEFT); + tap_code(KC_LEFT); + tap_code(KC_LEFT); + if (!(mods & MOD_MASK_SHIFT)) { + tap_code(KC_ENT); } } + + set_mods(mods); + #ifndef NO_SECRETS + leader_scan_secrets(); + #endif // !NO_SECRETS +} #endif static bool is_first_run = true; @@ -66,9 +61,7 @@ void matrix_scan_user(void) { is_first_run = false; startup_user(); } - #ifdef LEADER_ENABLE - matrix_scan_leader(); - #endif + matrix_scan_keymap(); } diff --git a/users/kuatsure/kuatsure.c b/users/kuatsure/kuatsure.c index bfdbdd4035..37adc337c1 100644 --- a/users/kuatsure/kuatsure.c +++ b/users/kuatsure/kuatsure.c @@ -53,81 +53,70 @@ void tmux_pane_zoom(void) { SEND_STRING("z"); } -LEADER_EXTERNS(); -void matrix_scan_user(void) { - LEADER_DICTIONARY() { - leading = false; - leader_end(); - - // Available seqs - // SEQ_ONE_KEY, SEQ_TWO_KEYS, SEQ_THREE_KEYS - // anything you can do in a macro https://docs.qmk.fm/macros.html - // https://docs.qmk.fm/feature_leader_key.html - - // Stop music and lock computer via alfred - SEQ_ONE_KEY(KC_H) { - SEND_STRING(SS_LGUI(" ") SS_TAP(X_LGUI) "afk" SS_TAP(X_ENTER)); - } - - // Stop music and lock computer via alfred - SEQ_TWO_KEYS(KC_H, KC_H) { - SEND_STRING(SS_LGUI(" ") SS_TAP(X_LGUI) "afk" SS_TAP(X_ENTER) SS_TAP(X_MEDIA_PLAY_PAUSE)); - } - - // Whole Screen Shot - SEQ_ONE_KEY(KC_A) { - SEND_STRING(SS_LGUI(SS_LSFT("3"))); - } - - // Selective Screen Shot - SEQ_ONE_KEY(KC_S) { - SEND_STRING(SS_LGUI(SS_LSFT("4"))); - } - - // TMUX - shift to pane 1 and zoom - SEQ_ONE_KEY(KC_J) { - tmux_prefix(); - SEND_STRING("q1"); - tmux_pane_zoom(); - } - - // TMUX - shift to first window - SEQ_TWO_KEYS(KC_J, KC_J) { - tmux_prefix(); - SEND_STRING("1"); - } - - // TMUX - shift to pane 2 and zoom - SEQ_ONE_KEY(KC_K) { - tmux_prefix(); - SEND_STRING("q2"); - tmux_pane_zoom(); - } - - // TMUX - shift to second window - SEQ_TWO_KEYS(KC_K, KC_K) { - tmux_prefix(); - SEND_STRING("2"); - } - - // TMUX - shift to pane 3 and zoom - SEQ_ONE_KEY(KC_L) { - tmux_prefix(); - SEND_STRING("q3"); - tmux_pane_zoom(); - } - - // TMUX - shift to third window - SEQ_TWO_KEYS(KC_L, KC_L) { - tmux_prefix(); - SEND_STRING("3"); - } - - // TMUX - shift to last pane and zoom - SEQ_ONE_KEY(KC_SEMICOLON) { - tmux_prefix(); - SEND_STRING(";"); - tmux_pane_zoom(); - } +void leader_end_user(void) { + // Stop music and lock computer via alfred + if (leader_sequence_one_key(KC_H)) { + SEND_STRING(SS_LGUI(" ") SS_TAP(X_LGUI) "afk" SS_TAP(X_ENTER)); + } + + // Stop music and lock computer via alfred + if (leader_sequence_two_keys(KC_H, KC_H)) { + SEND_STRING(SS_LGUI(" ") SS_TAP(X_LGUI) "afk" SS_TAP(X_ENTER) SS_TAP(X_MEDIA_PLAY_PAUSE)); + } + + // Whole Screen Shot + if (leader_sequence_one_key(KC_A)) { + SEND_STRING(SS_LGUI(SS_LSFT("3"))); + } + + // Selective Screen Shot + if (leader_sequence_one_key(KC_S)) { + SEND_STRING(SS_LGUI(SS_LSFT("4"))); + } + + // TMUX - shift to pane 1 and zoom + if (leader_sequence_one_key(KC_J)) { + tmux_prefix(); + SEND_STRING("q1"); + tmux_pane_zoom(); + } + + // TMUX - shift to first window + if (leader_sequence_two_keys(KC_J, KC_J)) { + tmux_prefix(); + SEND_STRING("1"); + } + + // TMUX - shift to pane 2 and zoom + if (leader_sequence_one_key(KC_K)) { + tmux_prefix(); + SEND_STRING("q2"); + tmux_pane_zoom(); + } + + // TMUX - shift to second window + if (leader_sequence_two_keys(KC_K, KC_K)) { + tmux_prefix(); + SEND_STRING("2"); + } + + // TMUX - shift to pane 3 and zoom + if (leader_sequence_one_key(KC_L)) { + tmux_prefix(); + SEND_STRING("q3"); + tmux_pane_zoom(); + } + + // TMUX - shift to third window + if (leader_sequence_two_keys(KC_L, KC_L)) { + tmux_prefix(); + SEND_STRING("3"); + } + + // TMUX - shift to last pane and zoom + if (leader_sequence_one_key(KC_SEMICOLON)) { + tmux_prefix(); + SEND_STRING(";"); + tmux_pane_zoom(); } } diff --git a/users/kuchosauronad0/leader.c b/users/kuchosauronad0/leader.c deleted file mode 100644 index e8935ec401..0000000000 --- a/users/kuchosauronad0/leader.c +++ /dev/null @@ -1,116 +0,0 @@ -#include "leader.h" -#ifdef RGBLIGHT_ENABLE -extern rgblight_config_t rgblight_config; -#endif -bool leader_succeed; - -LEADER_EXTERNS(); - -void matrix_scan_user(void) { - static bool has_ran_yet; - if (!has_ran_yet) { - has_ran_yet = true; - startup_user(); - } -#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. -// run_diablo_macro_check(); -#endif -#ifdef RGBLIGHT_ENABLE - matrix_scan_rgb(); -#endif - LEADER_DICTIONARY() { - leader_succeed = leading = false; - - SEQ_ONE_KEY(KC_W) { - // vim/tmux: Use in command mode in vim: write to file, switch tmux pane in the current session window and repeat the last command - SEND_STRING(":w" SS_TAP(X_ENTER)); - tmux_pane_switch_repeat(); - leader_succeed = true; - } else - SEQ_ONE_KEY(KC_T) { - // Send the Tmux Prefix - tmux_prefix(); - leader_succeed = true; - } else - SEQ_ONE_KEY(KC_A) { - // tmux: Send the prefix and press 'right' arrow - tmux_prefix(); - tap_code(KC_RIGHT); - leader_succeed = true; - } else - SEQ_TWO_KEYS(KC_T, KC_T) { - // tmux: Send the prefix to a nested session - tmux_prefix(); - tmux_prefix(); - leader_succeed = true; - } else - SEQ_TWO_KEYS(KC_T, KC_R) { - // tmux: Switch pane and repeat last action - tmux_pane_switch_repeat(); - leader_succeed = true; - } else - SEQ_TWO_KEYS(KC_V, KC_Z){ - // vim: Zoom pane - tap_code16(LCTL(KC_W)); - tap_code16(LSFT(KC_BSLS)); - leader_succeed = true; - } else - SEQ_TWO_KEYS(KC_V, KC_R) { - // vim: Substitute and place cursor - SEND_STRING(":%s///g" SS_TAP(X_LEFT)); - tap_code(KC_LEFT); - tap_code(KC_LEFT); - leader_succeed = true; - } else - SEQ_TWO_KEYS(KC_V, KC_T) { - // vim: move current pane to new tab - tap_code16(LCTL(KC_W)); - tap_code16(LSFT(KC_T)); - leader_succeed = true; - } else - SEQ_ONE_KEY(KC_R){ - // Toggle RGB Layer indicator - tap_code16(KC_RGB_T); - leader_succeed = true; - } else - SEQ_ONE_KEY(KC_SPC){ - // One Shot Unicode layer -//TODO tap_code16(OS_UNI); - leader_succeed = true; - } else - SEQ_TWO_KEYS(KC_SPC, KC_SPC){ - // Toggle _MODS - tap_code16(TG_MODS); - leader_succeed = true; - } else - SEQ_THREE_KEYS(KC_BSPC, KC_BSPC, KC_BSPC){ - // Reset the keyboard - reset_keyboard(); - leader_succeed = true; - } - leader_end(); - } -// matrix_scan_keymap(); -} - -void leader_start_user(void) { -#ifdef RGBLIGHT_ENABLE - rgblight_savebase(); - rgblight_mode_noeeprom(1); - rgblight_sethsv_noeeprom(HSV_GOLDENROD); -#endif -} - -void leader_end_user(void) { -// pick color depending of success /fail -// fade leader_start from 100 to 0 -// fade new color from 0 to 100 to 0 -// fade old color from 0 to 100 -#ifdef RGBLIGHT_ENABLE - if (leader_succeed) { - fadeflash_leds(HSV_GREEN); - } else { - fadeflash_leds(HSV_RED); - } -#endif -} diff --git a/users/kuchosauronad0/leader_user.c b/users/kuchosauronad0/leader_user.c new file mode 100644 index 0000000000..fd356021a6 --- /dev/null +++ b/users/kuchosauronad0/leader_user.c @@ -0,0 +1,113 @@ +#include "leader_user.h" +#ifdef RGBLIGHT_ENABLE +extern rgblight_config_t rgblight_config; +#endif +bool leader_succeed; + +void matrix_scan_user(void) { + static bool has_ran_yet; + if (!has_ran_yet) { + has_ran_yet = true; + startup_user(); + } +#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. +// run_diablo_macro_check(); +#endif +#ifdef RGBLIGHT_ENABLE + matrix_scan_rgb(); +#endif + +// matrix_scan_keymap(); +} + +void leader_start_user(void) { +#ifdef RGBLIGHT_ENABLE + rgblight_savebase(); + rgblight_mode_noeeprom(1); + rgblight_sethsv_noeeprom(HSV_GOLDENROD); +#endif +} + +void leader_end_user(void) { + leader_succeed = false; + + if (leader_sequence_one_key(KC_W)) { + // vim/tmux: Use in command mode in vim: write to file, switch tmux pane in the current session window and repeat the last command + SEND_STRING(":w" SS_TAP(X_ENTER)); + tmux_pane_switch_repeat(); + leader_succeed = true; + } else + if (leader_sequence_one_key(KC_T)) { + // Send the Tmux Prefix + tmux_prefix(); + leader_succeed = true; + } else + if (leader_sequence_one_key(KC_A)) { + // tmux: Send the prefix and press 'right' arrow + tmux_prefix(); + tap_code(KC_RIGHT); + leader_succeed = true; + } else + if (leader_sequence_two_keys(KC_T, KC_T)) { + // tmux: Send the prefix to a nested session + tmux_prefix(); + tmux_prefix(); + leader_succeed = true; + } else + if (leader_sequence_two_keys(KC_T, KC_R)) { + // tmux: Switch pane and repeat last action + tmux_pane_switch_repeat(); + leader_succeed = true; + } else + if (leader_sequence_two_keys(KC_V, KC_Z)){ + // vim: Zoom pane + tap_code16(LCTL(KC_W)); + tap_code16(LSFT(KC_BSLS)); + leader_succeed = true; + } else + if (leader_sequence_two_keys(KC_V, KC_R)) { + // vim: Substitute and place cursor + SEND_STRING(":%s///g" SS_TAP(X_LEFT)); + tap_code(KC_LEFT); + tap_code(KC_LEFT); + leader_succeed = true; + } else + if (leader_sequence_two_keys(KC_V, KC_T)) { + // vim: move current pane to new tab + tap_code16(LCTL(KC_W)); + tap_code16(LSFT(KC_T)); + leader_succeed = true; + } else + if (leader_sequence_one_key(KC_R)){ + // Toggle RGB Layer indicator + tap_code16(KC_RGB_T); + leader_succeed = true; + } else + if (leader_sequence_one_key(KC_SPC)){ + // One Shot Unicode layer +//TODO tap_code16(OS_UNI); + leader_succeed = true; + } else + if (leader_sequence_two_keys(KC_SPC, KC_SPC)){ + // Toggle _MODS + tap_code16(TG_MODS); + leader_succeed = true; + } else + if (leader_sequence_three_keys(KC_BSPC, KC_BSPC, KC_BSPC)){ + // Reset the keyboard + reset_keyboard(); + leader_succeed = true; + } + +// pick color depending of success /fail +// fade leader_start from 100 to 0 +// fade new color from 0 to 100 to 0 +// fade old color from 0 to 100 +#ifdef RGBLIGHT_ENABLE + if (leader_succeed) { + fadeflash_leds(HSV_GREEN); + } else { + fadeflash_leds(HSV_RED); + } +#endif +} diff --git a/users/kuchosauronad0/leader.h b/users/kuchosauronad0/leader_user.h index ed904f3063..d68dc80c13 100644 --- a/users/kuchosauronad0/leader.h +++ b/users/kuchosauronad0/leader_user.h @@ -1,6 +1,6 @@ #pragma once #include "kuchosauronad0.h" -#include "leader.h" +#include "leader_user.h" void matrix_scan_user(void); diff --git a/users/kuchosauronad0/readme.md b/users/kuchosauronad0/readme.md index b577eedb70..88cc4cd374 100644 --- a/users/kuchosauronad0/readme.md +++ b/users/kuchosauronad0/readme.md @@ -38,7 +38,7 @@ TODO: Make use of `TD_SPC` and `TD_QT{1..3}` ## [Leader Key](#leader-key) To enable set `LEADER_ENABLE = yes` in file *rules.mk* -|LEADER_DICTIONARY()|program| description | +|Leader sequence|program| description | |---|---|---| | W |vim/tmux| save file, switch pane and repeat last command | | T |tmux| send default prefix | @@ -50,7 +50,7 @@ To enable set `LEADER_ENABLE = yes` in file *rules.mk* |V + T|vim | move current split to its own tab| |3x Backspace|keyboard| Reset Keyboard | -`LEADER_DICTIONARY()` is defined in *leader.c* +Leader sequences are defined in *leader_user.c* ## [Combo Keys](#combo-keys) To enable set `COMBO_ENABLE = yes` in file *rules.mk*. diff --git a/users/kuchosauronad0/rgblight_user.c b/users/kuchosauronad0/rgblight_user.c index 77a8ac6df8..1b5c29cfb0 100644 --- a/users/kuchosauronad0/rgblight_user.c +++ b/users/kuchosauronad0/rgblight_user.c @@ -145,7 +145,7 @@ void rgblight_fade_helper(bool direction){ void fadeflash_leds(uint8_t hue, uint8_t sat, uint8_t val){ // indicate success / fail of a leader sequence // fade out, set new hue and saturation, fade in, fade out, set old color, fade in - // this is used in leader.c + // this is used in leader_user.c // TODO: come up with a better name maybe rgblight_fade_helper(false); rgblight_sethsv_noeeprom(hue, sat, 0); diff --git a/users/kuchosauronad0/rules.mk b/users/kuchosauronad0/rules.mk index dfab85703c..a65fe9d258 100644 --- a/users/kuchosauronad0/rules.mk +++ b/users/kuchosauronad0/rules.mk @@ -21,7 +21,7 @@ ifeq ($(strip $(COMBO_ENABLE)), yes) endif ifeq ($(strip $(LEADER_ENABLE)), yes) - SRC += leader.c + SRC += leader_user.c endif ifneq ("$(wildcard $(USER_PATH)/secrets.c)","") diff --git a/users/sigma/sigma.c b/users/sigma/sigma.c index 9a0786233b..bd66729bdc 100644 --- a/users/sigma/sigma.c +++ b/users/sigma/sigma.c @@ -90,26 +90,19 @@ void store_userspace_config(void) { eeconfig_update_user(stored_userspace_config.raw); } -LEADER_EXTERNS(); - -void matrix_scan_user(void) { - LEADER_DICTIONARY() { - leading = false; - leader_end(); - - SEQ_TWO_KEYS(KC_F1, KC_L) { - set_os(_OS_LINUX); - } - SEQ_TWO_KEYS(KC_F1, KC_M) { - set_os(_OS_MACOS); - } - SEQ_TWO_KEYS(KC_F1, KC_W) { - set_os(_OS_WINDOWS); - } - SEQ_TWO_KEYS(KC_F1, KC_S) { - stored_userspace_config.raw = runtime_userspace_config.raw; - store_userspace_config(); - } +void leader_end_user(void) { + if (leader_sequence_two_keys(KC_F1, KC_L)) { + set_os(_OS_LINUX); + } + if (leader_sequence_two_keys(KC_F1, KC_M)) { + set_os(_OS_MACOS); + } + if (leader_sequence_two_keys(KC_F1, KC_W)) { + set_os(_OS_WINDOWS); + } + if (leader_sequence_two_keys(KC_F1, KC_S)) { + stored_userspace_config.raw = runtime_userspace_config.raw; + store_userspace_config(); } } diff --git a/users/uqs/uqs.c b/users/uqs/uqs.c index bccab617ac..83733bbe2a 100644 --- a/users/uqs/uqs.c +++ b/users/uqs/uqs.c @@ -534,43 +534,36 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } #ifdef LEADER_ENABLE -LEADER_EXTERNS(); - -void matrix_scan_user(void) { - LEADER_DICTIONARY() { - leading = false; - leader_end(); - +void leader_end_user(void) { #ifdef UCIS_ENABLE - SEQ_ONE_KEY(KC_U) { - ucis_start(); + if (leader_sequence_one_key(KC_U)) { + ucis_start(); } #endif - SEQ_ONE_KEY(KC_H) { - send_unicode_string("ᕕ( ᐛ )ᕗ"); // happy + if (leader_sequence_one_key(KC_H)) { + send_unicode_string("ᕕ( ᐛ )ᕗ"); // happy } - SEQ_ONE_KEY(KC_D) { - send_unicode_string("ಠ_ಠ"); // disapproval + if (leader_sequence_one_key(KC_D)) { + send_unicode_string("ಠ_ಠ"); // disapproval } - SEQ_ONE_KEY(KC_L) { - send_unicode_string("( ͡° ͜ʖ ͡°)"); // lenny + if (leader_sequence_one_key(KC_L)) { + send_unicode_string("( ͡° ͜ʖ ͡°)"); // lenny } - SEQ_ONE_KEY(KC_S) { - send_unicode_string("¯\\_(ツ)_/¯"); // shrug + if (leader_sequence_one_key(KC_S)) { + send_unicode_string("¯\\_(ツ)_/¯"); // shrug } // tableflip (LEADER - TF) - SEQ_TWO_KEYS(KC_T, KC_F) { - //set_unicode_input_mode(UNICODE_MODE_LINUX); - //send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B"); - send_unicode_string("(╯°□°)╯︵ ┻━┻"); + if (leader_sequence_two_keys(KC_T, KC_F)) { + //set_unicode_input_mode(UNICODE_MODE_LINUX); + //send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B"); + send_unicode_string("(╯°□°)╯︵ ┻━┻"); } // untableflip - SEQ_THREE_KEYS(KC_U, KC_T, KC_F) { - //set_unicode_input_mode(UNICODE_MODE_LINUX); - //send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B"); - send_unicode_string("┬─┬ノ( º _ ºノ)"); + if (leader_sequence_three_keys(KC_U, KC_T, KC_F)) { + //set_unicode_input_mode(UNICODE_MODE_LINUX); + //send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B"); + send_unicode_string("┬─┬ノ( º _ ºノ)"); } - } } #endif diff --git a/users/yet-another-developer/leader.c b/users/yet-another-developer/leader.c deleted file mode 100644 index 3cbbf8d70e..0000000000 --- a/users/yet-another-developer/leader.c +++ /dev/null @@ -1,46 +0,0 @@ -#include "leader.h" - -LEADER_EXTERNS(); - -// Runs constantly in the background, in a loop. -void matrix_scan_user(void){ - -#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. -// run_diablo_macro_check(); -#endif // TAP_DANCE_ENABLE - -#ifdef RGBLIGHT_ENABLE - matrix_scan_rgb(); -#endif // RGBLIGHT_ENABLE - - LEADER_DICTIONARY() { - leading = false; - leader_end(); - - SEQ_TWO_KEYS(KC_V, KC_Z){ - // vim: Zoom pane - tap_code16(LCTL(KC_W)); - tap_code16(LSFT(KC_BSLS)); - } - - SEQ_TWO_KEYS(KC_V, KC_R) { - // vim: Substitute and place cursor - SEND_STRING(":%s///g" SS_TAP(X_LEFT)); - tap_code(KC_LEFT); - tap_code(KC_LEFT); - } - - SEQ_TWO_KEYS(KC_V, KC_T) { - // vim: move current pane to new tab - tap_code16(LCTL(KC_W)); - tap_code16(LSFT(KC_T)); - } - - SEQ_THREE_KEYS(KC_BSPC, KC_BSPC, KC_BSPC){ - // Reset the keyboard - reset_keyboard(); - } - } - - matrix_scan_keymap(); -} diff --git a/users/yet-another-developer/leader_user.c b/users/yet-another-developer/leader_user.c new file mode 100644 index 0000000000..53a7e2d7e5 --- /dev/null +++ b/users/yet-another-developer/leader_user.c @@ -0,0 +1,41 @@ +#include "leader_user.h" + +void leader_end_user(void) { + if (leader_sequence_two_keys(KC_V, KC_Z)){ + // vim: Zoom pane + tap_code16(LCTL(KC_W)); + tap_code16(LSFT(KC_BSLS)); + } + + if (leader_sequence_two_keys(KC_V, KC_R)) { + // vim: Substitute and place cursor + SEND_STRING(":%s///g" SS_TAP(X_LEFT)); + tap_code(KC_LEFT); + tap_code(KC_LEFT); + } + + if (leader_sequence_two_keys(KC_V, KC_T)) { + // vim: move current pane to new tab + tap_code16(LCTL(KC_W)); + tap_code16(LSFT(KC_T)); + } + + if (leader_sequence_three_keys(KC_BSPC, KC_BSPC, KC_BSPC)){ + // Reset the keyboard + reset_keyboard(); + } +} + +// Runs constantly in the background, in a loop. +void matrix_scan_user(void){ + +#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. +// run_diablo_macro_check(); +#endif // TAP_DANCE_ENABLE + +#ifdef RGBLIGHT_ENABLE + matrix_scan_rgb(); +#endif // RGBLIGHT_ENABLE + + matrix_scan_keymap(); +} diff --git a/users/yet-another-developer/leader.h b/users/yet-another-developer/leader_user.h index 7ed6c8a82c..84cc6f65fa 100644 --- a/users/yet-another-developer/leader.h +++ b/users/yet-another-developer/leader_user.h @@ -1,6 +1,6 @@ #pragma once #include "yet-another-developer.h" -#include "leader.h" +#include "leader_user.h" void matrix_scan_user(void); diff --git a/users/yet-another-developer/rules.mk b/users/yet-another-developer/rules.mk index 64cf1f2fce..9afa78e3f7 100644 --- a/users/yet-another-developer/rules.mk +++ b/users/yet-another-developer/rules.mk @@ -14,7 +14,7 @@ endif ifeq ($(strip $(LEADER_ENABLE)), yes) - SRC += leader.c + SRC += leader_user.c endif |