You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.7 KiB

  1. /* A library to output the right key shortcut in any common app.
  2. Given a global variable babble_mode to show the environment and a
  3. key that calls the paste macro, do the right type of paste.
  4. Setting the context is done by another macro, or TBD interaction with the host.
  5. Nano mode is probably most useful for people who don't usually use Nano, but
  6. sometimes find themselves using it.
  7. https://www.nano-editor.org/dist/latest/cheatsheet.html
  8. */
  9. #include QMK_KEYBOARD_H
  10. #ifdef USE_BABBLEPASTE
  11. # include "babblePaste.h"
  12. # ifdef BABL_NANO
  13. // probably should allow meta to not be ALT
  14. # define DMETA IMALT
  15. bool babblePaste_nano(uint16_t keycode) {
  16. # ifdef BABL_MOVE
  17. BABLM(BABL_GO_LEFT_1C, SS_LCTRL("b"));
  18. BABLM(BABL_GO_RIGHT_1C, SS_LCTL("f"));
  19. BABLM(BABL_GO_LEFT_WORD, IMCTL(X_LEFT));
  20. BABLM(BABL_GO_RIGHT_WORD, IMCTL(X_RIGHT));
  21. BABLM(BABL_GO_START_LINE, SS_LCTRL("a"));
  22. BABLM(BABL_GO_END_LINE, SS_LCTRL("e"));
  23. BABLM(BABL_GO_START_DOC, IMALT(X_BSLS));
  24. BABLM(BABL_GO_END_DOC, IMALT(X_SLASH));
  25. BABLM(BABL_GO_NEXT_LINE, SS_LCTRL("n"));
  26. BABLM(BABL_GO_PREV_LINE, SS_LCTRL("p"));
  27. BABLM(BABL_GO_PARA_START, IMCTL(X_UP));
  28. BABLM(BABL_GO_PARA_END, IMCTL(X_DOWN));
  29. BABLM(BABL_PGDN, SS_LCTRL("v"));
  30. BABLM(BABL_PGUP, SS_LCTRL("y"));
  31. BABLM(BABL_DEL_RIGHT_1C, SS_LCTRL("d"));
  32. BABLM(BABL_DEL_LEFT_WORD, IMCTL(X_BSPC));
  33. BABLM(BABL_DEL_RIGHT_WORD, IMCTL(X_DEL));
  34. // BABLM(BABL_DEL_TO_LINE_END, SS_LCTRL("k"));
  35. // BABLM(BABL_DEL_TO_LINE_START, SS_TAP(X_ESCAPE) "0" SS_LCTRL("k"));
  36. BABLM(BABL_MODE, "Nano ");
  37. # endif
  38. # ifdef BABL_OSKEYS
  39. BABLM(BABL_UNDO, SS_LALT("u"));
  40. BABLM(BABL_REDO, SS_LALT("e"));
  41. BABLM(BABL_CUT, SS_LCTRL("k")); // arguably b/c line based, not selection
  42. BABLM(BABL_COPY, SS_LALT("6")); // arguably
  43. BABLM(BABL_PASTE, SS_LCTRL("u"));
  44. // BABLM(BABL_SELECT_ALL, SS_LCTRL("x") "h");
  45. BABLM(BABL_FIND, SS_LCTRL("w"));
  46. BABLM(BABL_FIND_NEXT, SS_LALT("w"));
  47. BABLM(BABL_FIND_PREV, SS_LALT("q"));
  48. BABLM(BABL_FIND_REPLACE, SS_LALT("r"));
  49. BABLM(BABL_RUNAPP, SS_LCTL("t"));
  50. BABLM(BABL_WINDOW_NEXT, OMALT(IMSFT(X_DOT)));
  51. BABLM(BABL_WINDOW_PREV, OMALT(IMSFT(X_COMMA)));
  52. BABLM(BABL_WINDOW_NEW, IMCTL(X_R) IMALT(X_F)); //
  53. BABLM(BABL_CLOSE_APP, SS_LCTRL("x"));
  54. BABLM(BABL_HELP, SS_LCTRL("g"));
  55. // BABLM( BABL_LOCK, () ); // lock buffer? Too many options.
  56. // BABLM( BABL_SCREENCAPTURE, () ); // requires plugin?
  57. # endif
  58. # ifdef BABL_APP
  59. BABLM(BABL_APP_SAVE, SS_LCTRL("s")); // save file blurs app & os. Move?
  60. BABLM(BABL_APP_SET_MARK, SS_LALT("a"));
  61. # endif
  62. // Todo, ring bell, flash light, show user this isn't supported
  63. return false;
  64. }
  65. # endif /* nano mode*/
  66. #endif