2
0

keymap.c 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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_ortho.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_ortho_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_8)
  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. MESC, Q , W , E , R , T ,SCTL, SCTR, Y , U , I , O , P ,QUOT,
  43. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  44. TAB , A , S , D , F , G ,SPLT, SPRT, H , J , K , L ,SCLN,ENT ,
  45. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  46. LSPO, Z , X , C , V , B ,SPFN, GBRC, N , M ,COMM,DOT ,SLSH,RSPC,
  47. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  48. NMPD,BSPC, SPC ,SYMB
  49. // \------------------+----+----+---/ \---+----+----+-------------------/
  50. ),
  51. [_CAPS] = KC_KEYMAP(
  52. //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----.
  53. , , , , , , , , , , , , , ,
  54. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  55. , , , , , ,UNDS, , , , , ,COLN, ,
  56. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  57. SCOF, , , , , , , , , , , , ,SCOF,
  58. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  59. , , ,
  60. // \------------------+----+----+---/ \---+----+----+-------------------/
  61. ),
  62. [_NUMPAD] = KC_KEYMAP(
  63. //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----.
  64. , ,COLN , , , , , , , 7 , 8 , 9 ,ASTR,MINS,
  65. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  66. , ,DOT , , , , , , , 4 , 5 , 6 ,PLUS, ,
  67. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  68. , , , , , , , , , 1 , 2 , 3 ,SLSH, ,
  69. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  70. , , , 0
  71. // \------------------+----+----+---/ \---+----+----+-------------------/
  72. ),
  73. [_SYMBOLS] = KC_KEYMAP(
  74. //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----.
  75. ,EXLM, AT ,HASH,DLR ,PERC, , ,CIRC,AMPR,ASTR,LPRN,RPRN,BSLS,
  76. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  77. , F1 , F2 , F3 , F4 , F5 , , ,TILD,COLN,UNDS,LCBR,RCBR, ,
  78. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  79. , F6 , F7 , F8 , F9 ,F10 , , ,GRV ,SCLN,MINS,LBRC,RBRC, ,
  80. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  81. PIPE, , ,
  82. // \------------------+----+----+---/ \---+----+----+-------------------/
  83. ),
  84. [_NAV] = KC_KEYMAP(
  85. //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----.
  86. , , , , , , , , , , UP , ,PSCR, ,
  87. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  88. , , , , , , , , ,LEFT,DOWN,RGHT, , ,
  89. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  90. , , , , , , , , ,PGUP,PGDN, , , ,
  91. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  92. ,DEL , ,
  93. // \------------------+----+----+---/ \---+----+----+-------------------/
  94. ),
  95. [_MACROS] = KC_KEYMAP(
  96. //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----.
  97. , , , , , , , , , ,INCL, , , ,
  98. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  99. , , ,CAD , , , , , , , , , , ,
  100. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  101. SCAP, , , , , , , , , ,PULL,PUSH, ,SCAP,
  102. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  103. , , ,
  104. // \------------------+----+----+---/ \---+----+----+-------------------/
  105. )
  106. };
  107. const uint16_t PROGMEM fn_actions[] = {
  108. };
  109. const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
  110. {
  111. switch(id) {
  112. /* include some kind of library or header */
  113. case 0:
  114. if (record->event.pressed) {
  115. SEND_STRING("#include <>");
  116. return MACRO( T(LEFT), END);
  117. }
  118. break;
  119. case 1:
  120. if (record->event.pressed) {
  121. SEND_STRING("git pull");
  122. return MACRO( T(ENT), END );
  123. }
  124. break;
  125. case 2:
  126. if (record->event.pressed){
  127. SEND_STRING("git push");
  128. return MACRO( T(ENT), END );
  129. }
  130. break;
  131. case 3:
  132. if (record->event.pressed){
  133. layer_on(_CAPS);
  134. register_code(KC_CAPSLOCK);
  135. unregister_code(KC_CAPSLOCK);
  136. }
  137. break;
  138. case 4:
  139. if (record->event.pressed){
  140. layer_off(_CAPS);
  141. register_code(KC_CAPSLOCK);
  142. unregister_code(KC_CAPSLOCK);
  143. }
  144. break;
  145. }
  146. return MACRO_NONE;
  147. };
  148. void matrix_scan_user(void) {
  149. uint8_t layer = biton32(layer_state);
  150. switch (layer) {
  151. case _QWERTY:
  152. set_led_green;
  153. break;
  154. case _CAPS:
  155. set_led_white;
  156. break;
  157. case _NUMPAD:
  158. set_led_blue;
  159. break;
  160. case _SYMBOLS:
  161. set_led_red;
  162. break;
  163. case _NAV:
  164. set_led_magenta;
  165. break;
  166. case _MACROS:
  167. set_led_cyan;
  168. break;
  169. default:
  170. set_led_green;
  171. break;
  172. }
  173. };