keycodes.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
  3. * Version 2, December 2004
  4. *
  5. * Copyright (C) 2019 4sStylZ <4sstylz@protonmail.ch>
  6. *
  7. * Everyone is permitted to copy and distribute verbatim or modified
  8. * copies of this license document, and changing it is allowed as long
  9. * as the name is changed.
  10. *
  11. * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
  12. * TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  13. *
  14. * 0. You just DO WHAT THE FUCK YOU WANT TO.
  15. */
  16. #include QMK_KEYBOARD_H
  17. /**
  18. * Macro for selecting all the text in the document.
  19. * Usual shortcut : Ctrl+A.
  20. *
  21. * @param keyrecord_t *record
  22. *
  23. * @return void
  24. */
  25. void select_all(keyrecord_t *record) {
  26. if (record->event.pressed) {
  27. register_code(KC_LCTL);
  28. tap_code(KC_A);
  29. unregister_code(KC_LCTL);
  30. }
  31. }
  32. /**
  33. * Macro for selecting the current row.
  34. *
  35. * @param keyrecord_t *record
  36. *
  37. * @return void
  38. */
  39. void select_row(keyrecord_t *record) {
  40. if (record->event.pressed) {
  41. tap_code(KC_HOME);
  42. register_code(KC_LSFT);
  43. tap_code(KC_END);
  44. unregister_code(KC_LSFT);
  45. }
  46. }
  47. /**
  48. * Macro for selecting the current word.
  49. * Usage : You need to have the cursor into the word or directly at the right.
  50. *
  51. *
  52. * Usual shortcut : Ctrl+A.
  53. *
  54. * @param keyrecord_t *record
  55. *
  56. * @return void
  57. */
  58. void select_word(keyrecord_t *record) {
  59. if (record->event.pressed) {
  60. register_code(KC_LCTL);
  61. tap_code(KC_LEFT);
  62. register_code(KC_LSFT);
  63. tap_code(KC_RIGHT);
  64. unregister_code(KC_LSFT);
  65. unregister_code(KC_LCTL);
  66. }
  67. }
  68. /**
  69. * Macro for inserting two 0 with keypad.
  70. * Be carefull to have the keypad lock enabled
  71. *
  72. * @param keyrecord_t *record
  73. *
  74. * @return void
  75. */
  76. void insert_00(keyrecord_t *record) {
  77. if (record->event.pressed) {
  78. tap_code(KC_P0);
  79. tap_code(KC_P0);
  80. }
  81. }