keymap.c 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. // this is the style you want to emulate.
  2. // This is the canonical layout file for the Quantum project. If you want to add another keyboard,
  3. #include QMK_KEYBOARD_H
  4. // Each layer gets a name for readability, which is then used in the keymap matrix below.
  5. // The underscores don't mean anything - you can have a layer called STUFF or any other name.
  6. // Layer names don't all need to be of the same length, obviously, and you can also skip them
  7. // entirely and just use numbers.
  8. enum chimera_ergo_layers
  9. {
  10. _QWERTY,
  11. _CAPS,
  12. _NUMPAD,
  13. _SYMBOLS,
  14. _MACROS,
  15. _NAV
  16. };
  17. #define SC_NMPD TG(_NUMPAD)
  18. #define SC_SYMB TG(_SYMBOLS)
  19. #define SC_SPFN LT(_NAV,KC_EQL)
  20. #define SC_SCTL MT(MOD_LCTL, KC_LBRC)
  21. #define SC_SCTR MT(MOD_LCTL, KC_RBRC)
  22. #define SC_SPLT MT(MOD_LALT, KC_MINS)
  23. #define SC_SPRT MT(MOD_LALT, KC_1)
  24. #define SC_GBRC MT(MOD_RGUI, KC_RBRC)
  25. #define SC_MESC LT(_MACROS, KC_ESC)
  26. #define SC_INCL M(0)
  27. #define SC_PULL M(1)
  28. #define SC_PUSH M(2)
  29. #define SC_SCAP M(3)
  30. #define SC_SCOF M(4)
  31. #define SC_CAD LALT(LCTL(KC_DEL))
  32. #define LONGPRESS_DELAY 150
  33. //#define LAYER_TOGGLE_DELAY 300
  34. // Fillers to make layering more clear
  35. #define _______ KC_TRNS
  36. #define XXXXXXX KC_NO
  37. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  38. [_QWERTY] = LAYOUT(
  39. KC_LBRC, KC_1, SC_SCTL, SC_SPLT, SC_SPFN, KC_5, KC_6, SC_GBRC, SC_SPRT, SC_SCTR, KC_0, KC_RBRC,
  40. SC_MESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_QUOT,
  41. KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT,
  42. KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC,
  43. SC_NMPD, KC_BSPC, KC_SPC, SC_SYMB
  44. ),
  45. [_CAPS] = LAYOUT(
  46. _______, KC_UNDS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  47. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  48. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_COLN, _______,
  49. SC_SCOF, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, SC_SCOF,
  50. _______, _______, _______, _______
  51. ),
  52. [_NUMPAD] = LAYOUT(
  53. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MINS, _______,
  54. _______, _______, KC_COLN, _______, _______, _______, _______, KC_7, KC_8, KC_9, KC_ASTR, _______,
  55. _______, _______, KC_DOT , _______, _______, _______, _______, KC_4, KC_5, KC_6, KC_PLUS, _______,
  56. _______, _______, _______, _______, _______, _______, _______, KC_1, KC_2, KC_3, KC_SLSH, _______,
  57. _______, _______, _______, KC_0
  58. ),
  59. [_SYMBOLS] = LAYOUT(
  60. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  61. _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSLS,
  62. KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_TILD, KC_EQL, KC_UNDS, KC_LCBR, KC_RCBR, _______,
  63. KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_GRV, KC_PLUS, KC_MINS, KC_LBRC, KC_RBRC, _______,
  64. KC_PIPE, _______, _______, _______
  65. ),
  66. [_MACROS] = LAYOUT(
  67. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  68. _______, _______, _______, _______, _______, _______, _______, _______, SC_INCL, _______, _______, _______,
  69. _______, _______, _______, SC_CAD, _______, _______, _______, _______, _______, _______, _______, _______,
  70. SC_SCAP, _______, _______, _______, _______, _______, _______, _______, SC_PULL, SC_PUSH, _______, _______,
  71. _______, _______, _______, _______
  72. ),
  73. [_NAV] = LAYOUT(
  74. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  75. _______, _______, _______, _______, _______, _______, _______, KC_PGUP, KC_UP, KC_PGDN, KC_PSCR, _______,
  76. _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______,
  77. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  78. _______, KC_DEL, _______, _______
  79. ),
  80. };
  81. const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
  82. {
  83. switch(id) {
  84. /* include some kind of library or header */
  85. case 0:
  86. if (record->event.pressed) {
  87. SEND_STRING("#include <>");
  88. return MACRO( T(LEFT), END);
  89. }
  90. break;
  91. case 1:
  92. if (record->event.pressed) {
  93. SEND_STRING("git pull");
  94. return MACRO( T(ENT), END );
  95. }
  96. break;
  97. case 2:
  98. if (record->event.pressed){
  99. SEND_STRING("git push");
  100. return MACRO( T(ENT), END );
  101. }
  102. break;
  103. case 3:
  104. if (record->event.pressed){
  105. layer_on(_CAPS);
  106. register_code(KC_CAPSLOCK);
  107. unregister_code(KC_CAPSLOCK);
  108. }
  109. break;
  110. case 4:
  111. if (record->event.pressed){
  112. layer_off(_CAPS);
  113. register_code(KC_CAPSLOCK);
  114. unregister_code(KC_CAPSLOCK);
  115. }
  116. break;
  117. }
  118. return MACRO_NONE;
  119. };
  120. void matrix_scan_user(void) {
  121. uint8_t layer = biton32(layer_state);
  122. switch (layer) {
  123. case _QWERTY:
  124. set_led_green;
  125. break;
  126. case _CAPS:
  127. set_led_white;
  128. break;
  129. case _NUMPAD:
  130. set_led_blue;
  131. break;
  132. case _SYMBOLS:
  133. set_led_red;
  134. break;
  135. case _NAV:
  136. set_led_magenta;
  137. break;
  138. case _MACROS:
  139. set_led_cyan;
  140. break;
  141. default:
  142. set_led_green;
  143. break;
  144. }
  145. };