summaryrefslogtreecommitdiff
path: root/users/yet-another-developer
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2023-02-13 03:19:02 +1100
committerGitHub <noreply@github.com>2023-02-13 03:19:02 +1100
commitbbf7a20b33de2d203518687cb5cd1aa85005ea27 (patch)
treeee1a5c412a02021d085c81a26321c3424eca7022 /users/yet-another-developer
parentd10350cd2ceb2b9d80522cdec3ea908118f7fd35 (diff)
Refactor Leader key feature (#19632)
Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'users/yet-another-developer')
-rw-r--r--users/yet-another-developer/leader.c46
-rw-r--r--users/yet-another-developer/leader_user.c41
-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.mk2
4 files changed, 43 insertions, 48 deletions
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