leader.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #include "leader.h"
  2. LEADER_EXTERNS();
  3. void matrix_scan_user(void){
  4. static bool has_ran_yet;
  5. if (!has_ran_yet) {
  6. has_ran_yet = true;
  7. startup_user();
  8. }
  9. #ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code.
  10. // run_diablo_macro_check();
  11. #endif // TAP_DANCE_ENABLE
  12. #ifdef RGBLIGHT_ENABLE
  13. matrix_scan_rgb();
  14. #endif // RGBLIGHT_ENABLE
  15. LEADER_DICTIONARY() {
  16. leading = false;
  17. leader_end();
  18. SEQ_ONE_KEY(KC_W) {
  19. // vim/tmux: Use in command mode in vim: write to file, switch tmux pane in the current session window and repeat the last command
  20. SEND_STRING(":w" SS_TAP(X_ENTER));
  21. tmux_pane_switch_repeat();
  22. }
  23. SEQ_ONE_KEY(KC_T) {
  24. // Send the Tmux Prefix
  25. tmux_prefix();
  26. }
  27. SEQ_ONE_KEY(KC_A) {
  28. // tmux: Send the prefix and press 'right' arrow
  29. tmux_prefix();
  30. tap_code(KC_RIGHT);
  31. }
  32. SEQ_TWO_KEYS(KC_T, KC_T) {
  33. // tmux: Send the prefix to a nested session
  34. tmux_prefix();
  35. tmux_prefix();
  36. }
  37. SEQ_TWO_KEYS(KC_T, KC_R) {
  38. // tmux: Switch pane and repeat last action
  39. tmux_pane_switch_repeat();
  40. }
  41. SEQ_TWO_KEYS(KC_V, KC_Z){
  42. // vim: Zoom pane
  43. tap_code16(LCTL(KC_W));
  44. tap_code16(LSFT(KC_BSLS));
  45. }
  46. SEQ_TWO_KEYS(KC_V, KC_R) {
  47. // vim: Substitute and place cursor
  48. SEND_STRING(":%s///g" SS_TAP(X_LEFT));
  49. tap_code(KC_LEFT);
  50. tap_code(KC_LEFT);
  51. }
  52. SEQ_TWO_KEYS(KC_V, KC_T) {
  53. // vim: move current pane to new tab
  54. tap_code16(LCTL(KC_W));
  55. tap_code16(LSFT(KC_T));
  56. }
  57. SEQ_THREE_KEYS(KC_BSPC, KC_BSPC, KC_BSPC){
  58. // Reset the keyboard
  59. reset_keyboard();
  60. }
  61. }
  62. matrix_scan_keymap();
  63. }