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.

86 lines
3.4 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. Emacs mode is probably most useful for people who don't usually use emacs
  6. https://www.ast.cam.ac.uk/~vasily/idl/emacs_commands_list.html
  7. */
  8. #include QMK_KEYBOARD_H
  9. #ifdef USE_BABBLEPASTE
  10. # include "babblePaste.h"
  11. # ifdef BABL_EMACS
  12. // probably should allow meta to not be ALT
  13. # define DMETA IMALT
  14. bool babblePaste_emacs(uint16_t keycode) {
  15. # ifdef BABL_MOVE
  16. BABLM(BABL_GO_LEFT_1C, SS_TAP(X_LEFT));
  17. BABLM(BABL_GO_RIGHT_1C, SS_TAP(X_RIGHT));
  18. BABLM(BABL_GO_LEFT_WORD, IMALT(X_B));
  19. BABLM(BABL_GO_RIGHT_WORD, IMALT(X_F));
  20. BABLM(BABL_GO_START_LINE, SS_LCTRL("a"));
  21. BABLM(BABL_GO_END_LINE, SS_LCTRL("e"));
  22. BABLM(BABL_GO_START_DOC, OMALT(IMSFT(X_COMMA)));
  23. BABLM(BABL_GO_END_DOC, OMALT(IMSFT(X_DOT)));
  24. BABLM(BABL_GO_NEXT_LINE, SS_LCTRL("n"));
  25. BABLM(BABL_GO_PREV_LINE, SS_LCTRL("p"));
  26. BABLM(BABL_GO_PARA_START, OMALT(IMSFT(X_LBRACKET)));
  27. BABLM(BABL_GO_PARA_END, OMALT(IMSFT(X_RBRACKET)));
  28. BABLM(BABL_PGDN, SS_LCTRL("v"));
  29. BABLM(BABL_PGUP, IMALT(X_V));
  30. BABLM(BABL_DEL_RIGHT_1C, SS_LCTRL("d"));
  31. BABLM(BABL_DEL_LEFT_WORD, IMCTL(X_BSPACE));
  32. BABLM(BABL_DEL_RIGHT_WORD, IMALT(X_D));
  33. BABLM(BABL_DEL_TO_LINE_END, SS_LCTRL("k"));
  34. BABLM(BABL_DEL_TO_LINE_START, SS_TAP(X_ESCAPE) "0" SS_LCTRL("k"));
  35. BABLM(BABL_MODE, "Emacs ");
  36. # endif
  37. # ifdef BABL_OSKEYS
  38. BABLM(BABL_UNDO, SS_LCTRL("x") "c");
  39. BABLM(BABL_REDO, SS_LCTRL("x") "c"); // arguably
  40. BABLM(BABL_CUT, SS_LCTRL("w"));
  41. BABLM(BABL_COPY, SS_LALT("w")); // really?
  42. BABLM(BABL_PASTE, SS_LCTRL("y"));
  43. BABLM(BABL_SELECT_ALL, SS_LCTRL("x") "h");
  44. BABLM(BABL_FIND, SS_LCTRL("s"));
  45. BABLM(BABL_FIND_NEXT, SS_LCTRL("s"));
  46. BABLM(BABL_FIND_PREV, SS_LCTRL("r"));
  47. BABLM(BABL_FIND_REPLACE, OMALT(IMSFT(X_5)));
  48. // BABLM( BABL_RUNAPP , //(SS_LALT("x") "shell") );// arguably
  49. BABLM(BABL_RUNAPP, IMALT(X_X) "split-window" SS_TAP(X_ENTER)); // arguably
  50. BABLM(BABL_WINDOW_NEXT, SS_LCTRL("x") "o");
  51. BABLM(BABL_WINDOW_PREV, SS_LCTRL("x") "o"); // arguably
  52. // BABLM( BABL_WINDOW_NEW, IMCTL(X_X)"n" ); //
  53. BABLM(BABL_CLOSE_APP, SS_LCTRL("x") "c");
  54. BABLM(BABL_HELP, SS_LCTRL("h") "a"); // start search in help
  55. // BABLM( BABL_LOCK, () ); // lock buffer? Too many options.
  56. // BABLM( BABL_SCREENCAPTURE, () ); // requires plugin?
  57. # endif
  58. # ifdef BABL_BROWSER
  59. /* you get to figure w3 out */
  60. # endif
  61. # ifdef BABL_APP
  62. BABLM(BABL_APP_SAVE, SS_LCTL("x") SS_LCTL("s"));
  63. BABLM(BABL_APP_SET_MARK, IMCTL(X_SPACE));
  64. /// BABLM( BABL_APP_MULTI_SELECT, SS_LCTRL("x") "rt" ); // arguably
  65. BABLM(BABL_SPLIT_FRAME_VERT, SS_LCTRL("x") "3");
  66. BABLM(BABL_UNSPLIT_FRAME_VERT, SS_LCTRL("u") SS_LCTRL("x") "0");
  67. BABLM(BABL_SPLIT_FRAME_HORIZONTAL, SS_LCTRL("x") "2");
  68. BABLM(BABL_UNSPLIT_FRAME_HORIZONTAL, SS_LCTRL("u") SS_LCTRL("x") "0");
  69. BABLM(BABL_NEXT_FRAME, SS_LCTRL("x") "o");
  70. BABLM(BABL_PREV_FRAME, SS_LCTRL("u") "-1" SS_LCTRL("x") "o");
  71. # endif
  72. // Todo, ring bell, flash light, show user this isn't supported
  73. return false;
  74. }
  75. # endif /* emacs mode*/
  76. #endif