Skip to content

Commit

Permalink
keymap.c: Enabling combos.
Browse files Browse the repository at this point in the history
  • Loading branch information
toddyamakawa committed Apr 13, 2021
1 parent 168a141 commit c3d027e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 16 deletions.
2 changes: 2 additions & 0 deletions keyboards/kyria/keymaps/toddyamakawa/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#define RGBLIGHT_LIMIT_VAL 150
#endif

#define COMBO_COUNT 1

// If you are using an Elite C rev3 on the slave side, uncomment the lines below:
// #define SPLIT_USB_DETECT
// #define NO_USB_STARTUP_CHECK
35 changes: 20 additions & 15 deletions keyboards/kyria/keymaps/toddyamakawa/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@
#define PINK_L2 VIM_ESC
#define PINK_L3 KC_LSFT

enum layers {
_QWERTY = 0,
_LOWER,
_RAISE,
_ADJUST
};

enum combos {
CO_QWER
};
Expand All @@ -79,39 +86,38 @@ enum combos {
}
bool vim_key(uint16_t keycode, keyrecord_t *record);

typedef enum {
VIM_NONE,
VIM_DELETE,
VIM_CHANGE,
VIM_YANK
} vim_action_t;
typedef struct {
bool enabled;
bool visual;
bool set_go;
bool go;
vim_action_t action;
} vim_state_t;

enum layers {
_QWERTY = 0,
_LOWER,
_RAISE,
_ADJUST
};

enum custom_keycodes {
VIM_ESC = SAFE_RANGE
};

static vim_state_t vim = {false, false, false, false};
static vim_state_t vim = {false, false, false, false, VIM_NONE};


// =============================================================================
// COMBOS
// =============================================================================
// config.h: #define COMBO_COUNT <count>
// rules.mk: COMBO_ENABLE = yes
const uint16_t PROGMEM qwer_combo[] = {KC_Q, KC_W, KC_E, KC_R, COMBO_END};
combo_t key_combos[COMBO_COUNT] = {
[CO_QWER] = COMBO(qwer_combo, KC_TAB)

};


const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

// ====================================================================================================================================
// BASE LAYER: QWERTY
// ====================================================================================================================================
Expand Down Expand Up @@ -345,6 +351,9 @@ bool vim_key(uint16_t keycode, keyrecord_t *record) {
break;

// Navigation
case KC_G:
vim.set_go = true;
break;
case KC_H:
tap_code(vim.go ? KC_HOME : KC_LEFT);
break;
Expand All @@ -367,10 +376,6 @@ bool vim_key(uint16_t keycode, keyrecord_t *record) {
CTRL_TAP(KC_LEFT);
break;

case KC_G:
vim.set_go = true;
break;

// Paste
case KC_P:
if(vim.visual) {
Expand Down
5 changes: 4 additions & 1 deletion keyboards/kyria/keymaps/toddyamakawa/rules.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
OLED_DRIVER_ENABLE = yes # Enables the use of OLED displays
ENCODER_ENABLE = yes # Enables the use of one or more encoders
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow

COMBO_ENABLE = yes

0 comments on commit c3d027e

Please sign in to comment.