keymap.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. Copyright 2021 andys8 <andys8@users.noreply.github.com>
  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 2 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 <http://www.gnu.org/licenses/>.
  13. */
  14. #include QMK_KEYBOARD_H
  15. #include "sendstring_german.h"
  16. enum custom_keycodes {
  17. GIT_STASH = SAFE_RANGE,
  18. GIT_STASH_POP,
  19. GIT_COMMIT,
  20. COPY_PASTE,
  21. };
  22. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  23. switch (keycode) {
  24. case GIT_STASH:
  25. if (record->event.pressed) {
  26. SEND_STRING("git stash\n");
  27. }
  28. break;
  29. case GIT_STASH_POP:
  30. if (record->event.pressed) {
  31. SEND_STRING("git stash pop\n");
  32. }
  33. break;
  34. case GIT_COMMIT:
  35. if (record->event.pressed) {
  36. SEND_STRING("git add -A && git commit -a\n");
  37. }
  38. break;
  39. case COPY_PASTE:
  40. if (record->event.pressed) {
  41. tap_code16(C(KC_C));
  42. } else {
  43. tap_code16(C(KC_V));
  44. }
  45. break;
  46. }
  47. return true;
  48. };
  49. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  50. [0] = LAYOUT(GIT_STASH, GIT_STASH_POP, GIT_COMMIT,
  51. LCTL(KC_F4), LT(1, KC_SPACE), LCTL(KC_F6),
  52. COPY_PASTE, LCTL(KC_F2), LCTL(KC_F3)),
  53. [1] = LAYOUT(RGB_RMOD, RGB_TOG, RGB_MOD,
  54. RGB_HUI, KC_TRNS, RGB_SAI,
  55. RGB_HUD, RGB_M_P, RGB_SAD),
  56. };