Last active
July 6, 2018 07:00
-
-
Save yfuku/607b1cb138f07e56555f62f65b79f697 to your computer and use it in GitHub Desktop.
ErgoDox EZ keymap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include QMK_KEYBOARD_H | |
#include "debug.h" | |
#include "action_layer.h" | |
#include "version.h" | |
#include "keymap_jp.h" | |
#define BASE 0 // default layer | |
#define SYMB 1 // symbols | |
#define MDIA 2 // media keys | |
#define XXXXXXX KC_NO | |
#define _______ KC_TRNS | |
enum custom_keycodes { | |
PLACEHOLDER = SAFE_RANGE, // can always be here | |
EPRM, | |
VRSN, | |
RGB_SLD | |
}; | |
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |
/* Keymap 0: Basic layer | |
* | |
* ,--------------------------------------------------. ,--------------------------------------------------. | |
* | Esc | 1 | 2 | 3 | 4 | 5 | YEN | | ^ | 6 | 7 | 8 | 9 | 0 | - | | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| | |
* | Tab | Q | W | E | R | T | | | | Y | U | I | O | P | @ | | |
* |--------+------+------+------+------+------| [ | | ] |------+------+------+------+------+--------| | |
* | Cmd | A | S | D | F | G |------| |------| H | J | K | L | ; | : | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| | |
* | Shift | Z | X | C | V | B | ESC | | - | N | M | , | . | / | _ | | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' | |
* |Ctrl |Option| | | LANG2| |LANG1 | | | | | | |
* `----------------------------------' `----------------------------------' | |
* ,-------------. ,-------------. | |
* | | | | ← | → | | |
* ,------|------|------| |------+--------+------. | |
* | | | | | ↑ | | | | |
* | SPC | BS |------| |------| Del |Enter | | |
* | / LT1| | | | ↓ | / Shift|/ LT2 | | |
* `--------------------' `----------------------' | |
*/ | |
// If it accepts an argument (i.e, is a function), it doesn't need KC_. | |
// Otherwise, it needs KC_* | |
[BASE] = LAYOUT_ergodox( // layer 0 : default | |
// left hand | |
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, JP_YEN, | |
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, JP_LBRC, | |
KC_LGUI, KC_A, KC_S, KC_D, KC_F, KC_G, | |
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_ESC, | |
KC_LCTRL, KC_LALT, XXXXXXX, XXXXXXX, KC_LANG2, | |
XXXXXXX, XXXXXXX, | |
XXXXXXX, | |
LT(1, KC_SPC), KC_BSPC, KC_LCTRL, | |
// right hand | |
JP_CIRC, KC_6, KC_7, KC_8, KC_9, KC_0, JP_MINS, | |
JP_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, JP_AT, | |
KC_H, KC_J, KC_K, KC_L, JP_SCLN, JP_COLN, | |
JP_MINS, KC_N, KC_M, JP_COMM, JP_DOT, JP_SLSH, JP_UNDS, | |
KC_LANG1, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, | |
KC_LEFT, KC_RIGHT, | |
KC_UP, | |
KC_DOWN, RSFT_T(KC_DEL), LT(2,KC_ENT) | |
), | |
/* Keymap 1: Symbol Layer | |
* | |
* ,---------------------------------------------------. ,--------------------------------------------------. | |
* | | | | | | | | | | | | | | | | | |
* |---------+------+------+------+------+------+------| |------+------+------+------+------+------+--------| | |
* | | ! | " | # | $ | % | | | | & | ' | ( | ) | 0 | = | | |
* |---------+------+------+------+------+------| | | |------+------+------+------+------+--------| | |
* | | 1 | 2 | 3 | 4 | 5 |------| |------| 6 | 7 | 8 | 9 | 0 | - | | |
* |---------+------+------+------+------+------| | | |------+------+------+------+------+--------| | |
* | | | | | | | | | | | | | | | | | |
* `---------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' | |
* | | | | | | | | | | | | | |
* `-----------------------------------' `----------------------------------' | |
* ,-------------. ,-------------. | |
* | | | | | | | |
* ,------|------|------| |------+------+------. | |
* | | | | | | | | | |
* | | |------| |------| | | | |
* | | | | | | | | | |
* `--------------------' `--------------------' | |
*/ | |
// SYMBOLS | |
[SYMB] = LAYOUT_ergodox( | |
// left hand | |
_______,_______,_______,_______,_______,_______,_______, | |
_______,S(KC_1),S(KC_2),S(KC_3),S(KC_4),S(KC_5),_______, | |
_______,KC_1, KC_2, KC_3, KC_4, KC_5, | |
_______,_______,_______,_______,_______,_______,_______, | |
_______,_______,_______,_______,_______, | |
_______,_______, | |
_______, | |
_______,_______,_______, | |
// right hand | |
_______, _______, _______,_______,_______,_______,_______, | |
JP_CIRC, S(KC_6), S(KC_7),S(KC_8),S(KC_9),S(KC_0),S(JP_MINS), | |
KC_6, KC_7, KC_8, KC_9, KC_0, JP_MINS, | |
_______, _______, _______,_______,_______,_______,_______, | |
_______,_______,_______,_______,_______, | |
_______, _______, | |
_______, | |
_______, _______, _______ | |
), | |
/* Keymap 2: Media and mouse keys | |
* | |
* ,--------------------------------------------------. ,--------------------------------------------------. | |
* | RESET | | | | | | | | | | | | | | | | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| | |
* | | | | MsUp | | | | | | |Ctl(A)|ctl(E)| | | | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| | |
* | | |MsLeft|MsDown|MsRght| |------| |------| left | down | up |right | | | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| | |
* | | | | | | | | | | | | | | | | | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' | |
* | | | | Lclk | Rclk | | | | | | | | |
* `----------------------------------' `----------------------------------' | |
* ,-------------. ,-------------. | |
* | F1 | F2 | |Vol Dw|Vol Up| | |
* ,------|------|------| |------+------+------. | |
* | | | | | | | | | |
* | | |------| |------| | | | |
* | | | | | | | | | |
* `--------------------' `--------------------' | |
*/ | |
// MEDIA AND MOUSE | |
[MDIA] = LAYOUT_ergodox( | |
RESET, _______, _______, _______, _______, _______, _______, | |
_______, _______, KC_BTN1, KC_MS_U, KC_BTN2, _______, _______, | |
_______, _______, KC_MS_L, KC_MS_D, KC_MS_R, _______, | |
_______, _______, _______, _______, _______, _______, _______, | |
_______, _______, _______, KC_BTN1, KC_BTN2, | |
KC_F1, KC_F2, | |
_______, | |
_______, _______, _______, | |
// right hand | |
_______, _______, _______, _______, _______, _______, _______, | |
_______, _______, LCTL(KC_A), LCTL(KC_E), _______, _______, _______, | |
KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, _______, _______, | |
_______, _______, _______, _______, _______, _______, _______, | |
_______, _______, _______, _______, _______, | |
KC__VOLDOWN, KC__VOLUP, | |
_______, | |
_______, _______, _______ | |
), | |
}; | |
const uint16_t PROGMEM fn_actions[] = { | |
[1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols) | |
}; | |
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | |
{ | |
// MACRODOWN only works in this function | |
switch(id) { | |
case 0: | |
if (record->event.pressed) { | |
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); | |
} | |
break; | |
case 1: | |
if (record->event.pressed) { // For resetting EEPROM | |
eeconfig_init(); | |
} | |
break; | |
} | |
return MACRO_NONE; | |
}; | |
bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |
switch (keycode) { | |
// dynamically generate these. | |
case EPRM: | |
if (record->event.pressed) { | |
eeconfig_init(); | |
} | |
return false; | |
break; | |
case VRSN: | |
if (record->event.pressed) { | |
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); | |
} | |
return false; | |
break; | |
case RGB_SLD: | |
if (record->event.pressed) { | |
#ifdef RGBLIGHT_ENABLE | |
rgblight_mode(1); | |
#endif | |
} | |
return false; | |
break; | |
} | |
return true; | |
} | |
// Runs just one time when the keyboard initializes. | |
void matrix_init_user(void) { | |
#ifdef RGBLIGHT_COLOR_LAYER_0 | |
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_0); | |
#endif | |
}; | |
// Runs constantly in the background, in a loop. | |
void matrix_scan_user(void) { | |
}; | |
// Runs whenever there is a layer state change. | |
uint32_t layer_state_set_user(uint32_t state) { | |
ergodox_board_led_off(); | |
ergodox_right_led_1_off(); | |
ergodox_right_led_2_off(); | |
ergodox_right_led_3_off(); | |
uint8_t layer = biton32(state); | |
switch (layer) { | |
case 0: | |
#ifdef RGBLIGHT_COLOR_LAYER_0 | |
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_0); | |
#else | |
#ifdef RGBLIGHT_ENABLE | |
rgblight_init(); | |
#endif | |
#endif | |
break; | |
case 1: | |
ergodox_right_led_1_on(); | |
#ifdef RGBLIGHT_COLOR_LAYER_1 | |
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_1); | |
#endif | |
break; | |
case 2: | |
ergodox_right_led_2_on(); | |
#ifdef RGBLIGHT_COLOR_LAYER_2 | |
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_2); | |
#endif | |
break; | |
case 3: | |
ergodox_right_led_3_on(); | |
#ifdef RGBLIGHT_COLOR_LAYER_3 | |
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_3); | |
#endif | |
break; | |
case 4: | |
ergodox_right_led_1_on(); | |
ergodox_right_led_2_on(); | |
#ifdef RGBLIGHT_COLOR_LAYER_4 | |
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_4); | |
#endif | |
break; | |
case 5: | |
ergodox_right_led_1_on(); | |
ergodox_right_led_3_on(); | |
#ifdef RGBLIGHT_COLOR_LAYER_5 | |
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_5); | |
#endif | |
break; | |
case 6: | |
ergodox_right_led_2_on(); | |
ergodox_right_led_3_on(); | |
#ifdef RGBLIGHT_COLOR_LAYER_6 | |
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_6); | |
#endif | |
break; | |
case 7: | |
ergodox_right_led_1_on(); | |
ergodox_right_led_2_on(); | |
ergodox_right_led_3_on(); | |
#ifdef RGBLIGHT_COLOR_LAYER_7 | |
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_6); | |
#endif | |
break; | |
default: | |
break; | |
} | |
return state; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Keymap 0: Basic layer | |
* | |
* ,--------------------------------------------------. ,--------------------------------------------------. | |
* | Esc | 1 | 2 | 3 | 4 | 5 | YEN | | ^ | 6 | 7 | 8 | 9 | 0 | - | | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| | |
* | Tab | Q | W | E | R | T | | | | Y | U | I | O | P | @ | | |
* |--------+------+------+------+------+------| [ | | ] |------+------+------+------+------+--------| | |
* | Cmd | A | S | D | F | G |------| |------| H | J | K | L | ; | : | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| | |
* | Shift | Z | X | C | V | B | ESC | | - | N | M | , | . | / | _ | | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' | |
* |Ctrl |Option| | | LANG2| |LANG1 | | | | | | |
* `----------------------------------' `----------------------------------' | |
* ,-------------. ,-------------. | |
* | | | | ← | → | | |
* ,------|------|------| |------+--------+------. | |
* | | | | | ↑ | | | | |
* | SPC | BS |------| |------| Del |Enter | | |
* | / LT1| | | | ↓ | / Shift|/ LT2 | | |
* `--------------------' `----------------------' | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Keymap 1: Symbol Layer | |
* | |
* ,---------------------------------------------------. ,--------------------------------------------------. | |
* | | | | | | | | | | | | | | | | | |
* |---------+------+------+------+------+------+------| |------+------+------+------+------+------+--------| | |
* | | ! | " | # | $ | % | | | | & | ' | ( | ) | 0 | = | | |
* |---------+------+------+------+------+------| | | |------+------+------+------+------+--------| | |
* | | 1 | 2 | 3 | 4 | 5 |------| |------| 6 | 7 | 8 | 9 | 0 | - | | |
* |---------+------+------+------+------+------| | | |------+------+------+------+------+--------| | |
* | | | | | | | | | | | | | | | | | |
* `---------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' | |
* | | | | | | | | | | | | | |
* `-----------------------------------' `----------------------------------' | |
* ,-------------. ,-------------. | |
* | | | | | | | |
* ,------|------|------| |------+------+------. | |
* | | | | | | | | | |
* | | |------| |------| | | | |
* | | | | | | | | | |
* `--------------------' `--------------------' | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Keymap 2: Media and mouse keys | |
* | |
* ,--------------------------------------------------. ,--------------------------------------------------. | |
* | RESET | | | | | | | | | | | | | | | | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| | |
* | | | | MsUp | | | | | | |Ctl(A)|ctl(E)| | | | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| | |
* | | |MsLeft|MsDown|MsRght| |------| |------| left | down | up |right | | | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| | |
* | | | | | | | | | | | | | | | | | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' | |
* | | | | Lclk | Rclk | | | | | | | | |
* `----------------------------------' `----------------------------------' | |
* ,-------------. ,-------------. | |
* | F1 | F2 | |Vol Dw|Vol Up| | |
* ,------|------|------| |------+------+------. | |
* | | | | | | | | | |
* | | |------| |------| | | | |
* | | | | | | | | | |
* `--------------------' `--------------------' | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment