keymap.c 6.5 KB

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