logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

keymap.c (9845B)


  1. /* Keymap for Space Oddity Keyboard
  2. Copyright (C) 2017 James Taylor
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <https://www.gnu.org/licenses/>.
  13. */
  14. #include QMK_KEYBOARD_H
  15. // Custom keycodes needed for dynamic macros.
  16. enum custom_keycodes {
  17. QWERTY = SAFE_RANGE,
  18. PAIR_PR,
  19. PAIR_BR,
  20. PAIR_CB,
  21. LAMBDA
  22. };
  23. // Tap Dance initializer.
  24. enum {
  25. SFT_CAPS = 0,
  26. };
  27. // Tap dance actions - double tap for Caps Lock.
  28. tap_dance_action_t tap_dance_actions[] = {
  29. [SFT_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS),
  30. };
  31. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  32. /* Here is an ASCII version of the base layout. Note that Dynamic Macros 1 and 2 are considered Macro 5 and Macro 6.
  33. *
  34. * ___________________________________________________________________________________
  35. * | | | | | | Dynamic | Dynamic |
  36. * | () | [] | {} | NO OP | NO OP | Macro 1 | Macro 2 |
  37. * |___________|___________|___________|___________|___________|___________|___________|
  38. * | | | | | | | | | | | | |
  39. * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | BKSP |
  40. * |___________|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|___________|
  41. * | | | | | | | | | | | | |
  42. * | TAB | Q | W | E | R | T | Y | U | I | O | P | - |
  43. * |___________|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|___________|
  44. * | | | | | | | | | | | | |
  45. * |ESC (CTL_T)| A | S | D | F | G | H | J | K | L | ; | ' |
  46. * |___________|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|___________|
  47. * | | | | | | | | | | | | |
  48. * | SHFT | Z | X | C | V | B | N | M | , | . | / |SHFT(ENT)|
  49. * |_________|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_________|
  50. * | | | | | | | ALT | HYP | LT 1| LT 2|
  51. * |MO(2)|MO(1)| GUI | ALT | CTRL | SPC |(LFT)|(RGT)| (UP)|(DWN)|
  52. * |_____|_____|_____|_____|___________|___________|_____|_____|_____|_____|
  53. */
  54. [0] = LAYOUT(
  55. PAIR_PR, PAIR_BR, PAIR_CB, XXXXXXX, XXXXXXX, DM_PLY1, DM_PLY2,
  56. KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
  57. KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_MINS,
  58. CTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
  59. TD(SFT_CAPS), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_T(KC_ENT),
  60. MO(2), MO(1), KC_LGUI, KC_RALT, KC_LCTL, KC_SPC, ALT_T(KC_LEFT), ALL_T(KC_RGHT), LT(1, KC_UP), LT(2, KC_DOWN)
  61. ),
  62. /* Function layer.
  63. * Blank keys correspond to the KC_TRNS keycode.
  64. *
  65. * ___________________________________________________________________________________
  66. * | | | | | | DYN REC | DYN REC |
  67. * | LAMBDA | | | | | 1 | 2 |
  68. * |___________|___________|___________|___________|___________|___________|___________|
  69. * | DYN REC | | | | | | | | | | | |
  70. * | STOP | F1 | F2 | F3 | F4 | F5 | [ | 7 | 8 | 9 | * | DEL |
  71. * |___________|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|___________|
  72. * | | | | | | | | | | | | |
  73. * | | F6 | F7 | F8 | F9 | F10 | ] | 4 | 5 | 6 | + | = |
  74. * |___________|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|___________|
  75. * | | | | | | | | | | | | |
  76. * | \ | F11 | F12 | F13 | F14 | F15 | { | 1 | 2 | 3 | - | | |
  77. * |___________|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|___________|
  78. * | | | | | | | | | | | | |
  79. * | | F16 | F17 | F18 | F19 | F20 | } | 0 | , | . | / | |
  80. * |_________|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_________|
  81. * | | | | | | | | | | |
  82. * | | | | | | | | | | |
  83. * |_____|_____|_____|_____|___________|___________|_____|_____|_____|_____|
  84. *
  85. */
  86. [1] = LAYOUT(
  87. LAMBDA, _______, _______, _______, _______, DM_REC1, DM_REC2,
  88. DM_RSTP, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_LBRC, KC_P7, KC_P8, KC_P9, KC_ASTR, KC_DEL,
  89. _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_RBRC, KC_P4, KC_P5, KC_P6, KC_PLUS, KC_EQL,
  90. KC_BSLS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_LCBR, KC_P1, KC_P2, KC_P3, KC_MINS, KC_PIPE,
  91. _______, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_RCBR, KC_P0, KC_COMM, KC_DOT, KC_SLSH, _______,
  92. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
  93. ),
  94. /* Mouse layer.
  95. *
  96. * ___________________________________________________________________________________
  97. * | | | | | | | |
  98. * | | | | | | | |
  99. * |___________|___________|___________|___________|___________|___________|___________|
  100. * | | | | MS | | | | | | | | |
  101. * | | | | UP | | | | | | | | |
  102. * |___________|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|___________|
  103. * | | | MS | MS | MS | | | | | | | |
  104. * | | | LFT | DWN | RGT | | | MS1 | MS3 | MS2 | | |
  105. * |___________|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|___________|
  106. * | | | | | | | | | | | | |
  107. * | | | | | | | | | | | | |
  108. * |___________|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|___________|
  109. * | | | | | | | | | | | | |
  110. * | |QK_BOOT| | | | | | | | | | |
  111. * |_________|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_________|
  112. * | | | | | | | | | | |
  113. * | | | | | | | | | | F(2)|
  114. * |_____|_____|_____|_____|___________|___________|_____|_____|_____|_____|
  115. *
  116. */
  117. [2] = LAYOUT(
  118. _______, _______, _______, _______, _______, _______, _______,
  119. _______, _______, _______, KC_MS_U, _______, _______, _______, _______, _______, _______, _______, _______,
  120. _______, _______, KC_MS_L, KC_MS_D, KC_MS_R, _______, _______, KC_BTN1, KC_BTN3, KC_BTN2, _______, _______,
  121. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  122. _______, QK_BOOT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  123. _______, _______, _______, _______, _______, _______, _______, _______, _______, TG(2)
  124. )
  125. };
  126. // Simple macro ideas follow. Each of them is designed to give you a quick way to create pairs of
  127. // delimiters and then position the cursor between them, much like Emacs' ParEdit does. This way,
  128. // you can have some convenient coding "helpers" even when not using Emacs. It is also nice for
  129. // LaTeX editing.
  130. //
  131. // Customize to your heart's content!
  132. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  133. switch (keycode) {
  134. case PAIR_PR:
  135. if (record->event.pressed) {
  136. SEND_STRING("()"SS_TAP(X_LEFT));
  137. }
  138. return false;
  139. case PAIR_BR:
  140. if (record->event.pressed) {
  141. SEND_STRING("[]"SS_TAP(X_LEFT));
  142. }
  143. return false;
  144. case PAIR_CB:
  145. if (record->event.pressed) {
  146. SEND_STRING("{}"SS_TAP(X_LEFT));
  147. }
  148. return false;
  149. // Probably something only Lisp users will appreciate...
  150. case LAMBDA:
  151. if (record->event.pressed) {
  152. SEND_STRING("(lambda ())"SS_TAP(X_LEFT)SS_TAP(X_LEFT));
  153. }
  154. return false;
  155. }
  156. return true;
  157. }