babblePaste.txt 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. BabblePaste is a library of common macros used to make sure that
  2. you can have one "paste" button on one layer, and it will do the
  3. right thing on any OS or app. Windows=Ctrl-V. Mac = Command-V and so on.
  4. The babblepaste library looks for the current status in a babble_mode global variable.
  5. To switch modes, run the switch_babble_mode() function, or a pre defined macro.
  6. Currently supported are Windows, OS X, Gnome/kde, Emacs, VI and readline,
  7. across 42+ common macro actions.
  8. ###To use the library
  9. 1) Paste the following into your config.h.
  10. //////Begin//////
  11. #define USE_BABLPASTE 1
  12. #ifdef USE_BABLPASTE
  13. /* define BabblePaste maps. Whatever = 0 will be the default. */
  14. // MAC_MODE 0
  15. // MS_MODE 1
  16. // LINUX_MODE 2
  17. // EMACS_MODE 3
  18. // VI_MODE 3
  19. // Readline and tmux
  20. // READMUX_MODE 2
  21. // WORDSTAR_MODE 5
  22. #endif
  23. // Uncomment these to remove options an free up flash space
  24. // This removes everything but cursor movement
  25. // BABL_MOVEMENTONLY
  26. // and this just removes browser shortcuts
  27. // BABL_NOBROWSER
  28. ///////End///////
  29. 2) Add the following to your keymap in the action_get_macro
  30. //////Begin//////
  31. #ifdef USE_BABLPASTE
  32. if( id >= BABL_START_NUM && id < (BABL_START_NUM + BABL_NUM_MACROS ) ) {
  33. if (record->event.pressed) { // is there a case where this isn't desired?
  34. babblePaste ( record, id );
  35. return MACRO_NONE;
  36. }
  37. }
  38. #endif
  39. ///////End///////
  40. 3) add Babbelpaste actions to your keymap. See the full list in babblePaste.h, or the
  41. list below
  42. B_L1C // go left 1 char
  43. B_R1C // go Right 1 char
  44. B_L1W //GO_LEFT_1 WORD
  45. B_R1W //BABL_GO_RIGHT_1 WORD
  46. B_GSOL // BABL_GOTO_START of _LINE
  47. B_GEOL // BABL_GOTO_END_LINE
  48. B_GTOP //BABL_GOTO_START_DOC
  49. B_GEND //BABL_GO_END_DOC
  50. B_DOWN //BABL_GO_NEXT_LINE
  51. B_UP // BABL_GO_PREV_LINE
  52. B_PGDN //PGDN
  53. B_PGUP //PGUP
  54. // B_BKSP //backspace so why bother.
  55. B_DEL // DEL_RIGHT_1 Char // usually = Del
  56. B_DLW // DEL_LEFT_ 1 WORD)
  57. B_DRW //DEL_RIGHT_1 WORD
  58. B_DEOL // delete from cursor to end of line
  59. B_DSOL // delete from cursor to begining line
  60. B_UNDO //UNDO
  61. B_REDO // REDO
  62. B_CUT // CUT)
  63. B_COPY // COPY)
  64. B_PAST // PASTE)
  65. B_SELA // SELECT_ALL
  66. B_FIND // FIND)
  67. B_FINDN //FIND_NEXT)
  68. B_FINDR // FIND_REPLACE)
  69. B_RAPP // open application launcher
  70. B_NAPP // switch to next app
  71. B_PAPP // switch to previous app
  72. B_CAPP // CLOSE_APP)
  73. B_HELP // HELP)
  74. B_NTAB // BROWSER_NEW_TAB)
  75. B_CTAB //BROWSER_CLOSE_TAB)
  76. B_ROTB //BROWSER_REOPEN_LAST_TAB)
  77. B_NXTB //BROWSER_NEXT_TAB)
  78. B_PTAB //BROWSER_PREV_TAB)
  79. B_NURL //BROWSER_jump to URL_BAR)
  80. B_BFWD // BROWSER_FORWARD (in history)
  81. B_BBAK //BROWSER_BACK (in history)
  82. B_BFND // BROWSER_FIND)
  83. B_BOOK //BROWSER_New BOOKMARK)
  84. B_BDEV //BROWSER_ Open DEV_TOOLS) // hard one to remember
  85. B_BRLD // BROWSER_RELOAD Page
  86. B_BFUlL // BROWSER_FULLSCREEN)
  87. B_ZMIN // BROWSER_ZOOM_IN)
  88. B_ZMOT //BROWSER_ZOOM_OUT)
  89. #### Development notes
  90. -Why a new function? Because it would make the keymap too ugly to put it there.
  91. -Why not return the macro to action_get_macro? Because I kept running into scope problems
  92. and pointers to the wrong type.
  93. -Why not an array of arrays as a lookup instead of a function? That would allow you
  94. to store the lookup table in PROGMEM. True, but that takes more pre-processor skill
  95. than I had.
  96. -Have you tested this on every platform? No. Submit a patch.
  97. ### Next steps for someone.
  98. Make it easier to pair macros with modifiers. So key foo will jump to start of line, and
  99. Shift(foo) will jump to the first tab in a browser.
  100. ## Thanks
  101. Thanks to https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts
  102. and https://github.com/qmk/qmk_firmware/blob/master/keyboards/planck/keymaps/jeebak/keymap.c
  103. And of course QMK...