mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-25 20:56:42 +00:00
docs for babblepaste
This commit is contained in:
parent
89aba30c7f
commit
b5bfb5104b
@ -1,489 +1,123 @@
|
|||||||
/* A library to output the right key shortcut in any common app.
|
BabblePaste is a library of common macros used to make sure that
|
||||||
Given a global variable babble_mode to show the environment and a
|
you can have one "paste" button on one layer, and it will do the
|
||||||
key that calls the paste macro, do the right type of paste.
|
right thing on any OS or app. Windows=Ctrl-V. Mac = Command-V and so on.
|
||||||
Setting the context is done by another macro, or TBD interaction with the host.
|
|
||||||
|
|
||||||
Huge thanks to https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts
|
The babblepaste library looks for the current status in a babble_mode global variable.
|
||||||
and https://github.com/qmk/qmk_firmware/blob/master/keyboards/planck/keymaps/jeebak/keymap.c
|
To switch modes, run the switch_babble_mode() function, or a pre defined macro.
|
||||||
*/
|
Currently supported are Windows, OS X, Gnome/kde, Emacs, VI and readline,
|
||||||
|
across 42+ common macro actions.
|
||||||
#include "eeconfig.h"
|
|
||||||
|
|
||||||
|
|
||||||
// Comment out anything you will never use.
|
###To use the library
|
||||||
// Windows.
|
1) Paste the following into your config.h.
|
||||||
#define MS_MODE 0
|
|
||||||
#define MAC_MODE 1
|
//////Begin//////
|
||||||
//aka gnome+KDE
|
#define USE_BABLPASTE 1
|
||||||
#define LINUX_MODE 2
|
|
||||||
#define EMACS_MODE 3
|
#ifdef USE_BABLPASTE
|
||||||
#define VI_MODE 4
|
/* define BabblePaste maps. Whatever = 0 will be the default. */
|
||||||
//#define WORDSTAR_MODE 5
|
// MAC_MODE 0
|
||||||
|
// MS_MODE 1
|
||||||
|
// LINUX_MODE 2
|
||||||
|
// EMACS_MODE 3
|
||||||
|
// VI_MODE 3
|
||||||
// Readline and tmux
|
// Readline and tmux
|
||||||
#define READMUX 6
|
// READMUX_MODE 2
|
||||||
|
// WORDSTAR_MODE 5
|
||||||
// GLOBAL variable. Sets startup default if no eeppom
|
|
||||||
char babble_mode = MAC_MODE ;
|
|
||||||
|
|
||||||
|
|
||||||
/* minimum set required for babble:
|
|
||||||
// Cut & Paste
|
|
||||||
BABL_UNDO
|
|
||||||
BABL_REDO
|
|
||||||
BABL_CUT
|
|
||||||
BABL_COPY
|
|
||||||
BABL_PASTE
|
|
||||||
BABL_SELECT_ALL
|
|
||||||
|
|
||||||
// Movement
|
|
||||||
BABL_DEL_RIGHT_1C
|
|
||||||
BABL_DEL_RIGHT_1C
|
|
||||||
BABL_DEL_LEFT_WORD
|
|
||||||
BABL_DEL_RIGHT_WORD
|
|
||||||
BABL_GO_LEFT_1C
|
|
||||||
BABL_GO_LEFT_WORD
|
|
||||||
BABL_GO_RIGHT_WORD
|
|
||||||
BABL_GOTO_START_LINE
|
|
||||||
BABL_GOTO_START_DOC
|
|
||||||
BABL_GOTO_END_LINE
|
|
||||||
BABL_GOTO_END_DOC
|
|
||||||
BABL_GOTO_NEXT_LINE // down arrow will do.
|
|
||||||
BABL_GOTO_PREV_LINE // up arrow will do.
|
|
||||||
BABL_PGDN
|
|
||||||
BABL_PGUP
|
|
||||||
|
|
||||||
// GUI
|
|
||||||
BABL_FIND
|
|
||||||
BABL_FIND_NEXT
|
|
||||||
BABL_FIND_REPLACE
|
|
||||||
BABL_RUNAPP
|
|
||||||
BABL_SWITCH_NEXT
|
|
||||||
BABL_SWITCH_LAST // previous
|
|
||||||
BABL_CLOSE_APP
|
|
||||||
BABL_HELP
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static macro_t *babblePaste (keyrecord_t *record, uint16_t shortcut) {
|
|
||||||
|
|
||||||
switch(babble_mode) {
|
|
||||||
|
|
||||||
#ifdef MS_MODE
|
|
||||||
case MS_MODE:
|
|
||||||
switch(shortcut) {
|
|
||||||
|
|
||||||
case BABL_UNDO:
|
|
||||||
return MACRO( D(LCTRL), T(Z), U(LCTRL), END );
|
|
||||||
case BABL_REDO:
|
|
||||||
return MACRO( D(LCTRL), T(Y), U(LCTRL), END );
|
|
||||||
case BABL_CUT:
|
|
||||||
return MACRO( D(LCTRL), T(X), U(LCTRL), END );
|
|
||||||
case BABL_COPY:
|
|
||||||
return MACRO( D(LCTRL), T(C), U(LCTRL), END );
|
|
||||||
case BABL_PASTE:
|
|
||||||
return MACRO( D(LCTRL), T(V), U(LCTRL), END );
|
|
||||||
case BABL_SELECT_ALL:
|
|
||||||
return MACRO( D(LCTRL), T(A), U(LCTRL), END );
|
|
||||||
case BABL_DEL_RIGHT_1C:
|
|
||||||
return MACRO( D(DEL), END );
|
|
||||||
case BABL_DEL_LEFT_WORD:
|
|
||||||
return MACRO( D(LCTRL), T(BSPACE), U(LCTRL), END );
|
|
||||||
case BABL_DEL_RIGHT_WORD:
|
|
||||||
return MACRO( D(LCTRL), T(DEL), U(LCTRL), END );
|
|
||||||
case BABL_GO_LEFT_1C:
|
|
||||||
return MACRO( T(LEFT), END );
|
|
||||||
case BABL_GO_RIGHT_1C:
|
|
||||||
return MACRO( T(RIGHT), END );
|
|
||||||
case BABL_GO_LEFT_WORD:
|
|
||||||
return MACRO( D(LCTRL), T(LEFT), U(LCTRL), END );
|
|
||||||
case BABL_GO_RIGHT_WORD:
|
|
||||||
return MACRO( D(LCTRL), T(RIGHT), U(LCTRL), END );
|
|
||||||
case BABL_GOTO_START_LINE:
|
|
||||||
return MACRO( T(HOME), END );
|
|
||||||
case BABL_GOTO_START_DOC:
|
|
||||||
return MACRO( D(LCTRL),T(HOME), U(LCTRL),END );
|
|
||||||
case BABL_GOTO_END_LINE:
|
|
||||||
return MACRO( T(END), END );
|
|
||||||
case BABL_GOTO_END_DOC:
|
|
||||||
return MACRO( D(LCTRL),T(END), U(LCTRL),END );
|
|
||||||
case BABL_GOTO_NEXT_LINE:
|
|
||||||
return MACRO( T(DOWN), END );
|
|
||||||
case BABL_GOTO_PREV_LINE:
|
|
||||||
return MACRO( T(UP), END );
|
|
||||||
case BABL_PGDN:
|
|
||||||
return MACRO( T(PGDN), END );
|
|
||||||
case BABL_PGUP:
|
|
||||||
return MACRO( T(PGUP), END );
|
|
||||||
case BABL_FIND:
|
|
||||||
return MACRO( D(LCTRL),T(F), U(LCTRL),END );
|
|
||||||
case BABL_FIND_NEXT:
|
|
||||||
return MACRO( T(F3),END );
|
|
||||||
case BABL_FIND_REPLACE:
|
|
||||||
return MACRO( D(LCTRL),T(H), U(LCTRL),END );
|
|
||||||
case BABL_RUNAPP:
|
|
||||||
return MACRO( D(LGUI),T(R), U(LGUI),END );
|
|
||||||
case BABL_SWITCH_APP_NEXT:
|
|
||||||
return MACRO( D(LALT),T(TAB), U(LALT),END );
|
|
||||||
case BABL_SWITCH_APP_LAST:
|
|
||||||
return MACRO( D(LSFT),D(LALT),T(TAB), U(LALT), U(LSFT),END );
|
|
||||||
case BABL_CLOSE_APP:
|
|
||||||
return MACRO( D(LALT),T(F4), U(LALT),END );
|
|
||||||
case BABL_HELP:
|
|
||||||
return MACRO( T(F1),END );
|
|
||||||
break;
|
|
||||||
|
|
||||||
return MACRO_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#ifdef LINUX_MODE
|
|
||||||
case LINUX_MODE:
|
|
||||||
switch(shortcut) {
|
|
||||||
|
|
||||||
case BABL_UNDO:
|
|
||||||
return MACRO( D(LCTRL), T(Z), U(LCTRL), END );
|
|
||||||
case BABL_REDO:
|
|
||||||
return MACRO( D(LCTRL), T(Y), U(LCTRL), END );
|
|
||||||
case BABL_CUT:
|
|
||||||
return MACRO( D(LCTRL), T(X), U(LCTRL), END );
|
|
||||||
case BABL_COPY:
|
|
||||||
return MACRO( D(LCTRL), T(C), U(LCTRL), END );
|
|
||||||
case BABL_PASTE:
|
|
||||||
return MACRO( D(LCTRL), T(V), U(LCTRL), END );
|
|
||||||
case BABL_SELECT_ALL:
|
|
||||||
return MACRO( D(LCTRL), T(A), U(LCTRL), END );
|
|
||||||
case BABL_DEL_RIGHT_1C:
|
|
||||||
return MACRO( D(DEL), END );
|
|
||||||
case BABL_DEL_LEFT_WORD:
|
|
||||||
return MACRO( D(LCTRL), T(BSPACE), U(LCTRL), END );
|
|
||||||
case BABL_DEL_RIGHT_WORD:
|
|
||||||
return MACRO( D(LCTRL), T(DEL), U(LCTRL), END );
|
|
||||||
case BABL_GO_LEFT_1C:
|
|
||||||
return MACRO( T(LEFT), END );
|
|
||||||
case BABL_GO_RIGHT_1C:
|
|
||||||
return MACRO( T(RIGHT), END );
|
|
||||||
case BABL_GO_LEFT_WORD:
|
|
||||||
return MACRO( D(LCTRL), T(LEFT), U(LCTRL), END );
|
|
||||||
case BABL_GO_RIGHT_WORD:
|
|
||||||
return MACRO( D(LCTRL), T(RIGHT), U(LCTRL), END );
|
|
||||||
case BABL_GOTO_START_LINE:
|
|
||||||
return MACRO( T(HOME), END );
|
|
||||||
case BABL_GOTO_START_DOC:
|
|
||||||
return MACRO( D(LCTRL),T(HOME), U(LCTRL),END );
|
|
||||||
case BABL_GOTO_END_LINE:
|
|
||||||
return MACRO( T(END), END );
|
|
||||||
case BABL_GOTO_END_DOC:
|
|
||||||
return MACRO( D(LCTRL),T(END), U(LCTRL),END );
|
|
||||||
case BABL_GOTO_NEXT_LINE:
|
|
||||||
return MACRO( T(DOWN), END );
|
|
||||||
case BABL_GOTO_PREV_LINE:
|
|
||||||
return MACRO( T(UP), END );
|
|
||||||
case BABL_PGDN:
|
|
||||||
return MACRO( T(PGDN), END );
|
|
||||||
case BABL_PGUP:
|
|
||||||
return MACRO( T(PGUP), END );
|
|
||||||
case BABL_FIND:
|
|
||||||
return MACRO( D(LCTRL),T(F), U(LCTRL),END );
|
|
||||||
case BABL_FIND_NEXT:
|
|
||||||
/* return MACRO( T(F3),END ); KDE */
|
|
||||||
return MACRO( D(LCTRL),T(G), U(LCTRL),END ); // Gnome*/
|
|
||||||
case BABL_FIND_REPLACE:
|
|
||||||
/* return MACRO( D(LCTRL),T(R), U(LCTRL),END ); KDE */
|
|
||||||
return MACRO( D(LCTRL),T(H), U(LCTRL),END ); // Gnome*/
|
|
||||||
case BABL_RUNAPP:
|
|
||||||
return MACRO( D(LALT),T(F2), U(LALT),END );
|
|
||||||
case BABL_SWITCH_APP_NEXT:
|
|
||||||
return MACRO( D(LCTL),T(TAB), U(LCTL),END );
|
|
||||||
case BABL_SWITCH_APP_LAST:
|
|
||||||
return MACRO( D(LSFT),D(LCTL),T(TAB), U(LCTL), U(LSFT),END );
|
|
||||||
case BABL_CLOSE_APP:
|
|
||||||
return MACRO( D(LALT),T(F4), U(LALT),END );
|
|
||||||
case BABL_HELP:
|
|
||||||
return MACRO_NONE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
return MACRO_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Uncomment these to remove options an free up flash space
|
||||||
|
|
||||||
|
// This removes everything but cursor movement
|
||||||
|
// BABL_MOVEMENTONLY
|
||||||
|
// and this just removes browser shortcuts
|
||||||
|
// BABL_NOBROWSER
|
||||||
|
///////End///////
|
||||||
|
|
||||||
#ifdef MAC_MODE
|
2) Add the following to your keymap in the action_get_macro
|
||||||
case MAC_MODE:
|
|
||||||
switch(shortcut) {
|
|
||||||
|
|
||||||
case BABL_UNDO:
|
//////Begin//////
|
||||||
return MACRO( D(LGUI), T(Z), U(LGUI), END );
|
#ifdef USE_BABLPASTE
|
||||||
case BABL_REDO:
|
|
||||||
return MACRO( D(LSFT),D(LGUI), T(Z), U(LSFT),U(LGUI), END );
|
|
||||||
case BABL_CUT:
|
|
||||||
return MACRO( D(LGUI), T(X), U(LGUI), END );
|
|
||||||
case BABL_COPY:
|
|
||||||
return MACRO( D(LGUI), T(C), U(LGUI), END );
|
|
||||||
case BABL_PASTE:
|
|
||||||
return MACRO( D(LGUI), T(V), U(LGUI), END );
|
|
||||||
case BABL_SELECT_ALL:
|
|
||||||
return MACRO( D(LGUI), T(A), U(LGUI), END );
|
|
||||||
case BABL_DEL_RIGHT_1C:
|
|
||||||
return MACRO( D(DEL), END );
|
|
||||||
case BABL_DEL_LEFT_WORD:
|
|
||||||
return MACRO( D(LALT), T(BSPACE), U(LALT), END );
|
|
||||||
case BABL_DEL_RIGHT_WORD:
|
|
||||||
return MACRO( D(LALT), T(DEL), U(LALT), END );
|
|
||||||
case BABL_GO_LEFT_1C:
|
|
||||||
return MACRO( T(LEFT), END );
|
|
||||||
case BABL_GO_RIGHT_1C:
|
|
||||||
return MACRO( T(RIGHT), END );
|
|
||||||
case BABL_GO_LEFT_WORD:
|
|
||||||
return MACRO( D(LALT), T(LEFT), U(LALT), END );
|
|
||||||
case BABL_GO_RIGHT_WORD:
|
|
||||||
return MACRO( D(LALT), T(RIGHT), U(LALT), END );
|
|
||||||
case BABL_GOTO_START_LINE:
|
|
||||||
return MACRO( D(LGUI), T(LEFT), U(LGUI), END );
|
|
||||||
case BABL_GOTO_START_DOC:
|
|
||||||
return MACRO( D(LGUI),T(UP), U(LGUI),END );
|
|
||||||
case BABL_GOTO_END_LINE:
|
|
||||||
return MACRO( D(LGUI), T(RIGHT), U(LGUI), END );
|
|
||||||
case BABL_GOTO_END_DOC:
|
|
||||||
return MACRO( D(LGUI),T(DOWN), U(LGUI),END );
|
|
||||||
case BABL_GOTO_NEXT_LINE:
|
|
||||||
return MACRO( T(DOWN), END );
|
|
||||||
case BABL_GOTO_PREV_LINE:
|
|
||||||
return MACRO( T(UP), END );
|
|
||||||
case BABL_PGDN:
|
|
||||||
return MACRO( D(LALT), T(DOWN), U(LALT), END );
|
|
||||||
case BABL_PGUP:
|
|
||||||
return MACRO( D(LALT), T(UP), U(LALT), END );
|
|
||||||
case BABL_FIND:
|
|
||||||
return MACRO( D(LGUI),T(F), U(LGUI),END );
|
|
||||||
case BABL_FIND_NEXT:
|
|
||||||
return MACRO( D(LGUI),T(G), U(LGUI),END );
|
|
||||||
case BABL_FIND_REPLACE:
|
|
||||||
return MACRO( D(LGUI),T(F), U(LGUI),END );
|
|
||||||
case BABL_RUNAPP:
|
|
||||||
return MACRO( D(LGUI),T(R), U(LGUI),END );
|
|
||||||
case BABL_SWITCH_APP_NEXT:
|
|
||||||
return MACRO( D(LGUI),T(TAB), U(LGUI),END );
|
|
||||||
case BABL_SWITCH_APP_LAST:
|
|
||||||
return MACRO( D(LSFT),D(LGUI),T(TAB), U(LGUI), U(LSFT),END );
|
|
||||||
case BABL_CLOSE_APP:
|
|
||||||
return MACRO( D(LGUI),T(Q), U(LGUI),END );
|
|
||||||
case BABL_HELP:
|
|
||||||
return MACRO( D(LSFT),D(LGUI),T(SLASH), U(LGUI), U(LSFT),END );
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
if( id >= BABL_START_NUM && id < (BABL_START_NUM + BABL_NUM_MACROS ) ) {
|
||||||
|
if (record->event.pressed) { // is there a case where this isn't desired?
|
||||||
|
|
||||||
|
babblePaste ( record, id );
|
||||||
return MACRO_NONE;
|
return MACRO_NONE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
///////End///////
|
||||||
|
|
||||||
#ifdef EMACS_MODE
|
3) add Babbelpaste actions to your keymap. See the full list in babblePaste.h, or the
|
||||||
case EMACS_MODE:
|
list below
|
||||||
switch(shortcut) {
|
B_L1C // go left 1 char
|
||||||
//probably should allow meta to not be ALT
|
B_R1C // go Right 1 char
|
||||||
case BABL_UNDO:
|
B_L1W //GO_LEFT_1 WORD
|
||||||
return MACRO( D(LCTL), T(X), U(LCTL),T(C), END );
|
B_R1W //BABL_GO_RIGHT_1 WORD
|
||||||
case BABL_REDO:
|
B_GSOL // BABL_GOTO_START of _LINE
|
||||||
return MACRO( D(LCTL), T(X), U(LCTL),T(C), END ); // arguably
|
B_GEOL // BABL_GOTO_END_LINE
|
||||||
case BABL_CUT:
|
B_GTOP //BABL_GOTO_START_DOC
|
||||||
return MACRO( D(LCTL), T(W), U(LCTL), END );
|
B_GEND //BABL_GO_END_DOC
|
||||||
case BABL_COPY:
|
B_DOWN //BABL_GO_NEXT_LINE
|
||||||
return MACRO( D(LALT), T(W), U(LALT), END );
|
B_UP // BABL_GO_PREV_LINE
|
||||||
case BABL_PASTE:
|
B_PGDN //PGDN
|
||||||
return MACRO( D(LCTL), T(Y), U(LCTL), END );
|
B_PGUP //PGUP
|
||||||
case BABL_SELECT_ALL:
|
// B_BKSP //backspace so why bother.
|
||||||
return MACRO(D(LCTL), T(X), U(LCTL),T(H), END );
|
B_DEL // DEL_RIGHT_1 Char // usually = Del
|
||||||
case BABL_DEL_RIGHT_1C:
|
B_DLW // DEL_LEFT_ 1 WORD)
|
||||||
return MACRO( D(LCTL), T(D), U(LCTL),END );
|
B_DRW //DEL_RIGHT_1 WORD
|
||||||
case BABL_DEL_LEFT_WORD:
|
B_DEOL // delete from cursor to end of line
|
||||||
return MACRO( D(LCTL), T(BSPACE), U(LCTL), END );
|
B_DSOL // delete from cursor to begining line
|
||||||
case BABL_DEL_RIGHT_WORD:
|
B_UNDO //UNDO
|
||||||
return MACRO( D(LALT), T(D), U(LALT), END );
|
B_REDO // REDO
|
||||||
case BABL_GO_LEFT_1C:
|
B_CUT // CUT)
|
||||||
return MACRO( T(LEFT), END );
|
B_COPY // COPY)
|
||||||
case BABL_GO_RIGHT_1C:
|
B_PAST // PASTE)
|
||||||
return MACRO( T(RIGHT), END );
|
B_SELA // SELECT_ALL
|
||||||
case BABL_GO_LEFT_WORD:
|
B_FIND // FIND)
|
||||||
return MACRO( D(LALT), T(B), U(LALT), END );
|
B_FINDN //FIND_NEXT)
|
||||||
case BABL_GO_RIGHT_WORD:
|
B_FINDR // FIND_REPLACE)
|
||||||
return MACRO( D(LALT), T(F), U(LALT), END );
|
B_RAPP // open application launcher
|
||||||
case BABL_GOTO_START_LINE:
|
B_NAPP // switch to next app
|
||||||
return MACRO( D(LCTRL), T(A), U(LCTRL), END );
|
B_PAPP // switch to previous app
|
||||||
case BABL_GOTO_START_DOC:
|
B_CAPP // CLOSE_APP)
|
||||||
return MACRO( D(LALT), D(LSFT), T(COMM),U(LSFT), U(LALT) ,END );
|
B_HELP // HELP)
|
||||||
case BABL_GOTO_END_LINE:
|
B_NTAB // BROWSER_NEW_TAB)
|
||||||
return MACRO( D(LCTRL), T(E), U(LCTRL), END );
|
B_CTAB //BROWSER_CLOSE_TAB)
|
||||||
case BABL_GOTO_END_DOC:
|
B_ROTB //BROWSER_REOPEN_LAST_TAB)
|
||||||
return MACRO( D(LALT), D(LSFT), T(DOT),U(LSFT), U(LALT) ,END );
|
B_NXTB //BROWSER_NEXT_TAB)
|
||||||
case BABL_GOTO_NEXT_LINE:
|
B_PTAB //BROWSER_PREV_TAB)
|
||||||
return MACRO( D(LCTRL), T(N), U(LCTRL), END );
|
B_NURL //BROWSER_jump to URL_BAR)
|
||||||
case BABL_GOTO_PREV_LINE:
|
B_BFWD // BROWSER_FORWARD (in history)
|
||||||
rreturn MACRO( D(LCTRL), T(P), U(LCTRL), END );
|
B_BBAK //BROWSER_BACK (in history)
|
||||||
case BABL_PGDN:
|
B_BFND // BROWSER_FIND)
|
||||||
return MACRO(D(LCTRL), T(V), U(LCTRL), END );
|
B_BOOK //BROWSER_New BOOKMARK)
|
||||||
case BABL_PGUP:
|
B_BDEV //BROWSER_ Open DEV_TOOLS) // hard one to remember
|
||||||
return MACRO( D(LALT), T(V), U(LALT), END );
|
B_BRLD // BROWSER_RELOAD Page
|
||||||
case BABL_FIND:
|
B_BFUlL // BROWSER_FULLSCREEN)
|
||||||
return MACRO( D(LCTRL), T(S), U(LCTRL),END );
|
B_ZMIN // BROWSER_ZOOM_IN)
|
||||||
case BABL_FIND_NEXT:
|
B_ZMOT //BROWSER_ZOOM_OUT)
|
||||||
return MACRO( D(LCTRL), T(S), U(LCTRL),END );
|
|
||||||
case BABL_FIND_REPLACE:
|
|
||||||
return MACRO( D(LALT),D(LSFT), T(5),U(LSFT), U(LALT), END );
|
|
||||||
case BABL_RUNAPP:
|
|
||||||
return MACRO( D(LALT), T(X), U(LALT),T(S),T(H),T(E),T(L),T(L),END );// arguably
|
|
||||||
case BABL_SWITCH_APP_NEXT:
|
|
||||||
return MACRO( D(LCTL), T(X), U(LCTL),T(RIGHT), END ); // arguably
|
|
||||||
case BABL_SWITCH_APP_LAST:
|
|
||||||
return MACRO( D(LCTL), T(X), U(LCTL),T(LEFT), END ); // arguably
|
|
||||||
case BABL_CLOSE_APP:
|
|
||||||
return MACRO(D(LCTL), T(X), U(LCTL),T(C),END );
|
|
||||||
case BABL_HELP:
|
|
||||||
return MACRO( D(LCTL),T(H), U(LCTL),T(A),END); // start search in help
|
|
||||||
break;
|
|
||||||
|
|
||||||
return MACRO_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#### Development notes
|
||||||
#ifdef VI_MODE
|
-Why a new function? Because it would make the keymap too ugly to put it there.
|
||||||
case VI_MODE:
|
-Why not return the macro to action_get_macro? Because I kept running into scope problems
|
||||||
switch(shortcut) {
|
and pointers to the wrong type.
|
||||||
//assume esc is already called
|
-Why not an array of arrays as a lookup instead of a function? That would allow you
|
||||||
case BABL_UNDO:
|
to store the lookup table in PROGMEM. True, but that takes more pre-processor skill
|
||||||
return MACRO( T(U), END );
|
than I had.
|
||||||
case BABL_REDO:
|
|
||||||
return MACRO( D(LCTL), T(R), U(LCTL), END );
|
|
||||||
case BABL_CUT:
|
|
||||||
return MACRO( T(X), END );
|
|
||||||
case BABL_COPY:
|
|
||||||
return MACRO( T(Y),END );
|
|
||||||
case BABL_PASTE:
|
|
||||||
return MACRO( T(P), END );
|
|
||||||
case BABL_SELECT_ALL:
|
|
||||||
return MACRO( T(COLN),T(PERC),T(Y), END ); // wrong but helpful?
|
|
||||||
case BABL_DEL_RIGHT_1C:
|
|
||||||
return MACRO( T(X),END );
|
|
||||||
case BABL_DEL_LEFT_WORD:
|
|
||||||
return MACRO( T(D),T(G),T(E),END );
|
|
||||||
case BABL_DEL_RIGHT_WORD:
|
|
||||||
return MACRO( T(D),T(W),END );
|
|
||||||
case BABL_GO_LEFT_1C:
|
|
||||||
return MACRO( T(H), END );
|
|
||||||
case BABL_GO_RIGHT_1C:
|
|
||||||
return MACRO( T(L), END );
|
|
||||||
case BABL_GO_LEFT_WORD:
|
|
||||||
return MACRO( T(B),END );
|
|
||||||
case BABL_GO_RIGHT_WORD:
|
|
||||||
return MACRO( T(W), END );
|
|
||||||
case BABL_GOTO_START_LINE:
|
|
||||||
return MACRO( T(CIRC), END );
|
|
||||||
case BABL_GOTO_START_DOC:
|
|
||||||
return MACRO( T(G),T(G) ,END );
|
|
||||||
case BABL_GOTO_END_LINE:
|
|
||||||
return MACRO( T(DLR), END );
|
|
||||||
case BABL_GOTO_END_DOC:
|
|
||||||
return MACRO( D(LSFT), T(G),U(LSFT), ,END );
|
|
||||||
case BABL_GOTO_NEXT_LINE:
|
|
||||||
return MACRO( T(J), END );
|
|
||||||
case BABL_GOTO_PREV_LINE:
|
|
||||||
rreturn MACRO( T(K), END );
|
|
||||||
case BABL_PGDN:
|
|
||||||
return MACRO(D(LCTRL), T(F), U(LCTRL), END );
|
|
||||||
case BABL_PGUP:
|
|
||||||
return MACRO( D(LCTRL), T(B), U(LCTRL), END );
|
|
||||||
case BABL_FIND:
|
|
||||||
return MACRO( T(SLASH),END );
|
|
||||||
case BABL_FIND_NEXT:
|
|
||||||
return MACRO( T(N),END );
|
|
||||||
case BABL_FIND_REPLACE:
|
|
||||||
return MACRO( D(LALT),D(LSFT), T(5),U(LSFT), U(LALT), END );
|
|
||||||
case BABL_RUNAPP:
|
|
||||||
return MACRO_NONE;
|
|
||||||
case BABL_SWITCH_APP_NEXT:
|
|
||||||
return MACRO_NONE;
|
|
||||||
case BABL_SWITCH_APP_LAST:
|
|
||||||
return MACRO_NONE;
|
|
||||||
case BABL_CLOSE_APP:
|
|
||||||
return MACRO(T(COLN), T(Q), T(EXLM),END );
|
|
||||||
case BABL_HELP:
|
|
||||||
return MACRO(T(COLN),T(H),END); // start search in help
|
|
||||||
break;
|
|
||||||
|
|
||||||
return MACRO_NONE;
|
-Have you tested this on every platform? No. Submit a patch.
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#ifdef READMUX_MODE
|
|
||||||
// I havent decided how much to do bash and how much tmux
|
|
||||||
case READMUX_MODE:
|
|
||||||
switch(shortcut) {
|
|
||||||
case BABL_UNDO:
|
|
||||||
return MACRO( D(LALT), T(R), U(LALT) , END );
|
|
||||||
case BABL_REDO:
|
|
||||||
return MACRO( D(LCTL), T(X), U(LCTL),T(C), END ); // arguably
|
|
||||||
case BABL_CUT:
|
|
||||||
return MACRO( D(LCTL), T(K), U(LCTL), END ); // wrong half the time
|
|
||||||
case BABL_COPY:
|
|
||||||
return MACRO_NONE;
|
|
||||||
case BABL_PASTE:
|
|
||||||
return MACRO( D(LCTL), T(Y), U(LCTL), END );
|
|
||||||
case BABL_SELECT_ALL:
|
|
||||||
return MACRO(D(LCTL), T(A), T(K), T(Y), U(LCTL) , END ); // should this be tmux all?
|
|
||||||
case BABL_DEL_RIGHT_1C:
|
|
||||||
return MACRO( D(LCTL), T(D), U(LCTL),END );
|
|
||||||
case BABL_DEL_LEFT_WORD:
|
|
||||||
return MACRO( D(LCTL), T(W), U(LCTL), END );
|
|
||||||
case BABL_DEL_RIGHT_WORD:
|
|
||||||
return MACRO( D(LALT), T(D), U(LALT), END );
|
|
||||||
case BABL_GO_LEFT_1C:
|
|
||||||
return MACRO( T(LEFT), END );
|
|
||||||
case BABL_GO_RIGHT_1C:
|
|
||||||
return MACRO( T(RIGHT), END );
|
|
||||||
case BABL_GO_LEFT_WORD:
|
|
||||||
return MACRO( D(LALT), T(B), U(LALT), END );
|
|
||||||
case BABL_GO_RIGHT_WORD:
|
|
||||||
return MACRO( D(LALT), T(F), U(LALT), END );
|
|
||||||
case BABL_GOTO_START_LINE:
|
|
||||||
return MACRO( D(LCTRL), T(A), U(LCTRL), END );
|
|
||||||
case BABL_GOTO_START_DOC:
|
|
||||||
return MACRO_NONE; // tmux?
|
|
||||||
case BABL_GOTO_END_LINE:
|
|
||||||
return MACRO( D(LCTRL), T(E), U(LCTRL), END );
|
|
||||||
case BABL_GOTO_END_DOC:
|
|
||||||
return MACRO_NONE; // tmux?
|
|
||||||
case BABL_GOTO_NEXT_LINE:
|
|
||||||
return MACRO( D(LCTRL), T(N), U(LCTRL), END );
|
|
||||||
case BABL_GOTO_PREV_LINE:
|
|
||||||
return MACRO( D(LCTRL), T(P), U(LCTRL), END );
|
|
||||||
case BABL_PGDN:
|
|
||||||
return MACRO( T(PGDN), END );
|
|
||||||
case BABL_PGUP:
|
|
||||||
return MACRO( T(PGUP), END );
|
|
||||||
case BABL_FIND:
|
|
||||||
return MACRO( D(LCTRL), T(R), U(LCTRL), END ); // search history
|
|
||||||
case BABL_FIND_NEXT:
|
|
||||||
eturn MACRO( D(LCTRL), T(S), U(LCTRL), END );
|
|
||||||
case BABL_FIND_REPLACE:
|
|
||||||
return MACRO_NONE; // tmux?
|
|
||||||
case BABL_RUNAPP:
|
|
||||||
return MACRO( D(LCTRL), T(B), U(LCTRL), T(C),END ); //tmux
|
|
||||||
case BABL_SWITCH_APP_NEXT:
|
|
||||||
return MACRO( D(LCTRL), T(B), U(LCTRL), T(N),END ); //tmux
|
|
||||||
case BABL_SWITCH_APP_LAST:
|
|
||||||
return MACRO( D(LCTRL), T(B), U(LCTRL), T(P),END ); //tmux
|
|
||||||
case BABL_CLOSE_APP:
|
|
||||||
return MACRO( D(LCTRL), T(B), U(LCTRL), T(D),END); // usually what I want
|
|
||||||
break;
|
|
||||||
case BABL_HELP:
|
|
||||||
return MACRO_NONE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
return MACRO_NONE;
|
### Next steps for someone.
|
||||||
}
|
Make it easier to pair macros with modifiers. So key foo will jump to start of line, and
|
||||||
|
Shift(foo) will jump to the first tab in a browser.
|
||||||
|
|
||||||
|
## Thanks
|
||||||
|
|
||||||
|
Thanks to https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts
|
||||||
|
and https://github.com/qmk/qmk_firmware/blob/master/keyboards/planck/keymaps/jeebak/keymap.c
|
||||||
|
And of course QMK...
|
||||||
|
|
||||||
#endif
|
|
||||||
return MACRO_NONE;
|
|
||||||
}
|
|
@ -108,11 +108,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
* -------------------------------------------------------------------------------'
|
* -------------------------------------------------------------------------------'
|
||||||
* | | | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |Bakspace| Del|
|
* | | | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |Bakspace| Del|
|
||||||
* ---------------------------------------------------------------------------
|
* ---------------------------------------------------------------------------
|
||||||
* | tab | q | w |Find| |pTab |DSOL|DelW| Up |DelW|DEOL| [ | ] | \ | |
|
* | tab | | |Find| |pTab |DSOL|DelW| Up |DelW|DEOL| [ | ] | \ | |
|
||||||
* -------------------------------------------------------------------------------'
|
* -------------------------------------------------------------------------------'
|
||||||
* |Bak/Mov| a | s | d | |nTab |GSOL| <- | Dwn | -> | EOL | ' | enter |PgUp|
|
* |Bak/Mov| | | | |nTab |GSOL| <- | Dwn | -> | EOL | ' | enter |PgUp|
|
||||||
* --------------------------------------------------------------------------------
|
* --------------------------------------------------------------------------------
|
||||||
* |Lsft |Undo| Cut|Copy|Pste| b | n | m | , | . | / | Rsft| Up| PgDn|
|
* |Lsft |Undo| Cut|Copy|Pste| | | | | | / | Rsft| Up| PgDn|
|
||||||
* ---------------------------------------------------------------------------------
|
* ---------------------------------------------------------------------------------
|
||||||
* |Lctl |Lgui |Lalt | Space/Sym | GUI | Sym | Rctl |Left|Down|Rght|
|
* |Lctl |Lgui |Lalt | Space/Sym | GUI | Sym | Rctl |Left|Down|Rght|
|
||||||
* ---------------------------------------------------------------------------------
|
* ---------------------------------------------------------------------------------
|
||||||
@ -189,7 +189,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||||||
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* If this is in the range of BABL macros, call a separate function */
|
/* If id is in the range of BABL macros, call the babl function */
|
||||||
/* Any clever remapping with modifiers should happen here e.g. shift bablkey does opposite*/
|
/* Any clever remapping with modifiers should happen here e.g. shift bablkey does opposite*/
|
||||||
#ifdef USE_BABLPASTE
|
#ifdef USE_BABLPASTE
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user