mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-22 03:19:24 +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
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef MAC_MODE
|
|
||||||
case MAC_MODE:
|
|
||||||
switch(shortcut) {
|
|
||||||
|
|
||||||
case BABL_UNDO:
|
|
||||||
return MACRO( D(LGUI), T(Z), U(LGUI), END );
|
|
||||||
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;
|
|
||||||
|
|
||||||
return MACRO_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef EMACS_MODE
|
|
||||||
case EMACS_MODE:
|
|
||||||
switch(shortcut) {
|
|
||||||
//probably should allow meta to not be ALT
|
|
||||||
case BABL_UNDO:
|
|
||||||
return MACRO( D(LCTL), T(X), U(LCTL),T(C), END );
|
|
||||||
case BABL_REDO:
|
|
||||||
return MACRO( D(LCTL), T(X), U(LCTL),T(C), END ); // arguably
|
|
||||||
case BABL_CUT:
|
|
||||||
return MACRO( D(LCTL), T(W), U(LCTL), END );
|
|
||||||
case BABL_COPY:
|
|
||||||
return MACRO( D(LALT), T(W), U(LALT), END );
|
|
||||||
case BABL_PASTE:
|
|
||||||
return MACRO( D(LCTL), T(Y), U(LCTL), END );
|
|
||||||
case BABL_SELECT_ALL:
|
|
||||||
return MACRO(D(LCTL), T(X), U(LCTL),T(H), END );
|
|
||||||
case BABL_DEL_RIGHT_1C:
|
|
||||||
return MACRO( D(LCTL), T(D), U(LCTL),END );
|
|
||||||
case BABL_DEL_LEFT_WORD:
|
|
||||||
return MACRO( D(LCTL), T(BSPACE), 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( D(LALT), D(LSFT), T(COMM),U(LSFT), U(LALT) ,END );
|
|
||||||
case BABL_GOTO_END_LINE:
|
|
||||||
return MACRO( D(LCTRL), T(E), U(LCTRL), END );
|
|
||||||
case BABL_GOTO_END_DOC:
|
|
||||||
return MACRO( D(LALT), D(LSFT), T(DOT),U(LSFT), U(LALT) ,END );
|
|
||||||
case BABL_GOTO_NEXT_LINE:
|
|
||||||
return MACRO( D(LCTRL), T(N), U(LCTRL), END );
|
|
||||||
case BABL_GOTO_PREV_LINE:
|
|
||||||
rreturn MACRO( D(LCTRL), T(P), U(LCTRL), END );
|
|
||||||
case BABL_PGDN:
|
|
||||||
return MACRO(D(LCTRL), T(V), U(LCTRL), END );
|
|
||||||
case BABL_PGUP:
|
|
||||||
return MACRO( D(LALT), T(V), U(LALT), END );
|
|
||||||
case BABL_FIND:
|
|
||||||
return MACRO( D(LCTRL), T(S), U(LCTRL),END );
|
|
||||||
case BABL_FIND_NEXT:
|
|
||||||
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
|
|
||||||
#ifdef VI_MODE
|
|
||||||
case VI_MODE:
|
|
||||||
switch(shortcut) {
|
|
||||||
//assume esc is already called
|
|
||||||
case BABL_UNDO:
|
|
||||||
return MACRO( T(U), END );
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef READMUX_MODE
|
|
||||||
// I havent decided how much to do bash and how much tmux
|
// Uncomment these to remove options an free up flash space
|
||||||
case READMUX_MODE:
|
|
||||||
switch(shortcut) {
|
// This removes everything but cursor movement
|
||||||
case BABL_UNDO:
|
// BABL_MOVEMENTONLY
|
||||||
return MACRO( D(LALT), T(R), U(LALT) , END );
|
// and this just removes browser shortcuts
|
||||||
case BABL_REDO:
|
// BABL_NOBROWSER
|
||||||
return MACRO( D(LCTL), T(X), U(LCTL),T(C), END ); // arguably
|
///////End///////
|
||||||
case BABL_CUT:
|
|
||||||
return MACRO( D(LCTL), T(K), U(LCTL), END ); // wrong half the time
|
2) Add the following to your keymap in the action_get_macro
|
||||||
case BABL_COPY:
|
|
||||||
return MACRO_NONE;
|
//////Begin//////
|
||||||
case BABL_PASTE:
|
#ifdef USE_BABLPASTE
|
||||||
return MACRO( D(LCTL), T(Y), U(LCTL), END );
|
|
||||||
case BABL_SELECT_ALL:
|
if( id >= BABL_START_NUM && id < (BABL_START_NUM + BABL_NUM_MACROS ) ) {
|
||||||
return MACRO(D(LCTL), T(A), T(K), T(Y), U(LCTL) , END ); // should this be tmux all?
|
if (record->event.pressed) { // is there a case where this isn't desired?
|
||||||
case BABL_DEL_RIGHT_1C:
|
|
||||||
return MACRO( D(LCTL), T(D), U(LCTL),END );
|
babblePaste ( record, id );
|
||||||
case BABL_DEL_LEFT_WORD:
|
return MACRO_NONE;
|
||||||
return MACRO( D(LCTL), T(W), U(LCTL), END );
|
}
|
||||||
case BABL_DEL_RIGHT_WORD:
|
}
|
||||||
return MACRO( D(LALT), T(D), U(LALT), END );
|
#endif
|
||||||
case BABL_GO_LEFT_1C:
|
///////End///////
|
||||||
return MACRO( T(LEFT), END );
|
|
||||||
case BABL_GO_RIGHT_1C:
|
3) add Babbelpaste actions to your keymap. See the full list in babblePaste.h, or the
|
||||||
return MACRO( T(RIGHT), END );
|
list below
|
||||||
case BABL_GO_LEFT_WORD:
|
B_L1C // go left 1 char
|
||||||
return MACRO( D(LALT), T(B), U(LALT), END );
|
B_R1C // go Right 1 char
|
||||||
case BABL_GO_RIGHT_WORD:
|
B_L1W //GO_LEFT_1 WORD
|
||||||
return MACRO( D(LALT), T(F), U(LALT), END );
|
B_R1W //BABL_GO_RIGHT_1 WORD
|
||||||
case BABL_GOTO_START_LINE:
|
B_GSOL // BABL_GOTO_START of _LINE
|
||||||
return MACRO( D(LCTRL), T(A), U(LCTRL), END );
|
B_GEOL // BABL_GOTO_END_LINE
|
||||||
case BABL_GOTO_START_DOC:
|
B_GTOP //BABL_GOTO_START_DOC
|
||||||
return MACRO_NONE; // tmux?
|
B_GEND //BABL_GO_END_DOC
|
||||||
case BABL_GOTO_END_LINE:
|
B_DOWN //BABL_GO_NEXT_LINE
|
||||||
return MACRO( D(LCTRL), T(E), U(LCTRL), END );
|
B_UP // BABL_GO_PREV_LINE
|
||||||
case BABL_GOTO_END_DOC:
|
B_PGDN //PGDN
|
||||||
return MACRO_NONE; // tmux?
|
B_PGUP //PGUP
|
||||||
case BABL_GOTO_NEXT_LINE:
|
// B_BKSP //backspace so why bother.
|
||||||
return MACRO( D(LCTRL), T(N), U(LCTRL), END );
|
B_DEL // DEL_RIGHT_1 Char // usually = Del
|
||||||
case BABL_GOTO_PREV_LINE:
|
B_DLW // DEL_LEFT_ 1 WORD)
|
||||||
return MACRO( D(LCTRL), T(P), U(LCTRL), END );
|
B_DRW //DEL_RIGHT_1 WORD
|
||||||
case BABL_PGDN:
|
B_DEOL // delete from cursor to end of line
|
||||||
return MACRO( T(PGDN), END );
|
B_DSOL // delete from cursor to begining line
|
||||||
case BABL_PGUP:
|
B_UNDO //UNDO
|
||||||
return MACRO( T(PGUP), END );
|
B_REDO // REDO
|
||||||
case BABL_FIND:
|
B_CUT // CUT)
|
||||||
return MACRO( D(LCTRL), T(R), U(LCTRL), END ); // search history
|
B_COPY // COPY)
|
||||||
case BABL_FIND_NEXT:
|
B_PAST // PASTE)
|
||||||
eturn MACRO( D(LCTRL), T(S), U(LCTRL), END );
|
B_SELA // SELECT_ALL
|
||||||
case BABL_FIND_REPLACE:
|
B_FIND // FIND)
|
||||||
return MACRO_NONE; // tmux?
|
B_FINDN //FIND_NEXT)
|
||||||
case BABL_RUNAPP:
|
B_FINDR // FIND_REPLACE)
|
||||||
return MACRO( D(LCTRL), T(B), U(LCTRL), T(C),END ); //tmux
|
B_RAPP // open application launcher
|
||||||
case BABL_SWITCH_APP_NEXT:
|
B_NAPP // switch to next app
|
||||||
return MACRO( D(LCTRL), T(B), U(LCTRL), T(N),END ); //tmux
|
B_PAPP // switch to previous app
|
||||||
case BABL_SWITCH_APP_LAST:
|
B_CAPP // CLOSE_APP)
|
||||||
return MACRO( D(LCTRL), T(B), U(LCTRL), T(P),END ); //tmux
|
B_HELP // HELP)
|
||||||
case BABL_CLOSE_APP:
|
B_NTAB // BROWSER_NEW_TAB)
|
||||||
return MACRO( D(LCTRL), T(B), U(LCTRL), T(D),END); // usually what I want
|
B_CTAB //BROWSER_CLOSE_TAB)
|
||||||
break;
|
B_ROTB //BROWSER_REOPEN_LAST_TAB)
|
||||||
case BABL_HELP:
|
B_NXTB //BROWSER_NEXT_TAB)
|
||||||
return MACRO_NONE;
|
B_PTAB //BROWSER_PREV_TAB)
|
||||||
break;
|
B_NURL //BROWSER_jump to URL_BAR)
|
||||||
|
B_BFWD // BROWSER_FORWARD (in history)
|
||||||
return MACRO_NONE;
|
B_BBAK //BROWSER_BACK (in history)
|
||||||
}
|
B_BFND // BROWSER_FIND)
|
||||||
|
B_BOOK //BROWSER_New BOOKMARK)
|
||||||
#endif
|
B_BDEV //BROWSER_ Open DEV_TOOLS) // hard one to remember
|
||||||
return MACRO_NONE;
|
B_BRLD // BROWSER_RELOAD Page
|
||||||
}
|
B_BFUlL // BROWSER_FULLSCREEN)
|
||||||
|
B_ZMIN // BROWSER_ZOOM_IN)
|
||||||
|
B_ZMOT //BROWSER_ZOOM_OUT)
|
||||||
|
|
||||||
|
|
||||||
|
#### Development notes
|
||||||
|
-Why a new function? Because it would make the keymap too ugly to put it there.
|
||||||
|
-Why not return the macro to action_get_macro? Because I kept running into scope problems
|
||||||
|
and pointers to the wrong type.
|
||||||
|
-Why not an array of arrays as a lookup instead of a function? That would allow you
|
||||||
|
to store the lookup table in PROGMEM. True, but that takes more pre-processor skill
|
||||||
|
than I had.
|
||||||
|
|
||||||
|
-Have you tested this on every platform? No. Submit a patch.
|
||||||
|
|
||||||
|
|
||||||
|
### 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...
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \
|
____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \
|
||||||
M(VIBRK), KC_CIRC, KC_LCBR, KC_RCBR,KC_AT, KC_PERC, ____, KC_LBRC,KC_LPRN,KC_RPRN,KC_UNDS, ____, ____, ____,\
|
M(VIBRK), KC_CIRC, KC_LCBR, KC_RCBR,KC_AT, KC_PERC, ____, KC_LBRC,KC_LPRN,KC_RPRN,KC_UNDS, ____, ____, ____,\
|
||||||
____, KC_EXLM, KC_HASH, KC_0, KC_EQL, KC_LCBR, KC_RCBR,KC_MINS,KC_1, KC_PLUS,KC_RBRC, KC_GRV, ____, ____,\
|
____, KC_EXLM, KC_HASH, KC_0, KC_EQL, KC_LCBR, KC_RCBR,KC_MINS,KC_1, KC_PLUS,KC_RBRC, KC_GRV, ____, ____,\
|
||||||
____, KC_SCLN, KC_TILDE, KC_COLN, KC_TILDE, KC_PIPE, KC_DLR, KC_ASTR, ____, KC_DOT , KC_SLSH, ____, ____, ____,\
|
____, KC_SCLN, KC_TILDE, KC_COLN, KC_TILDE, KC_PIPE, KC_DLR, KC_ASTR, ____, KC_DOT , KC_SLSH, ____, ____, ____,\
|
||||||
____, ____, ____, ____, ____, ____, ____, ____, ____, ____
|
____, ____, ____, ____, ____, ____, ____, ____, ____, ____
|
||||||
),
|
),
|
||||||
/*
|
/*
|
||||||
@ -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