keymap.c 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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 "chimera_ergo.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 KC_NMPD TG(_NUMPAD)
  18. #define KC_SYMB TG(_SYMBOLS)
  19. #define KC_SPFN LT(_NAV,KC_EQL)
  20. #define KC_SCTL MT(MOD_LCTL, KC_LBRC)
  21. #define KC_SCTR MT(MOD_LCTL, KC_RBRC)
  22. #define KC_SPLT MT(MOD_LALT, KC_MINS)
  23. #define KC_SPRT MT(MOD_LALT, KC_1)
  24. #define KC_GBRC MT(MOD_RGUI, KC_RBRC)
  25. #define KC_GQOT MT(MOD_LGUI, KC_QUOT)
  26. #define KC_MESC LT(_MACROS, KC_ESC)
  27. #define KC_INCL M(0)
  28. #define KC_PULL M(1)
  29. #define KC_PUSH M(2)
  30. #define KC_SCAP M(3)
  31. #define KC_SCOF M(4)
  32. #define KC_CAD LALT(LCTL(KC_DEL))
  33. #define LONGPRESS_DELAY 150
  34. //#define LAYER_TOGGLE_DELAY 300
  35. // Fillers to make layering more clear
  36. #define _______ KC_TRNS
  37. #define XXXXXXX KC_NO
  38. #define KC_ KC_TRNS
  39. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  40. [_QWERTY] = KC_KEYMAP(
  41. //,----+----+----+----+----+----. ,----+----+----+----+----+----.
  42. LBRC, 1 ,SCTL,SPLT,SPFN, 5 , 6 ,GBRC,SPRT,SCTR, 0 ,RBRC,
  43. //|----+----+----+----+----+----| |----+----+----+----+----+----|
  44. MESC, Q , W , E , R , T , Y , U , I , O , P ,QUOT,
  45. //|----+----+----+----+----+----| |----+----+----+----+----+----|
  46. TAB , A , S , D , F , G , H , J , K , L ,SCLN,ENT ,
  47. //|----+----+----+----+----+----| |----+----+----+----+----+----|
  48. LSPO, Z , X , C , V , B , N , M ,COMM,DOT ,SLSH,RSPC,
  49. //|----+----+----+----+----+----| |----+----+----+----+----+----|
  50. NMPD,BSPC, SPC ,SYMB
  51. // \------------------+----+----/ \---+----+----+--------------/
  52. ),
  53. [_CAPS] = KC_KEYMAP(
  54. //,----+----+----+----+----+----. ,----+----+----+----+----+----.
  55. ,UNDS, , , , , , , , , , ,
  56. //|----+----+----+----+----+----| |----+----+----+----+----+----|
  57. , , , , , , , , , , , ,
  58. //|----+----+----+----+----+----| |----+----+----+----+----+----|
  59. , , , , , , , , , ,COLN, ,
  60. //|----+----+----+----+----+----| |----+----+----+----+----+----|
  61. SCOF, , , , , , , , , , ,SCOF,
  62. //|----+----+----+----+----+----| |----+----+----+----+----+----|
  63. , , ,
  64. // \------------------+----+----/ \---+----+----+--------------/
  65. ),
  66. [_NUMPAD] = KC_KEYMAP(
  67. //,----+----+----+----+----+----. ,----+----+----+----+----+----.
  68. , , , , , , , , , ,MINS, ,
  69. //|----+----+----+----+----+----| |----+----+----+----+----+----|
  70. , ,COLN, , , , , 7 , 8 , 9 ,ASTR, ,
  71. //|----+----+----+----+----+----| |----+----+----+----+----+----|
  72. , ,DOT , , , , , 4 , 5 , 6 ,PLUS, ,
  73. //|----+----+----+----+----+----| |----+----+----+----+----+----|
  74. , , , , , , , 1 , 2 , 3 ,SLSH, ,
  75. //|----+----+----+----+----+----| |----+----+----+----+----+----|
  76. , , , 0
  77. // \------------------+----+----/ \---+----+----+--------------/
  78. ),
  79. [_SYMBOLS] = KC_KEYMAP(
  80. //,----+----+----+----+----+----. ,----+----+----+----+----+----.
  81. , , , , , , , , , , , ,
  82. //|----+----+----+----+----+----| |----+----+----+----+----+----|
  83. ,EXLM, AT ,HASH,DLR ,PERC, CIRC,AMPR,ASTR,LPRN,RPRN,BSLS,
  84. //|----+----+----+----+----+----| |----+----+----+----+----+----|
  85. F1 , F2 , F3 , F4 , F5 , F6 , TILD,EQL ,UNDS,LCBR,RCBR, ,
  86. //|----+----+----+----+----+----| |----+----+----+----+----+----|
  87. F7 , F8 , F9 ,F10 ,F11 ,F12 , GRV ,PLUS,MINS,LBRC,RBRC, ,
  88. //|----+----+----+----+----+----| |----+----+----+----+----+----|
  89. PIPE, , ,
  90. // \------------------+----+----/ \---+----+----+--------------/
  91. ),
  92. [_MACROS] = KC_KEYMAP(
  93. //,----+----+----+----+----+----. ,----+----+----+----+----+----.
  94. , , , , , , , , , , , ,
  95. //|----+----+----+----+----+----| |----+----+----+----+----+----|
  96. , , , , , , , ,INCL, , , ,
  97. //|----+----+----+----+----+----| |----+----+----+----+----+----|
  98. , , ,CAD , , , , , , , , ,
  99. //|----+----+----+----+----+----| |----+----+----+----+----+----|
  100. SCAP, , , , , , , ,PULL,PUSH, , ,
  101. //|----+----+----+----+----+----| |----+----+----+----+----+----|
  102. , , ,
  103. // \------------------+----+----/ \---+----+----+--------------/
  104. ),
  105. [_NAV] = KC_KEYMAP(
  106. //,----+----+----+----+----+----. ,----+----+----+----+----+----.
  107. , , , , , , , , , , , ,
  108. //|----+----+----+----+----+----| |----+----+----+----+----+----|
  109. , , , , , , ,PGUP, UP ,PGDN,PSCR, ,
  110. //|----+----+----+----+----+----| |----+----+----+----+----+----|
  111. , , , , , , ,LEFT,DOWN,RGHT, , ,
  112. //|----+----+----+----+----+----| |----+----+----+----+----+----|
  113. , , , , , , , , , , , ,
  114. //|----+----+----+----+----+----| |----+----+----+----+----+----|
  115. ,DEL , ,
  116. // \------------------+----+----/ \---+----+----+--------------/
  117. ),
  118. };
  119. const uint16_t PROGMEM fn_actions[] = {
  120. };
  121. const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
  122. {
  123. switch(id) {
  124. /* include some kind of library or header */
  125. case 0:
  126. if (record->event.pressed) {
  127. SEND_STRING("#include <>");
  128. return MACRO( T(LEFT), END);
  129. }
  130. break;
  131. case 1:
  132. if (record->event.pressed) {
  133. SEND_STRING("git pull");
  134. return MACRO( T(ENT), END );
  135. }
  136. break;
  137. case 2:
  138. if (record->event.pressed){
  139. SEND_STRING("git push");
  140. return MACRO( T(ENT), END );
  141. }
  142. break;
  143. case 3:
  144. if (record->event.pressed){
  145. layer_on(_CAPS);
  146. register_code(KC_CAPSLOCK);
  147. unregister_code(KC_CAPSLOCK);
  148. }
  149. break;
  150. case 4:
  151. if (record->event.pressed){
  152. layer_off(_CAPS);
  153. register_code(KC_CAPSLOCK);
  154. unregister_code(KC_CAPSLOCK);
  155. }
  156. break;
  157. }
  158. return MACRO_NONE;
  159. };
  160. void matrix_scan_user(void) {
  161. uint8_t layer = biton32(layer_state);
  162. switch (layer) {
  163. case _QWERTY:
  164. set_led_green;
  165. break;
  166. case _CAPS:
  167. set_led_white;
  168. break;
  169. case _NUMPAD:
  170. set_led_blue;
  171. break;
  172. case _SYMBOLS:
  173. set_led_red;
  174. break;
  175. case _NAV:
  176. set_led_magenta;
  177. break;
  178. case _MACROS:
  179. set_led_cyan;
  180. break;
  181. default:
  182. set_led_green;
  183. break;
  184. }
  185. };