From b80c97b712de41871be1a25a30d6ec838ea9eda3 Mon Sep 17 00:00:00 2001 From: milestogo Date: Tue, 28 Feb 2017 23:27:49 -0800 Subject: clean up babblepaste --- keyboards/handwired/MS-sculpt-mobile/babblePaste.c | 468 +++++++++++++++++++++ 1 file changed, 468 insertions(+) create mode 100644 keyboards/handwired/MS-sculpt-mobile/babblePaste.c (limited to 'keyboards/handwired/MS-sculpt-mobile/babblePaste.c') diff --git a/keyboards/handwired/MS-sculpt-mobile/babblePaste.c b/keyboards/handwired/MS-sculpt-mobile/babblePaste.c new file mode 100644 index 0000000000..00e8416f41 --- /dev/null +++ b/keyboards/handwired/MS-sculpt-mobile/babblePaste.c @@ -0,0 +1,468 @@ +/* A library to output the right key shortcut in any common app. +Given a global variable babble_mode to show the environment and a +key that calls the paste macro, do the right type of paste. +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 +and https://github.com/qmk/qmk_firmware/blob/master/keyboards/planck/keymaps/jeebak/keymap.c +*/ + +#include "babblePaste.h" +#include "action_layer.h" + +// GLOBAL variable. Sets startup default if no eeppom +char babble_mode = MAC_MODE ; + + +const static macro_t *babblePaste (keyrecord_t *record, uint16_t shortcut) { + + switch(babble_mode) { + +#ifdef MS_MODE + case MS_MODE: + switch(shortcut) { + + case BABL_DEL_RIGHT_1C: + return (static macro_t *) 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_GO_START_LINE: + return MACRO( T(HOME), END ); + case BABL_GO_START_DOC: + return MACRO( D(LCTRL),T(HOME), U(LCTRL),END ); + case BABL_GO_END_LINE: + return MACRO( T(END), END ); + case BABL_GO_END_DOC: + return MACRO( D(LCTRL),T(END), U(LCTRL),END ); + case BABL_GO_NEXT_LINE: + return MACRO( T(DOWN), END ); + case BABL_GO_PREV_LINE: + return MACRO( T(UP), END ); + case BABL_PGDN: + return MACRO( T(PGDN), END ); + case BABL_PGUP: + return MACRO( T(PGUP), END ); +#ifndef BABL_MOVEMENTONLY + 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_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_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 ); +#endif + break; + + return MACRO_NONE; + } + +#endif +#ifdef LINUX_MODE + case LINUX_MODE: + switch(shortcut) { + + 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_GO_START_LINE: + return MACRO( T(HOME), END ); + case BABL_GO_START_DOC: + return MACRO( D(LCTRL),T(HOME), U(LCTRL),END ); + case BABL_GO_END_LINE: + return MACRO( T(END), END ); + case BABL_GO_END_DOC: + return MACRO( D(LCTRL),T(END), U(LCTRL),END ); + case BABL_GO_NEXT_LINE: + return MACRO( T(DOWN), END ); + case BABL_GO_PREV_LINE: + return MACRO( T(UP), END ); + case BABL_PGDN: + return MACRO( T(PGDN), END ); + case BABL_PGUP: + return MACRO( T(PGUP), END ); +#ifndef BABL_MOVEMENTONLY + 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_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; +#endif + break; + + return MACRO_NONE; + } + +#endif + +#ifdef MAC_MODE + case MAC_MODE: + switch(shortcut) { + + + 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_GO_START_LINE: + return MACRO( D(LGUI), T(LEFT), U(LGUI), END ); + case BABL_GO_START_DOC: + return MACRO( D(LGUI),T(UP), U(LGUI),END ); + case BABL_GO_END_LINE: + return MACRO( D(LGUI), T(RIGHT), U(LGUI), END ); + case BABL_GO_END_DOC: + return MACRO( D(LGUI),T(DOWN), U(LGUI),END ); + case BABL_GO_NEXT_LINE: + return MACRO( T(DOWN), END ); + case BABL_GO_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 ); +#ifndef BABL_MOVEMENTONLY + 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_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 ); +#endif + break; + + return MACRO_NONE; + } + +#endif + +#ifdef EMACS_MODE + case EMACS_MODE: + switch(shortcut) { +//probably should allow meta to not be ALT + + 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_GO_START_LINE: + return MACRO( D(LCTRL), T(A), U(LCTRL), END ); + case BABL_GO_START_DOC: + return MACRO( D(LALT), D(LSFT), T(COMM),U(LSFT), U(LALT) ,END ); + case BABL_GO_END_LINE: + return MACRO( D(LCTRL), T(E), U(LCTRL), END ); + case BABL_GO_END_DOC: + return MACRO( D(LALT), D(LSFT), T(DOT),U(LSFT), U(LALT) ,END ); + case BABL_GO_NEXT_LINE: + return MACRO( D(LCTRL), T(N), U(LCTRL), END ); + case BABL_GO_PREV_LINE: + return 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 ); +#ifndef BABL_MOVEMENTONLY + 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 ); //really? + 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_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 +#endif + break; + + return MACRO_NONE; + } + +#endif +#ifdef VI_MODE + case VI_MODE: + switch(shortcut) { +//assume esc is already called + + 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_GO_START_LINE: + return MACRO( D(LSFT), T(6),U(LSFT), END ); //^ + case BABL_GO_START_DOC: + return MACRO( T(G),T(G) ,END ); + case BABL_GO_END_LINE: + return MACRO( D(LSFT), T(4),U(LSFT) , END ); //$ + case BABL_GO_END_DOC: + return MACRO( D(LSFT), T(G),U(LSFT),END ); + case BABL_GO_NEXT_LINE: + return MACRO( T(J), END ); + case BABL_GO_PREV_LINE: + return 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 ); +#ifndef BABL_MOVEMENTONLY + 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( D(LSFT), T(SCLN),U(LSFT),D(LSFT), T(5),U(LSFT),T(Y), END ); // wrong but helpful? + 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(D(LSFT), T(SCLN),U(LSFT), T(Q), D(RSFT), T(1),U(RSFT), END ); + case BABL_HELP: + return MACRO(D(LSFT), T(SCLN),U(LSFT),T(H),END); // start search in help + break; +#endif + return MACRO_NONE; + } + +#endif +#ifdef READMUX_MODE +// Readline command line editing + tmux windowing +// I havent decided how much to do readline and how much tmux + case READMUX_MODE: + switch(shortcut) { + + 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_GO_START_LINE: + return MACRO( D(LCTRL), T(A), U(LCTRL), END ); + case BABL_GO_START_DOC: + return MACRO_NONE; // tmux? + case BABL_GO_END_LINE: + return MACRO( D(LCTRL), T(E), U(LCTRL), END ); + case BABL_GO_END_DOC: + return MACRO_NONE; // tmux? + case BABL_GO_NEXT_LINE: + return MACRO( D(LCTRL), T(N), U(LCTRL), END ); + case BABL_GO_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 ); +#ifndef BABL_MOVEMENTONLY + 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 ); + 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; +#endif + break; + + return MACRO_NONE; + } + +#endif + return MACRO_NONE; + } + + +} + -- cgit v1.2.3 From 2f677c24a8fcf936e92a0a5acfbbf95b5f47fdb7 Mon Sep 17 00:00:00 2001 From: milestogo Date: Mon, 6 Mar 2017 00:16:44 -0800 Subject: working with preprocessor macros for babblepaste --- keyboards/handwired/MS-sculpt-mobile/babblePaste.c | 609 ++++++++------------- 1 file changed, 233 insertions(+), 376 deletions(-) (limited to 'keyboards/handwired/MS-sculpt-mobile/babblePaste.c') diff --git a/keyboards/handwired/MS-sculpt-mobile/babblePaste.c b/keyboards/handwired/MS-sculpt-mobile/babblePaste.c index 00e8416f41..93ff486e0d 100644 --- a/keyboards/handwired/MS-sculpt-mobile/babblePaste.c +++ b/keyboards/handwired/MS-sculpt-mobile/babblePaste.c @@ -8,242 +8,159 @@ and https://github.com/qmk/qmk_firmware/blob/master/keyboards/planck/keymaps/jee */ #include "babblePaste.h" -#include "action_layer.h" +#include "action_macro.h" -// GLOBAL variable. Sets startup default if no eeppom -char babble_mode = MAC_MODE ; +#ifdef USE_BABLPASTE +// GLOBAL variable to determine mode. Sets startup default if no eeppom +uint8_t babble_mode =0 ; -const static macro_t *babblePaste (keyrecord_t *record, uint16_t shortcut) { + +// Today I learned that the preprocessor can not create a switch statement label from an argument +// And else statements have problems, see https://gcc.gnu.org/onlinedocs/gcc-3.0.1/cpp_3.html#SEC15 +#define BABLM(ent, macro...) \ + if ( ent == shortcut ) \ + { action_macro_play( MACRO(macro)); return MACRO_NONE; } - switch(babble_mode) { - + +const macro_t *babblePaste (keyrecord_t *record, uint8_t shortcut) { +/* this function runs the appropriate babblepaste macro, given +the global babble_mode, and a shortcut from the ENUM in babblePaste.h +TODO, the pointers in this function should be stored in a PROGMEM array, not ram. +But that requires even more clever preprocessor foo. +*/ + + if ( shortcut < BABL_START_NUM || \ + shortcut >= (BABL_START_NUM + BABL_NUM_MACROS ) ) { + return MACRO_NONE; + } + + + switch(babble_mode) { + #ifdef MS_MODE - case MS_MODE: - switch(shortcut) { - - case BABL_DEL_RIGHT_1C: - return (static macro_t *) 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_GO_START_LINE: - return MACRO( T(HOME), END ); - case BABL_GO_START_DOC: - return MACRO( D(LCTRL),T(HOME), U(LCTRL),END ); - case BABL_GO_END_LINE: - return MACRO( T(END), END ); - case BABL_GO_END_DOC: - return MACRO( D(LCTRL),T(END), U(LCTRL),END ); - case BABL_GO_NEXT_LINE: - return MACRO( T(DOWN), END ); - case BABL_GO_PREV_LINE: - return MACRO( T(UP), END ); - case BABL_PGDN: - return MACRO( T(PGDN), END ); - case BABL_PGUP: - return MACRO( T(PGUP), END ); + + case MS_MODE: + BABLM( BABL_DEL_RIGHT_1C, T(DEL), END ); + BABLM( BABL_DEL_LEFT_WORD, D(LCTRL), T(BSPACE), U(LCTRL), END ); + BABLM( BABL_DEL_RIGHT_WORD,D(LCTRL), T(DEL), U(LCTRL), END ); + BABLM( BABL_GO_LEFT_1C, T(LEFT), END ); + BABLM( BABL_GO_RIGHT_1C , T(RIGHT), END ); + BABLM( BABL_GO_LEFT_WORD, D(LCTRL), T(LEFT), U(LCTRL), END ); + BABLM( BABL_GO_RIGHT_WORD, D(LCTRL), T(RIGHT), U(LCTRL), END ); + BABLM( BABL_GO_START_LINE, T(HOME), END ); + BABLM( BABL_GO_START_DOC, D(LCTRL),T(HOME), U(LCTRL),END ); + BABLM( BABL_GO_END_LINE, T(END), END ); + BABLM( BABL_GO_END_DOC, D(LCTRL),T(END), U(LCTRL),END ); + BABLM( BABL_GO_NEXT_LINE, T(DOWN), END ); + BABLM( BABL_GO_PREV_LINE, T(UP), END ); + BABLM( BABL_PGDN, T(PGDN), END ); + BABLM( BABL_PGUP, T(PGUP), END ); #ifndef BABL_MOVEMENTONLY - 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_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_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 ); + BABLM( BABL_UNDO, D(LCTRL), T(Z), U(LCTRL), END ); + BABLM( BABL_REDO, D(LCTRL), T(Y), U(LCTRL), END ); + BABLM( BABL_CUT, D(LCTRL), T(X), U(LCTRL), END ); + BABLM( BABL_COPY, D(LCTRL), T(C), U(LCTRL), END ); + BABLM( BABL_PASTE, D(LCTRL), T(V), U(LCTRL), END ); + BABLM( BABL_SELECT_ALL, D(LCTRL), T(A), U(LCTRL), END ); + BABLM( BABL_UNDO, D(LCTRL), T(Z), U(LCTRL), END ); + BABLM( BABL_REDO, D(LCTRL), T(Y), U(LCTRL), END ); + BABLM( BABL_CUT, D(LCTRL), T(X), U(LCTRL), END ); + BABLM( BABL_COPY, D(LCTRL), T(C), U(LCTRL), END ); + BABLM( BABL_PASTE, D(LCTRL), T(V), U(LCTRL), END ); + BABLM( BABL_SELECT_ALL, D(LCTRL), T(A), U(LCTRL), END ); + BABLM( BABL_FIND, D(LCTRL),T(F), U(LCTRL),END ); + BABLM( BABL_FIND_NEXT, T(F3),END ); + BABLM( BABL_FIND_REPLACE, D(LCTRL),T(H), U(LCTRL),END ); + BABLM( BABL_RUNAPP, D(LGUI),T(R), U(LGUI),END ); + BABLM( BABL_SWITCH_APP_NEXT, D(LALT),T(TAB), U(LALT),END ); + BABLM( BABL_SWITCH_APP_LAST, D(LSFT),D(LALT),T(TAB), U(LALT), U(LSFT),END ); + BABLM( BABL_CLOSE_APP, D(LALT),T(F4), U(LALT),END ); + BABLM( BABL_HELP, T(F1),END ); #endif - break; - - return MACRO_NONE; - } - -#endif + + + return MACRO_NONE; + + +#endif /* MS_MODE*/ + + #ifdef LINUX_MODE case LINUX_MODE: - switch(shortcut) { - - 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_GO_START_LINE: - return MACRO( T(HOME), END ); - case BABL_GO_START_DOC: - return MACRO( D(LCTRL),T(HOME), U(LCTRL),END ); - case BABL_GO_END_LINE: - return MACRO( T(END), END ); - case BABL_GO_END_DOC: - return MACRO( D(LCTRL),T(END), U(LCTRL),END ); - case BABL_GO_NEXT_LINE: - return MACRO( T(DOWN), END ); - case BABL_GO_PREV_LINE: - return MACRO( T(UP), END ); - case BABL_PGDN: - return MACRO( T(PGDN), END ); - case BABL_PGUP: - return MACRO( T(PGUP), END ); + + BABLM( BABL_DEL_RIGHT_1C , D(DEL), END ); + BABLM( BABL_DEL_LEFT_WORD , D(LCTRL), T(BSPACE), U(LCTRL), END ); + BABLM( BABL_DEL_RIGHT_WORD , D(LCTRL), T(DEL), U(LCTRL), END ); + BABLM( BABL_GO_LEFT_1C , T(LEFT), END ); + BABLM( BABL_GO_RIGHT_1C , T(RIGHT), END ); + BABLM( BABL_GO_LEFT_WORD , D(LCTRL), T(LEFT), U(LCTRL), END ); + BABLM( BABL_GO_RIGHT_WORD , D(LCTRL), T(RIGHT), U(LCTRL), END ); + BABLM( BABL_GO_START_LINE , T(HOME), END ); + BABLM( BABL_GO_START_DOC , D(LCTRL),T(HOME), U(LCTRL),END ); + BABLM( BABL_GO_END_LINE , T(END), END ); + BABLM( BABL_GO_END_DOC , D(LCTRL),T(END), U(LCTRL),END ); + BABLM( BABL_GO_NEXT_LINE , T(DOWN), END ); + BABLM( BABL_GO_PREV_LINE , T(UP), END ); + BABLM( BABL_PGDN , T(PGDN), END ); + BABLM( BABL_PGUP , T(PGUP), END ); #ifndef BABL_MOVEMENTONLY - 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_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; + BABLM( BABL_UNDO , D(LCTRL), T(Z), U(LCTRL), END ); + BABLM( BABL_REDO , D(LCTRL), T(Y), U(LCTRL), END ); + BABLM( BABL_CUT , D(LCTRL), T(X), U(LCTRL), END ); + BABLM( BABL_COPY , D(LCTRL), T(C), U(LCTRL), END ); + BABLM( BABL_PASTE , D(LCTRL), T(V), U(LCTRL), END ); + BABLM( BABL_SELECT_ALL, D(LCTRL), T(A), U(LCTRL), END ); + BABLM( BABL_FIND, D(LCTRL),T(F), U(LCTRL),END ); + /* BABLM(BABL_FIND_NEXT , T(F3),END ); KDE */ + BABLM( BABL_FIND_NEXT, D(LCTRL),T(G), U(LCTRL),END ); // Gnome*/ + /* BABLM( , D(LCTRL),T(R), U(LCTRL),END ); KDE */ + BABLM( BABL_FIND_REPLACE, D(LCTRL),T(H), U(LCTRL),END ); // Gnome*/ + BABLM( BABL_RUNAPP, D(LALT),T(F2), U(LALT),END ); + BABLM( BABL_SWITCH_APP_NEXT, D(LCTL),T(TAB), U(LCTL),END ); + BABLM( BABL_SWITCH_APP_LAST, D(LSFT),D(LCTL),T(TAB), U(LCTL), U(LSFT),END ); + BABLM( BABL_CLOSE_APP, D(LALT),T(F4), U(LALT),END ); + BABLM( BABL_HELP, END ); #endif - break; - return MACRO_NONE; - } #endif #ifdef MAC_MODE case MAC_MODE: - switch(shortcut) { - - - 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_GO_START_LINE: - return MACRO( D(LGUI), T(LEFT), U(LGUI), END ); - case BABL_GO_START_DOC: - return MACRO( D(LGUI),T(UP), U(LGUI),END ); - case BABL_GO_END_LINE: - return MACRO( D(LGUI), T(RIGHT), U(LGUI), END ); - case BABL_GO_END_DOC: - return MACRO( D(LGUI),T(DOWN), U(LGUI),END ); - case BABL_GO_NEXT_LINE: - return MACRO( T(DOWN), END ); - case BABL_GO_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 ); + BABLM( BABL_DEL_RIGHT_1C , D(DEL), END ); + BABLM( BABL_DEL_LEFT_WORD , D(LALT), T(BSPACE), U(LALT), END ); + BABLM( BABL_DEL_RIGHT_WORD, D(LALT), T(DEL), U(LALT), END ); + BABLM( BABL_GO_LEFT_1C , T(LEFT), END ); + BABLM( BABL_GO_RIGHT_1C, T(RIGHT), END ); + BABLM( BABL_GO_LEFT_WORD , D(LALT), T(LEFT), U(LALT), END ); + BABLM( BABL_GO_RIGHT_WORD , D(LALT), T(RIGHT), U(LALT), END ); + BABLM( BABL_GO_START_LINE , D(LGUI), T(LEFT), U(LGUI), END ); + BABLM( BABL_GO_START_DOC , D(LGUI),T(UP), U(LGUI),END ); + BABLM( BABL_GO_END_LINE , D(LGUI), T(RIGHT), U(LGUI), END ); + BABLM( BABL_GO_END_DOC , D(LGUI),T(DOWN), U(LGUI),END ); + BABLM( BABL_GO_NEXT_LINE , T(DOWN), END ); + BABLM( BABL_GO_PREV_LINE , T(UP), END ); + BABLM( BABL_PGDN , D(LALT),T(DOWN), U(LALT), END ); + BABLM( BABL_PGUP , D(LALT),T(UP), U(LALT), END ); #ifndef BABL_MOVEMENTONLY - 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_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 ); + BABLM( BABL_UNDO , D(1), D(LGUI), T(Z), U(LGUI), END ); + BABLM( BABL_REDO , D(LSFT),D(LGUI), T(Z), U(LSFT),U(LGUI), END ); + BABLM( BABL_CUT , D(LGUI), T(X), U(LGUI), END ); + BABLM( BABL_COPY , D(LGUI), T(C), U(LGUI), END ); + BABLM( BABL_PASTE , D(LGUI), T(V), U(LGUI), END ); + BABLM( BABL_SELECT_ALL , D(LGUI), T(A), U(LGUI), END ); + BABLM( BABL_FIND , D(LGUI),T(F), U(LGUI),END ); + BABLM( BABL_FIND_NEXT, D(LGUI),T(G), U(LGUI),END ); + BABLM( BABL_FIND_REPLACE, D(LGUI),T(F), U(LGUI),END ); + BABLM( BABL_RUNAPP , D(LGUI),T(R), U(LGUI),END ); + BABLM( BABL_SWITCH_APP_NEXT , D(LGUI),T(TAB), U(LGUI),END ); + BABLM( BABL_SWITCH_APP_LAST , D(LSFT),D(LGUI),T(TAB), U(LGUI), U(LSFT),END ); + BABLM( BABL_CLOSE_APP , D(LGUI),T(Q), U(LGUI),END ); + BABLM( BABL_HELP , D(LSFT),D(LGUI),T(SLASH), U(LGUI), U(LSFT),END ); #endif - break; - + return MACRO_NONE; - } - #endif #ifdef EMACS_MODE @@ -252,64 +169,64 @@ const static macro_t *babblePaste (keyrecord_t *record, uint16_t shortcut) { //probably should allow meta to not be ALT case BABL_DEL_RIGHT_1C: - return MACRO( D(LCTL), T(D), U(LCTL),END ); + BABLM( , D(LCTL), T(D), U(LCTL),END ); case BABL_DEL_LEFT_WORD: - return MACRO( D(LCTL), T(BSPACE), U(LCTL), END ); + BABLM( , D(LCTL), T(BSPACE), U(LCTL), END ); case BABL_DEL_RIGHT_WORD: - return MACRO( D(LALT), T(D), U(LALT), END ); + BABLM( , D(LALT), T(D), U(LALT), END ); case BABL_GO_LEFT_1C: - return MACRO( T(LEFT), END ); + BABLM( , T(LEFT), END ); case BABL_GO_RIGHT_1C: - return MACRO( T(RIGHT), END ); + BABLM( , T(RIGHT), END ); case BABL_GO_LEFT_WORD: - return MACRO( D(LALT), T(B), U(LALT), END ); + BABLM( , D(LALT), T(B), U(LALT), END ); case BABL_GO_RIGHT_WORD: - return MACRO( D(LALT), T(F), U(LALT), END ); + BABLM( , D(LALT), T(F), U(LALT), END ); case BABL_GO_START_LINE: - return MACRO( D(LCTRL), T(A), U(LCTRL), END ); + BABLM( , D(LCTRL), T(A), U(LCTRL), END ); case BABL_GO_START_DOC: - return MACRO( D(LALT), D(LSFT), T(COMM),U(LSFT), U(LALT) ,END ); + BABLM( , D(LALT), D(LSFT), T(COMM),U(LSFT), U(LALT) ,END ); case BABL_GO_END_LINE: - return MACRO( D(LCTRL), T(E), U(LCTRL), END ); + BABLM( , D(LCTRL), T(E), U(LCTRL), END ); case BABL_GO_END_DOC: - return MACRO( D(LALT), D(LSFT), T(DOT),U(LSFT), U(LALT) ,END ); + BABLM( , D(LALT), D(LSFT), T(DOT),U(LSFT), U(LALT) ,END ); case BABL_GO_NEXT_LINE: - return MACRO( D(LCTRL), T(N), U(LCTRL), END ); + BABLM( , D(LCTRL), T(N), U(LCTRL), END ); case BABL_GO_PREV_LINE: - return MACRO( D(LCTRL), T(P), U(LCTRL), END ); + BABLM( , D(LCTRL), T(P), U(LCTRL), END ); case BABL_PGDN: - return MACRO(D(LCTRL), T(V), U(LCTRL), END ); + BABLM( ,D(LCTRL), T(V), U(LCTRL), END ); case BABL_PGUP: - return MACRO( D(LALT), T(V), U(LALT), END ); + BABLM( , D(LALT), T(V), U(LALT), END ); #ifndef BABL_MOVEMENTONLY case BABL_UNDO: - return MACRO( D(LCTL), T(X), U(LCTL),T(C), END ); + BABLM( , D(LCTL), T(X), U(LCTL),T(C), END ); case BABL_REDO: - return MACRO( D(LCTL), T(X), U(LCTL),T(C), END ); // arguably + BABLM( , D(LCTL), T(X), U(LCTL),T(C), END ); // arguably case BABL_CUT: - return MACRO( D(LCTL), T(W), U(LCTL), END ); + BABLM( , D(LCTL), T(W), U(LCTL), END ); case BABL_COPY: - return MACRO( D(LALT), T(W), U(LALT), END ); //really? + BABLM( , D(LALT), T(W), U(LALT), END ); //really? case BABL_PASTE: - return MACRO( D(LCTL), T(Y), U(LCTL), END ); + BABLM( , D(LCTL), T(Y), U(LCTL), END ); case BABL_SELECT_ALL: - return MACRO(D(LCTL), T(X), U(LCTL),T(H), END ); + BABLM( ,D(LCTL), T(X), U(LCTL),T(H), END ); case BABL_FIND: - return MACRO( D(LCTRL), T(S), U(LCTRL),END ); + BABLM( , D(LCTRL), T(S), U(LCTRL),END ); case BABL_FIND_NEXT: - return MACRO( D(LCTRL), T(S), U(LCTRL),END ); + BABLM( , D(LCTRL), T(S), U(LCTRL),END ); case BABL_FIND_REPLACE: - return MACRO( D(LALT),D(LSFT), T(5),U(LSFT), U(LALT), END ); + BABLM( , 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 + BABLM( , 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 + BABLM( , 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 + BABLM( , 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 ); + BABLM( ,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 + BABLM( , D(LCTL),T(H), U(LCTL),T(A),END); // start search in help #endif break; @@ -319,150 +236,90 @@ const static macro_t *babblePaste (keyrecord_t *record, uint16_t shortcut) { #endif #ifdef VI_MODE case VI_MODE: - switch(shortcut) { //assume esc is already called - 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_GO_START_LINE: - return MACRO( D(LSFT), T(6),U(LSFT), END ); //^ - case BABL_GO_START_DOC: - return MACRO( T(G),T(G) ,END ); - case BABL_GO_END_LINE: - return MACRO( D(LSFT), T(4),U(LSFT) , END ); //$ - case BABL_GO_END_DOC: - return MACRO( D(LSFT), T(G),U(LSFT),END ); - case BABL_GO_NEXT_LINE: - return MACRO( T(J), END ); - case BABL_GO_PREV_LINE: - return 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 ); + BABLM( BABL_DEL_RIGHT_1C , T(X),END ); + BABLM( BABL_DEL_LEFT_WORD , T(D),T(G),T(E),END ); + BABLM( BABL_DEL_RIGHT_WORD , T(D),T(W),END ); + BABLM( BABL_GO_LEFT_1C , T(H), END ); + BABLM( BABL_GO_RIGHT_1C , T(L), END ); + BABLM( BABL_GO_LEFT_WORD , T(B),END ); + BABLM( BABL_GO_RIGHT_WORD , T(W), END ); + BABLM( BABL_GO_START_LINE , D(LSFT), T(6),U(LSFT), END ); //^ + BABLM( BABL_GO_START_DOC , T(G),T(G) ,END ); + BABLM( BABL_GO_END_LINE , D(LSFT), T(4),U(LSFT) , END ); //$ + BABLM( BABL_GO_END_DOC , D(LSFT), T(G),U(LSFT),END ); + BABLM( BABL_GO_NEXT_LINE , T(J), END ); + BABLM( BABL_GO_PREV_LINE, T(K), END ); + BABLM( BABL_PGDN ,D(LCTRL), T(F), U(LCTRL), END ); + BABLM( BABL_PGUP , D(LCTRL), T(B), U(LCTRL), END ); #ifndef BABL_MOVEMENTONLY - 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( D(LSFT), T(SCLN),U(LSFT),D(LSFT), T(5),U(LSFT),T(Y), END ); // wrong but helpful? - 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(D(LSFT), T(SCLN),U(LSFT), T(Q), D(RSFT), T(1),U(RSFT), END ); - case BABL_HELP: - return MACRO(D(LSFT), T(SCLN),U(LSFT),T(H),END); // start search in help - break; + BABLM( BABL_UNDO , T(U), END ); + BABLM( BABL_REDO , D(LCTL), T(R), U(LCTL), END ); + BABLM( BABL_CUT , T(X), END ); + BABLM( BABL_COPY , T(Y),END ); + BABLM( BABL_PASTE , T(P), END ); + BABLM( BABL_SELECT_ALL , D(LSFT), T(SCLN),U(LSFT),D(LSFT), T(5),U(LSFT),T(Y), END ); // wrong but helpful? + BABLM( BABL_FIND , T(SLASH),END ); + BABLM( BABL_FIND_NEXT , T(N),END ); + BABLM( BABL_FIND_REPLACE , D(LALT),D(LSFT), T(5),U(LSFT), U(LALT), END ); + BABLM( BABL_RUNAPP,END ); + BABLM( BABL_SWITCH_APP_NEXT ,END ); + BABLM( BABL_SWITCH_APP_LAST ,END ); + BABLM(BABL_CLOSE_APP, D(LSFT), T(SCLN),U(LSFT), T(Q), D(RSFT), T(1),U(RSFT), END ); + BABLM(BABL_HELP, D(LSFT), T(SCLN),U(LSFT),T(H),END); // start search in help #endif - return MACRO_NONE; - } - + return MACRO_NONE; #endif + + + + #ifdef READMUX_MODE // Readline command line editing + tmux windowing // I havent decided how much to do readline and how much tmux - case READMUX_MODE: - switch(shortcut) { - - 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_GO_START_LINE: - return MACRO( D(LCTRL), T(A), U(LCTRL), END ); - case BABL_GO_START_DOC: - return MACRO_NONE; // tmux? - case BABL_GO_END_LINE: - return MACRO( D(LCTRL), T(E), U(LCTRL), END ); - case BABL_GO_END_DOC: - return MACRO_NONE; // tmux? - case BABL_GO_NEXT_LINE: - return MACRO( D(LCTRL), T(N), U(LCTRL), END ); - case BABL_GO_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 READMUX_MODE: + BABLM( BABL_DEL_RIGHT_1C , D(LCTL), T(D), U(LCTL),END ); + BABLM( BABL_DEL_LEFT_WORD , D(LCTL), T(W), U(LCTL), END ); + BABLM( BABL_DEL_RIGHT_WORD , D(LALT), T(D), U(LALT), END ); + BABLM( BABL_GO_LEFT_1C , T(LEFT), END ); + BABLM( BABL_GO_RIGHT_1C , T(RIGHT), END ); + BABLM( BABL_GO_LEFT_WORD , D(LALT), T(B), U(LALT), END ); + BABLM( BABL_GO_RIGHT_WORD , D(LALT), T(F), U(LALT), END ); + BABLM( BABL_GO_START_LINE , D(LCTRL), T(A), U(LCTRL), END ); + BABLM( BABL_GO_START_DOC ,END );// tmux? + BABLM( BABL_GO_END_LINE , D(LCTRL), T(E), U(LCTRL), END ); + BABLM( BABL_GO_END_DOC ,END ); // tmux? + BABLM( BABL_GO_NEXT_LINE , D(LCTRL), T(N), U(LCTRL), END ); + BABLM( BABL_GO_PREV_LINE , D(LCTRL), T(P), U(LCTRL), END ); + BABLM( BABL_PGDN , T(PGDN), END ); + BABLM( BABL_PGUP , T(PGUP), END ); #ifndef BABL_MOVEMENTONLY - 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 ); - 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; + BABLM( BABL_UNDO , D(LALT), T(R), U(LALT) , END ); + BABLM( BABL_REDO , D(LCTL), T(X), U(LCTL),T(C), END ); // arguably + BABLM( BABL_CUT , D(LCTL), T(K), U(LCTL), END ); // wrong half the time + BABLM( BABL_COPY ,END ); + BABLM( BABL_PASTE , D(LCTL), T(Y), U(LCTL), END ); + BABLM( BABL_SELECT_ALL ,D(LCTL), T(A), T(K), T(Y), U(LCTL) , END ); + BABLM( BABL_FIND , D(LCTRL), T(R), U(LCTRL), END ); // search history + BABLM(BABL_FIND_NEXT, D(LCTRL), T(S), U(LCTRL), END ); + BABLM( BABL_FIND_REPLACE ,END ); + BABLM( BABL_RUNAPP , D(LCTRL), T(B), U(LCTRL), T(C),END ); //tmux + BABLM( BABL_SWITCH_APP_NEXT , D(LCTRL), T(B), U(LCTRL), T(N),END ); //tmux + BABLM( BABL_SWITCH_APP_LAST , D(LCTRL), T(B), U(LCTRL), T(P),END ); //tmux + BABLM( BABL_CLOSE_APP , D(LCTRL), T(B), U(LCTRL), T(D),END); // usually what I want + BABLM( BABL_HELP ,END ); #endif - break; - - return MACRO_NONE; - } + + return MACRO_NONE; #endif - return MACRO_NONE; - } + default: + return MACRO_NONE; + } } + +#endif \ No newline at end of file -- cgit v1.2.3 From 01980c96e9c1e8ab5aad0e89d03c0e15417712c8 Mon Sep 17 00:00:00 2001 From: milestogo Date: Wed, 8 Mar 2017 01:06:25 -0800 Subject: added browser babble, removed code from keymap --- keyboards/handwired/MS-sculpt-mobile/babblePaste.c | 408 +++++++++++++-------- 1 file changed, 263 insertions(+), 145 deletions(-) (limited to 'keyboards/handwired/MS-sculpt-mobile/babblePaste.c') diff --git a/keyboards/handwired/MS-sculpt-mobile/babblePaste.c b/keyboards/handwired/MS-sculpt-mobile/babblePaste.c index 93ff486e0d..491a79333e 100644 --- a/keyboards/handwired/MS-sculpt-mobile/babblePaste.c +++ b/keyboards/handwired/MS-sculpt-mobile/babblePaste.c @@ -15,6 +15,13 @@ and https://github.com/qmk/qmk_firmware/blob/master/keyboards/planck/keymaps/jee // GLOBAL variable to determine mode. Sets startup default if no eeppom uint8_t babble_mode =0 ; +// small function that we might also want to call from a keymap. + +macro_t* switch_babble_mode( uint8_t id) { + babble_mode= id; + return MACRO_NONE; //less typing above +} + // Today I learned that the preprocessor can not create a switch statement label from an argument // And else statements have problems, see https://gcc.gnu.org/onlinedocs/gcc-3.0.1/cpp_3.html#SEC15 @@ -23,63 +30,80 @@ uint8_t babble_mode =0 ; { action_macro_play( MACRO(macro)); return MACRO_NONE; } -const macro_t *babblePaste (keyrecord_t *record, uint8_t shortcut) { /* this function runs the appropriate babblepaste macro, given the global babble_mode, and a shortcut from the ENUM in babblePaste.h TODO, the pointers in this function should be stored in a PROGMEM array, not ram. But that requires even more clever preprocessor foo. */ - +const macro_t *babblePaste (keyrecord_t *record, uint8_t shortcut) { +/* if ( shortcut < BABL_START_NUM || \ shortcut >= (BABL_START_NUM + BABL_NUM_MACROS ) ) { return MACRO_NONE; } - - +*/ switch(babble_mode) { - -#ifdef MS_MODE + + +#ifdef MS_MODE + if ( BABL_WINDOWS == shortcut ) { return switch_babble_mode(MS_MODE); } + case MS_MODE: - BABLM( BABL_DEL_RIGHT_1C, T(DEL), END ); - BABLM( BABL_DEL_LEFT_WORD, D(LCTRL), T(BSPACE), U(LCTRL), END ); - BABLM( BABL_DEL_RIGHT_WORD,D(LCTRL), T(DEL), U(LCTRL), END ); BABLM( BABL_GO_LEFT_1C, T(LEFT), END ); BABLM( BABL_GO_RIGHT_1C , T(RIGHT), END ); - BABLM( BABL_GO_LEFT_WORD, D(LCTRL), T(LEFT), U(LCTRL), END ); - BABLM( BABL_GO_RIGHT_WORD, D(LCTRL), T(RIGHT), U(LCTRL), END ); + BABLM( BABL_GO_LEFT_WORD, D(LCTL), T(LEFT), U(LCTL), END ); + BABLM( BABL_GO_RIGHT_WORD, D(LCTL), T(RIGHT), U(LCTL), END ); BABLM( BABL_GO_START_LINE, T(HOME), END ); - BABLM( BABL_GO_START_DOC, D(LCTRL),T(HOME), U(LCTRL),END ); BABLM( BABL_GO_END_LINE, T(END), END ); - BABLM( BABL_GO_END_DOC, D(LCTRL),T(END), U(LCTRL),END ); + BABLM( BABL_GO_START_DOC, D(LCTL),T(HOME), U(LCTL),END ); + BABLM( BABL_GO_END_DOC, D(LCTL),T(END), U(LCTL),END ); BABLM( BABL_GO_NEXT_LINE, T(DOWN), END ); BABLM( BABL_GO_PREV_LINE, T(UP), END ); BABLM( BABL_PGDN, T(PGDN), END ); BABLM( BABL_PGUP, T(PGUP), END ); + BABLM( BABL_DEL_RIGHT_1C, T(DEL), END ); + BABLM( BABL_DEL_LEFT_WORD, D(LCTL), T(BSPACE), U(LCTL), END ); + BABLM( BABL_DEL_RIGHT_WORD, D(LCTL), T(DEL), U(LCTL), END ); + BABLM( BABL_DEL_TO_LINE_END, D(RSFT), T(HOME), U(RSFT), T(DEL), END); + BABLM( BABL_DEL_TO_LINE_START, D(RSFT), T(END), U(RSFT), T(DEL), END ); #ifndef BABL_MOVEMENTONLY - BABLM( BABL_UNDO, D(LCTRL), T(Z), U(LCTRL), END ); - BABLM( BABL_REDO, D(LCTRL), T(Y), U(LCTRL), END ); - BABLM( BABL_CUT, D(LCTRL), T(X), U(LCTRL), END ); - BABLM( BABL_COPY, D(LCTRL), T(C), U(LCTRL), END ); - BABLM( BABL_PASTE, D(LCTRL), T(V), U(LCTRL), END ); - BABLM( BABL_SELECT_ALL, D(LCTRL), T(A), U(LCTRL), END ); - BABLM( BABL_UNDO, D(LCTRL), T(Z), U(LCTRL), END ); - BABLM( BABL_REDO, D(LCTRL), T(Y), U(LCTRL), END ); - BABLM( BABL_CUT, D(LCTRL), T(X), U(LCTRL), END ); - BABLM( BABL_COPY, D(LCTRL), T(C), U(LCTRL), END ); - BABLM( BABL_PASTE, D(LCTRL), T(V), U(LCTRL), END ); - BABLM( BABL_SELECT_ALL, D(LCTRL), T(A), U(LCTRL), END ); - BABLM( BABL_FIND, D(LCTRL),T(F), U(LCTRL),END ); + BABLM( BABL_UNDO, D(LCTL), T(Z), U(LCTL), END ); + BABLM( BABL_REDO, D(LCTL), T(Y), U(LCTL), END ); + BABLM( BABL_CUT, D(LCTL), T(X), U(LCTL), END ); + BABLM( BABL_COPY, D(LCTL), T(C), U(LCTL), END ); + BABLM( BABL_PASTE, D(LCTL), T(V), U(LCTL), END ); + BABLM( BABL_SELECT_ALL, D(LCTL), T(A), U(LCTL), END ); + BABLM( BABL_FIND, D(LCTL),T(F), U(LCTL),END ); BABLM( BABL_FIND_NEXT, T(F3),END ); - BABLM( BABL_FIND_REPLACE, D(LCTRL),T(H), U(LCTRL),END ); + BABLM( BABL_FIND_REPLACE, D(LCTL),T(H), U(LCTL),END ); BABLM( BABL_RUNAPP, D(LGUI),T(R), U(LGUI),END ); BABLM( BABL_SWITCH_APP_NEXT, D(LALT),T(TAB), U(LALT),END ); BABLM( BABL_SWITCH_APP_LAST, D(LSFT),D(LALT),T(TAB), U(LALT), U(LSFT),END ); BABLM( BABL_CLOSE_APP, D(LALT),T(F4), U(LALT),END ); BABLM( BABL_HELP, T(F1),END ); +#ifndef BABL_NOBROWSER + BABLM( BABL_BROWSER_NEW_TAB, D(LCTL), T(T), U(LCTL),END ); + BABLM( BABL_BROWSER_CLOSE_TAB, D(LCTL), T(W), U(LCTL),END ); + BABLM( BABL_BROWSER_REOPEN_LAST_TAB, D(LCTL), D(RSFT),T(T), U(RSFT),U(LCTL),END ); + BABLM( BABL_BROWSER_NEXT_TAB, D(LCTL), T(TAB), U(LCTL),END ); + BABLM( BABL_BROWSER_PREV_TAB, D(LCTL), D(RSFT), T(TAB), U(RSFT), U(LCTL),END ); + BABLM( BABL_BROWSER_URL_BAR, D(LCTL), T(L), U(LCTL),END ); + BABLM( BABL_BROWSER_FORWARD, D(LALT), T(RIGHT), U(LALT),END ); + BABLM( BABL_BROWSER_BACK, D(LALT), T(LEFT), U(LALT),END ); + BABLM( BABL_BROWSER_FIND, D(LCTL), T(F), U(LCTL),END ); + BABLM( BABL_BROWSER_BOOKMARK, D(LCTL), T(D), U(LCTL),END ); + //BABLM( BABL_BROWSER_DEV_TOOLS, T(F12), U(LCTL),END ); // EDGE + BABLM( BABL_BROWSER_DEV_TOOLS, D(LCTL), T(T), U(LCTL),END ); // Chrome + // Chrome + BABLM( BABL_BROWSER_RELOAD, D(LCTL), T(F5), U(LCTL),END ); // hard reload w/o cache + BABLM( BABL_BROWSER_FULLSCREEN, T(F11),END ); //command shift F + BABLM( BABL_BROWSER_ZOOM_IN, D(LCTL), D(RSFT), T(EQL), U(RSFT), U(LCTL),END ); // ctr+ + + BABLM( BABL_BROWSER_ZOOM_OUT, D(LCTL), T(MINS), U(LCTL),END ); +#endif #endif - + // Todo, ring bell, flash light, show user this isn't supported return MACRO_NONE; @@ -87,62 +111,87 @@ But that requires even more clever preprocessor foo. #ifdef LINUX_MODE + if ( BABL_LINUX == shortcut ) { return switch_babble_mode(LINUX_MODE); } + case LINUX_MODE: - - BABLM( BABL_DEL_RIGHT_1C , D(DEL), END ); - BABLM( BABL_DEL_LEFT_WORD , D(LCTRL), T(BSPACE), U(LCTRL), END ); - BABLM( BABL_DEL_RIGHT_WORD , D(LCTRL), T(DEL), U(LCTRL), END ); BABLM( BABL_GO_LEFT_1C , T(LEFT), END ); BABLM( BABL_GO_RIGHT_1C , T(RIGHT), END ); - BABLM( BABL_GO_LEFT_WORD , D(LCTRL), T(LEFT), U(LCTRL), END ); - BABLM( BABL_GO_RIGHT_WORD , D(LCTRL), T(RIGHT), U(LCTRL), END ); + BABLM( BABL_GO_LEFT_WORD , D(LCTL), T(LEFT), U(LCTL), END ); + BABLM( BABL_GO_RIGHT_WORD , D(LCTL), T(RIGHT), U(LCTL), END ); BABLM( BABL_GO_START_LINE , T(HOME), END ); - BABLM( BABL_GO_START_DOC , D(LCTRL),T(HOME), U(LCTRL),END ); BABLM( BABL_GO_END_LINE , T(END), END ); - BABLM( BABL_GO_END_DOC , D(LCTRL),T(END), U(LCTRL),END ); + BABLM( BABL_GO_START_DOC , D(LCTL),T(HOME), U(LCTL),END ); + BABLM( BABL_GO_END_DOC , D(LCTL),T(END), U(LCTL),END ); BABLM( BABL_GO_NEXT_LINE , T(DOWN), END ); BABLM( BABL_GO_PREV_LINE , T(UP), END ); BABLM( BABL_PGDN , T(PGDN), END ); BABLM( BABL_PGUP , T(PGUP), END ); + BABLM( BABL_DEL_RIGHT_1C , D(DEL), END ); + BABLM( BABL_DEL_LEFT_WORD , D(LCTL), T(BSPACE), U(LCTL), END ); + BABLM( BABL_DEL_RIGHT_WORD , D(LCTL), T(DEL), U(LCTL), END ); + BABLM( BABL_DEL_TO_LINE_END, D(RSFT), T(HOME), U(RSFT), T(DEL), END); + BABLM( BABL_DEL_TO_LINE_START, D(RSFT), T(END), U(RSFT), T(DEL), END ); #ifndef BABL_MOVEMENTONLY - BABLM( BABL_UNDO , D(LCTRL), T(Z), U(LCTRL), END ); - BABLM( BABL_REDO , D(LCTRL), T(Y), U(LCTRL), END ); - BABLM( BABL_CUT , D(LCTRL), T(X), U(LCTRL), END ); - BABLM( BABL_COPY , D(LCTRL), T(C), U(LCTRL), END ); - BABLM( BABL_PASTE , D(LCTRL), T(V), U(LCTRL), END ); - BABLM( BABL_SELECT_ALL, D(LCTRL), T(A), U(LCTRL), END ); - BABLM( BABL_FIND, D(LCTRL),T(F), U(LCTRL),END ); + BABLM( BABL_UNDO , D(LCTL), T(Z), U(LCTL), END ); + BABLM( BABL_REDO , D(LCTL), T(Y), U(LCTL), END ); + BABLM( BABL_CUT , D(LCTL), T(X), U(LCTL), END ); + BABLM( BABL_COPY , D(LCTL), T(C), U(LCTL), END ); + BABLM( BABL_PASTE , D(LCTL), T(V), U(LCTL), END ); + BABLM( BABL_SELECT_ALL, D(LCTL), T(A), U(LCTL), END ); + BABLM( BABL_FIND, D(LCTL),T(F), U(LCTL),END ); /* BABLM(BABL_FIND_NEXT , T(F3),END ); KDE */ - BABLM( BABL_FIND_NEXT, D(LCTRL),T(G), U(LCTRL),END ); // Gnome*/ - /* BABLM( , D(LCTRL),T(R), U(LCTRL),END ); KDE */ - BABLM( BABL_FIND_REPLACE, D(LCTRL),T(H), U(LCTRL),END ); // Gnome*/ + BABLM( BABL_FIND_NEXT, D(LCTL),T(G), U(LCTL),END ); // Gnome*/ + /* BABLM( , D(LCTL),T(R), U(LCTL),END ); KDE */ + BABLM( BABL_FIND_REPLACE, D(LCTL),T(H), U(LCTL),END ); // Gnome*/ BABLM( BABL_RUNAPP, D(LALT),T(F2), U(LALT),END ); BABLM( BABL_SWITCH_APP_NEXT, D(LCTL),T(TAB), U(LCTL),END ); BABLM( BABL_SWITCH_APP_LAST, D(LSFT),D(LCTL),T(TAB), U(LCTL), U(LSFT),END ); BABLM( BABL_CLOSE_APP, D(LALT),T(F4), U(LALT),END ); - BABLM( BABL_HELP, END ); + //BABLM( BABL_HELP, END ); + +#ifndef BABL_NOBROWSER + BABLM( BABL_BROWSER_NEW_TAB, D(LCTL), T(T), U(LCTL),END ); + BABLM( BABL_BROWSER_CLOSE_TAB, D(LCTL), T(W), U(LCTL),END ); + BABLM( BABL_BROWSER_REOPEN_LAST_TAB, D(LCTL), D(RSFT),T(T), U(RSFT),U(LCTL),END ); + BABLM( BABL_BROWSER_NEXT_TAB, D(LCTL), T(TAB), U(LCTL),END ); + BABLM( BABL_BROWSER_PREV_TAB, D(LCTL), D(RSFT), T(TAB), U(RSFT), U(LCTL),END ); + BABLM( BABL_BROWSER_URL_BAR, D(LCTL), T(L), U(LCTL),END ); + BABLM( BABL_BROWSER_FORWARD, D(LALT), T(RIGHT), U(LALT),END ); + BABLM( BABL_BROWSER_BACK, D(LALT), T(LEFT), U(LALT),END ); + BABLM( BABL_BROWSER_FIND, D(LCTL), T(F), U(LCTL),END ); + BABLM( BABL_BROWSER_BOOKMARK, D(LCTL), T(D), U(LCTL),END ); + BABLM( BABL_BROWSER_DEV_TOOLS, D(LCTL), T(T), U(LCTL),END ); // Chrome + BABLM( BABL_BROWSER_RELOAD, D(LCTL), T(F5), U(LCTL),END ); // hard reload w/o cache + BABLM( BABL_BROWSER_FULLSCREEN, T(F11),END ); //command shift F + BABLM( BABL_BROWSER_ZOOM_IN, D(LCTL), T(PLUS), U(LCTL),END ); + BABLM( BABL_BROWSER_ZOOM_OUT, D(LCTL), T(MINS), U(LCTL),END ); +#endif #endif return MACRO_NONE; #endif #ifdef MAC_MODE + if ( BABL_MAC == shortcut) { return switch_babble_mode(MAC_MODE); } + case MAC_MODE: - BABLM( BABL_DEL_RIGHT_1C , D(DEL), END ); - BABLM( BABL_DEL_LEFT_WORD , D(LALT), T(BSPACE), U(LALT), END ); - BABLM( BABL_DEL_RIGHT_WORD, D(LALT), T(DEL), U(LALT), END ); BABLM( BABL_GO_LEFT_1C , T(LEFT), END ); BABLM( BABL_GO_RIGHT_1C, T(RIGHT), END ); BABLM( BABL_GO_LEFT_WORD , D(LALT), T(LEFT), U(LALT), END ); BABLM( BABL_GO_RIGHT_WORD , D(LALT), T(RIGHT), U(LALT), END ); BABLM( BABL_GO_START_LINE , D(LGUI), T(LEFT), U(LGUI), END ); - BABLM( BABL_GO_START_DOC , D(LGUI),T(UP), U(LGUI),END ); BABLM( BABL_GO_END_LINE , D(LGUI), T(RIGHT), U(LGUI), END ); + BABLM( BABL_GO_START_DOC , D(LGUI),T(UP), U(LGUI),END ); BABLM( BABL_GO_END_DOC , D(LGUI),T(DOWN), U(LGUI),END ); BABLM( BABL_GO_NEXT_LINE , T(DOWN), END ); BABLM( BABL_GO_PREV_LINE , T(UP), END ); BABLM( BABL_PGDN , D(LALT),T(DOWN), U(LALT), END ); BABLM( BABL_PGUP , D(LALT),T(UP), U(LALT), END ); + BABLM( BABL_DEL_RIGHT_1C , D(DEL), END ); + BABLM( BABL_DEL_LEFT_WORD , D(LALT), T(BSPACE), U(LALT), END ); + BABLM( BABL_DEL_RIGHT_WORD, D(LALT), T(DEL), U(LALT), END ); + BABLM( BABL_DEL_TO_LINE_END, D(LCTL), T(K), U(LCTL), END );// there must be another way + BABLM( BABL_DEL_TO_LINE_START, D(LGUI), T(BSPACE), U(LGUI), END ); #ifndef BABL_MOVEMENTONLY BABLM( BABL_UNDO , D(1), D(LGUI), T(Z), U(LGUI), END ); BABLM( BABL_REDO , D(LSFT),D(LGUI), T(Z), U(LSFT),U(LGUI), END ); @@ -158,75 +207,92 @@ But that requires even more clever preprocessor foo. BABLM( BABL_SWITCH_APP_LAST , D(LSFT),D(LGUI),T(TAB), U(LGUI), U(LSFT),END ); BABLM( BABL_CLOSE_APP , D(LGUI),T(Q), U(LGUI),END ); BABLM( BABL_HELP , D(LSFT),D(LGUI),T(SLASH), U(LGUI), U(LSFT),END ); + +#ifndef BABL_NOBROWSER + BABLM( BABL_BROWSER_NEW_TAB, D(LGUI), T(T), U(LGUI),END ); + BABLM( BABL_BROWSER_CLOSE_TAB, D(LGUI), T(W), U(LGUI),END ); + BABLM( BABL_BROWSER_REOPEN_LAST_TAB, D(LGUI), D(RSFT),T(T), U(RSFT),U(LGUI),END ); + BABLM( BABL_BROWSER_NEXT_TAB, D(LGUI),D(LALT), T(RIGHT),U(LALT), U(LGUI),END ); + BABLM( BABL_BROWSER_PREV_TAB, D(LGUI), D(RSFT), T(LEFT), U(RSFT), U(LGUI),END ); + BABLM( BABL_BROWSER_URL_BAR, D(LGUI), T(L), U(LGUI),END ); + BABLM( BABL_BROWSER_FORWARD, D(LGUI), T(RIGHT), U(LGUI),END ); + BABLM( BABL_BROWSER_BACK, D(LGUI), T(LEFT), U(LGUI),END ); + BABLM( BABL_BROWSER_FIND, D(LGUI), T(F), U(LGUI),END ); + BABLM( BABL_BROWSER_BOOKMARK, D(LGUI), T(D), U(LGUI),END ); + //BABLM( BABL_BROWSER_DEV_TOOLS, T(F12), U(LGUI),END ); // EDGE + BABLM( BABL_BROWSER_DEV_TOOLS, D(LGUI), D(LALT), T(I), U(LALT),U(LGUI),END ); // Chrome + // Chrome + BABLM( BABL_BROWSER_RELOAD, D(LGUI), T(R), U(LGUI),END ); // add shift for reload w/o cache + BABLM( BABL_BROWSER_FULLSCREEN, D(LGUI), D(LCTL), T(P), U(LCTL), U(LGUI),END ); //command shift F + BABLM( BABL_BROWSER_ZOOM_IN, D(LGUI), D(RSFT), T(EQL), U(RSFT), U(LGUI),END ); // ctr+ + + BABLM( BABL_BROWSER_ZOOM_OUT, D(LGUI), T(MINS), U(LGUI),END ); +#endif #endif return MACRO_NONE; #endif #ifdef EMACS_MODE + + if ( BABL_EMACS == shortcut ) { return switch_babble_mode(EMACS_MODE); } + case EMACS_MODE: switch(shortcut) { //probably should allow meta to not be ALT - - case BABL_DEL_RIGHT_1C: - BABLM( , D(LCTL), T(D), U(LCTL),END ); - case BABL_DEL_LEFT_WORD: - BABLM( , D(LCTL), T(BSPACE), U(LCTL), END ); - case BABL_DEL_RIGHT_WORD: - BABLM( , D(LALT), T(D), U(LALT), END ); - case BABL_GO_LEFT_1C: - BABLM( , T(LEFT), END ); - case BABL_GO_RIGHT_1C: - BABLM( , T(RIGHT), END ); - case BABL_GO_LEFT_WORD: - BABLM( , D(LALT), T(B), U(LALT), END ); - case BABL_GO_RIGHT_WORD: - BABLM( , D(LALT), T(F), U(LALT), END ); - case BABL_GO_START_LINE: - BABLM( , D(LCTRL), T(A), U(LCTRL), END ); - case BABL_GO_START_DOC: - BABLM( , D(LALT), D(LSFT), T(COMM),U(LSFT), U(LALT) ,END ); - case BABL_GO_END_LINE: - BABLM( , D(LCTRL), T(E), U(LCTRL), END ); - case BABL_GO_END_DOC: - BABLM( , D(LALT), D(LSFT), T(DOT),U(LSFT), U(LALT) ,END ); - case BABL_GO_NEXT_LINE: - BABLM( , D(LCTRL), T(N), U(LCTRL), END ); - case BABL_GO_PREV_LINE: - BABLM( , D(LCTRL), T(P), U(LCTRL), END ); - case BABL_PGDN: - BABLM( ,D(LCTRL), T(V), U(LCTRL), END ); - case BABL_PGUP: - BABLM( , D(LALT), T(V), U(LALT), END ); + + BABLM( BABL_GO_LEFT_1C, T(LEFT), END ); + BABLM( BABL_GO_RIGHT_1C, T(RIGHT), END ); + BABLM( BABL_GO_LEFT_WORD, D(LALT), T(B), U(LALT), END ); + BABLM( BABL_GO_RIGHT_WORD , D(LALT), T(F), U(LALT), END ); + BABLM( BABL_GO_START_LINE , D(LCTL), T(A), U(LCTL), END ); + BABLM( BABL_GO_END_LINE , D(LCTL), T(E), U(LCTL), END ); + BABLM( BABL_GO_START_DOC , D(LALT), D(LSFT), T(COMM),U(LSFT), U(LALT) ,END ); + BABLM( BABL_GO_END_DOC , D(LALT), D(LSFT), T(DOT), U(LSFT), U(LALT) ,END ); + BABLM( BABL_GO_NEXT_LINE , D(LCTL), T(N), U(LCTL), END ); + BABLM( BABL_GO_PREV_LINE , D(LCTL), T(P), U(LCTL), END ); + BABLM( BABL_PGDN , D(LCTL), T(V), U(LCTL), END ); + BABLM( BABL_PGUP , D(LALT), T(V), U(LALT), END ); + BABLM( BABL_DEL_RIGHT_1C, D(LCTL), T(D), U(LCTL),END ); + BABLM( BABL_DEL_LEFT_WORD , D(LCTL), T(BSPACE), U(LCTL), END ); + BABLM( BABL_DEL_RIGHT_WORD , D(LALT), T(D), U(LALT), END ); + BABLM( BABL_DEL_TO_LINE_END, D(LCTL), T(K), U(LCTL), END ); + BABLM( BABL_DEL_TO_LINE_START, T(ESC), T(0), D(LCTL), T(K), U(LCTL), END ); #ifndef BABL_MOVEMENTONLY - case BABL_UNDO: - BABLM( , D(LCTL), T(X), U(LCTL),T(C), END ); - case BABL_REDO: - BABLM( , D(LCTL), T(X), U(LCTL),T(C), END ); // arguably - case BABL_CUT: - BABLM( , D(LCTL), T(W), U(LCTL), END ); - case BABL_COPY: - BABLM( , D(LALT), T(W), U(LALT), END ); //really? - case BABL_PASTE: - BABLM( , D(LCTL), T(Y), U(LCTL), END ); - case BABL_SELECT_ALL: - BABLM( ,D(LCTL), T(X), U(LCTL),T(H), END ); - case BABL_FIND: - BABLM( , D(LCTRL), T(S), U(LCTRL),END ); - case BABL_FIND_NEXT: - BABLM( , D(LCTRL), T(S), U(LCTRL),END ); - case BABL_FIND_REPLACE: - BABLM( , D(LALT),D(LSFT), T(5),U(LSFT), U(LALT), END ); - case BABL_RUNAPP: - BABLM( , D(LALT), T(X), U(LALT),T(S),T(H),T(E),T(L),T(L),END );// arguably - case BABL_SWITCH_APP_NEXT: - BABLM( , D(LCTL), T(X), U(LCTL),T(RIGHT), END ); // arguably - case BABL_SWITCH_APP_LAST: - BABLM( , D(LCTL), T(X), U(LCTL),T(LEFT), END ); // arguably - case BABL_CLOSE_APP: - BABLM( ,D(LCTL), T(X), U(LCTL),T(C),END ); - case BABL_HELP: - BABLM( , D(LCTL),T(H), U(LCTL),T(A),END); // start search in help + BABLM( BABL_UNDO , D(LCTL), T(X), U(LCTL),T(C), END ); + BABLM( BABL_REDO , D(LCTL), T(X), U(LCTL),T(C), END ); // arguably + BABLM( BABL_CUT , D(LCTL), T(W), U(LCTL), END ); + BABLM( BABL_COPY , D(LALT), T(W), U(LALT), END ); //really? + BABLM( BABL_PASTE , D(LCTL), T(Y), U(LCTL), END ); + BABLM( BABL_SELECT_ALL ,D(LCTL), T(X), U(LCTL),T(H), END ); + BABLM( BABL_FIND , D(LCTL), T(S), U(LCTL),END ); + BABLM( BABL_FIND_NEXT , D(LCTL), T(S), U(LCTL),END ); + BABLM( BABL_FIND_REPLACE , D(LALT),D(LSFT), T(5),U(LSFT), U(LALT), END ); + BABLM( BABL_RUNAPP , D(LALT), T(X), U(LALT),T(S),T(H),T(E),T(L),T(L),END );// arguably + BABLM( BABL_SWITCH_APP_NEXT , D(LCTL), T(X), U(LCTL),T(RIGHT), END ); // arguably + BABLM( BABL_SWITCH_APP_LAST , D(LCTL), T(X), U(LCTL),T(LEFT), END ); // arguably + BABLM( BABL_CLOSE_APP , D(LCTL), T(X), U(LCTL),T(C),END ); + BABLM( BABL_HELP , D(LCTL),T(H), U(LCTL),T(A),END); // start search in help +#ifndef BABL_NOBROWSER +/* you get to figure w3 out + BABLM( BABL_BROWSER_NEW_TAB, D(LGUI), T(T), U(LGUI),END ); + BABLM( BABL_BROWSER_CLOSE_TAB, D(LGUI), T(W), U(LGUI),END ); + BABLM( BABL_BROWSER_REOPEN_LAST_TAB, D(LGUI), D(RSFT),T(T), U(RSFT),U(LGUI),END ); + BABLM( BABL_BROWSER_NEXT_TAB, D(LGUI),D(LALT), T(RIGHT),U(LALT), U(LGUI),END ); + BABLM( BABL_BROWSER_PREV_TAB, D(LGUI), D(RSFT), T(LEFT), U(RSFT), U(LGUI),END ); + BABLM( BABL_BROWSER_URL_BAR, D(LGUI), T(L), U(LGUI),END ); + BABLM( BABL_BROWSER_FORWARD, D(LGUI), T(RIGHT), U(LGUI),END ); + BABLM( BABL_BROWSER_BACK, D(LGUI), T(LEFT), U(LGUI),END ); + BABLM( BABL_BROWSER_FIND, D(LGUI), T(F), U(LGUI),END ); + BABLM( BABL_BROWSER_BOOKMARK, D(LGUI), T(D), U(LGUI),END ); + //BABLM( BABL_BROWSER_DEV_TOOLS, T(F12), U(LGUI),END ); // EDGE + BABLM( BABL_BROWSER_DEV_TOOLS, D(LGUI), D(LALT), T(I), U(LALT),U(LGUI),END ); // Chrome + // Chrome + BABLM( BABL_BROWSER_RELOAD, D(LGUI), T(R), U(LGUI),END ); // add shift for reload w/o cache + BABLM( BABL_BROWSER_FULLSCREEN, D(LGUI), D(LCTL), T(P), U(LCTL), U(LGUI),END ); //command shift F + BABLM( BABL_BROWSER_ZOOM_IN, D(LGUI), D(RSFT), T(EQL), U(RSFT), U(LGUI),END ); // ctr+ + + BABLM( BABL_BROWSER_ZOOM_OUT, D(LGUI), T(MINS), U(LGUI),END ); +*/ +#endif #endif break; @@ -234,25 +300,31 @@ But that requires even more clever preprocessor foo. } #endif + + #ifdef VI_MODE + if ( BABL_VI == shortcut ) { return switch_babble_mode(VI_MODE); } case VI_MODE: -//assume esc is already called +// you have to track the modes yourself. Otherwise motion is awful (bell, bell, bell) + - BABLM( BABL_DEL_RIGHT_1C , T(X),END ); - BABLM( BABL_DEL_LEFT_WORD , T(D),T(G),T(E),END ); - BABLM( BABL_DEL_RIGHT_WORD , T(D),T(W),END ); BABLM( BABL_GO_LEFT_1C , T(H), END ); BABLM( BABL_GO_RIGHT_1C , T(L), END ); BABLM( BABL_GO_LEFT_WORD , T(B),END ); BABLM( BABL_GO_RIGHT_WORD , T(W), END ); BABLM( BABL_GO_START_LINE , D(LSFT), T(6),U(LSFT), END ); //^ - BABLM( BABL_GO_START_DOC , T(G),T(G) ,END ); BABLM( BABL_GO_END_LINE , D(LSFT), T(4),U(LSFT) , END ); //$ + BABLM( BABL_GO_START_DOC , T(G),T(G) ,END ); BABLM( BABL_GO_END_DOC , D(LSFT), T(G),U(LSFT),END ); BABLM( BABL_GO_NEXT_LINE , T(J), END ); BABLM( BABL_GO_PREV_LINE, T(K), END ); - BABLM( BABL_PGDN ,D(LCTRL), T(F), U(LCTRL), END ); - BABLM( BABL_PGUP , D(LCTRL), T(B), U(LCTRL), END ); + BABLM( BABL_PGDN ,D(LCTL), T(F), U(LCTL), END ); + BABLM( BABL_PGUP , D(LCTL), T(B), U(LCTL), END ); + BABLM( BABL_DEL_RIGHT_1C , T(X),END ); + BABLM( BABL_DEL_LEFT_WORD , T(D),T(G),T(E),END ); + BABLM( BABL_DEL_RIGHT_WORD , T(D),T(W),END ); + BABLM( BABL_DEL_TO_LINE_END, T(D),D(LSFT), T(4),U(LSFT) ,END ); // d$ + BABLM( BABL_DEL_TO_LINE_START, T(D),D(LSFT), T(6),U(LSFT) ,END ); #ifndef BABL_MOVEMENTONLY BABLM( BABL_UNDO , T(U), END ); BABLM( BABL_REDO , D(LCTL), T(R), U(LCTL), END ); @@ -268,6 +340,27 @@ But that requires even more clever preprocessor foo. BABLM( BABL_SWITCH_APP_LAST ,END ); BABLM(BABL_CLOSE_APP, D(LSFT), T(SCLN),U(LSFT), T(Q), D(RSFT), T(1),U(RSFT), END ); BABLM(BABL_HELP, D(LSFT), T(SCLN),U(LSFT),T(H),END); // start search in help +#ifndef BABL_NOBROWSER +/* you get to figure this out + BABLM( BABL_BROWSER_NEW_TAB, D(LGUI), T(T), U(LGUI),END ); + BABLM( BABL_BROWSER_CLOSE_TAB, D(LGUI), T(W), U(LGUI),END ); + BABLM( BABL_BROWSER_REOPEN_LAST_TAB, D(LGUI), D(RSFT),T(T), U(RSFT),U(LGUI),END ); + BABLM( BABL_BROWSER_NEXT_TAB, D(LGUI),D(LALT), T(RIGHT),U(LALT), U(LGUI),END ); + BABLM( BABL_BROWSER_PREV_TAB, D(LGUI), D(RSFT), T(LEFT), U(RSFT), U(LGUI),END ); + BABLM( BABL_BROWSER_URL_BAR, D(LGUI), T(L), U(LGUI),END ); + BABLM( BABL_BROWSER_FORWARD, D(LGUI), T(RIGHT), U(LGUI),END ); + BABLM( BABL_BROWSER_BACK, D(LGUI), T(LEFT), U(LGUI),END ); + BABLM( BABL_BROWSER_FIND, D(LGUI), T(F), U(LGUI),END ); + BABLM( BABL_BROWSER_BOOKMARK, D(LGUI), T(D), U(LGUI),END ); + //BABLM( BABL_BROWSER_DEV_TOOLS, T(F12), U(LGUI),END ); // EDGE + BABLM( BABL_BROWSER_DEV_TOOLS, D(LGUI), D(LALT), T(I), U(LALT),U(LGUI),END ); // Chrome + // Chrome + BABLM( BABL_BROWSER_RELOAD, D(LGUI), T(R), U(LGUI),END ); // add shift for reload w/o cache + BABLM( BABL_BROWSER_FULLSCREEN, D(LGUI), D(LCTL), T(P), U(LCTL), U(LGUI),END ); //command shift F + BABLM( BABL_BROWSER_ZOOM_IN, D(LGUI), T(PLUS), U(LGUI),END ); + BABLM( BABL_BROWSER_ZOOM_OUT, D(LGUI), T(MINS), U(LGUI),END ); +*/ +#endif #endif return MACRO_NONE; #endif @@ -278,37 +371,62 @@ But that requires even more clever preprocessor foo. #ifdef READMUX_MODE // Readline command line editing + tmux windowing // I havent decided how much to do readline and how much tmux + if ( BABL_READLINE == shortcut ) { switch_babble_mode(READMUX_MODE); return MACRO_NONE; } case READMUX_MODE: - BABLM( BABL_DEL_RIGHT_1C , D(LCTL), T(D), U(LCTL),END ); + + BABLM( BABL_GO_LEFT_1C , T(LEFT), END ); + BABLM( BABL_GO_RIGHT_1C , T(RIGHT), END ); + BABLM( BABL_GO_LEFT_WORD , D(LALT), T(B), U(LALT), END ); + BABLM( BABL_GO_RIGHT_WORD , D(LALT), T(F), U(LALT), END ); + BABLM( BABL_GO_START_LINE , D(LCTL), T(A), U(LCTL), END ); + BABLM( BABL_GO_END_LINE , D(LCTL), T(E), U(LCTL), END ); + //BABLM( BABL_GO_START_DOC ,END );// tmux? + //BABLM( BABL_GO_END_DOC ,END ); // tmux? + BABLM( BABL_GO_NEXT_LINE , D(LCTL), T(N), U(LCTL), END ); + BABLM( BABL_GO_PREV_LINE , D(LCTL), T(P), U(LCTL), END ); + BABLM( BABL_PGDN , T(PGDN), END ); + BABLM( BABL_PGUP , T(PGUP), END ); + BABLM( BABL_DEL_RIGHT_1C , D(LCTL), T(D), U(LCTL),END ); BABLM( BABL_DEL_LEFT_WORD , D(LCTL), T(W), U(LCTL), END ); - BABLM( BABL_DEL_RIGHT_WORD , D(LALT), T(D), U(LALT), END ); - BABLM( BABL_GO_LEFT_1C , T(LEFT), END ); - BABLM( BABL_GO_RIGHT_1C , T(RIGHT), END ); - BABLM( BABL_GO_LEFT_WORD , D(LALT), T(B), U(LALT), END ); - BABLM( BABL_GO_RIGHT_WORD , D(LALT), T(F), U(LALT), END ); - BABLM( BABL_GO_START_LINE , D(LCTRL), T(A), U(LCTRL), END ); - BABLM( BABL_GO_START_DOC ,END );// tmux? - BABLM( BABL_GO_END_LINE , D(LCTRL), T(E), U(LCTRL), END ); - BABLM( BABL_GO_END_DOC ,END ); // tmux? - BABLM( BABL_GO_NEXT_LINE , D(LCTRL), T(N), U(LCTRL), END ); - BABLM( BABL_GO_PREV_LINE , D(LCTRL), T(P), U(LCTRL), END ); - BABLM( BABL_PGDN , T(PGDN), END ); - BABLM( BABL_PGUP , T(PGUP), END ); + BABLM( BABL_DEL_RIGHT_WORD , D(LALT), T(D), U(LALT), END ); + BABLM( BABL_DEL_TO_LINE_END, D(LCTL), T(K), U(LCTL), END ); + BABLM( BABL_DEL_TO_LINE_START, D(LCTL), T(U), U(LCTL), END ); #ifndef BABL_MOVEMENTONLY - BABLM( BABL_UNDO , D(LALT), T(R), U(LALT) , END ); - BABLM( BABL_REDO , D(LCTL), T(X), U(LCTL),T(C), END ); // arguably - BABLM( BABL_CUT , D(LCTL), T(K), U(LCTL), END ); // wrong half the time - BABLM( BABL_COPY ,END ); - BABLM( BABL_PASTE , D(LCTL), T(Y), U(LCTL), END ); - BABLM( BABL_SELECT_ALL ,D(LCTL), T(A), T(K), T(Y), U(LCTL) , END ); - BABLM( BABL_FIND , D(LCTRL), T(R), U(LCTRL), END ); // search history - BABLM(BABL_FIND_NEXT, D(LCTRL), T(S), U(LCTRL), END ); - BABLM( BABL_FIND_REPLACE ,END ); - BABLM( BABL_RUNAPP , D(LCTRL), T(B), U(LCTRL), T(C),END ); //tmux - BABLM( BABL_SWITCH_APP_NEXT , D(LCTRL), T(B), U(LCTRL), T(N),END ); //tmux - BABLM( BABL_SWITCH_APP_LAST , D(LCTRL), T(B), U(LCTRL), T(P),END ); //tmux - BABLM( BABL_CLOSE_APP , D(LCTRL), T(B), U(LCTRL), T(D),END); // usually what I want - BABLM( BABL_HELP ,END ); + BABLM( BABL_UNDO , D(LALT), T(R), U(LALT) , END ); + BABLM( BABL_REDO , D(LCTL), T(X), U(LCTL),T(C), END ); // arguably + BABLM( BABL_CUT , D(LCTL), T(K), U(LCTL), END ); // wrong half the time + //BABLM( BABL_COPY ,END ); + BABLM( BABL_PASTE , D(LCTL), T(Y), U(LCTL), END ); + BABLM( BABL_SELECT_ALL , D(LCTL), T(A), T(K), T(Y), U(LCTL) , END ); + BABLM( BABL_FIND , D(LCTL), T(R), U(LCTL), END ); // search history + BABLM(BABL_FIND_NEXT, D(LCTL), T(S), U(LCTL), END ); + //BABLM( BABL_FIND_REPLACE ,END ); + BABLM( BABL_RUNAPP , D(LCTL), T(B), U(LCTL), T(C),END ); //tmux + BABLM( BABL_SWITCH_APP_NEXT , D(LCTL), T(B), U(LCTL), T(N),END ); //tmux + BABLM( BABL_SWITCH_APP_LAST , D(LCTL), T(B), U(LCTL), T(P),END ); //tmux + BABLM( BABL_CLOSE_APP , D(LCTL), T(B), U(LCTL), T(D),END); // usually what I want + // BABLM( BABL_HELP ,END ); +#ifndef BABL_NOBROWSER +/* Add lynx shortcuts? + BABLM( BABL_BROWSER_NEW_TAB, D(LGUI), T(T), U(LGUI),END ); + BABLM( BABL_BROWSER_CLOSE_TAB, D(LGUI), T(W), U(LGUI),END ); + BABLM( BABL_BROWSER_REOPEN_LAST_TAB, D(LGUI), D(RSFT),T(T), U(RSFT),U(LGUI),END ); + BABLM( BABL_BROWSER_NEXT_TAB, D(LGUI),D(LALT), T(RIGHT),U(LALT), U(LGUI),END ); + BABLM( BABL_BROWSER_PREV_TAB, D(LGUI), D(RSFT), T(LEFT), U(RSFT), U(LGUI),END ); + BABLM( BABL_BROWSER_URL_BAR, D(LGUI), T(L), U(LGUI),END ); + BABLM( BABL_BROWSER_FORWARD, D(LGUI), T(RIGHT), U(LGUI),END ); + BABLM( BABL_BROWSER_BACK, D(LGUI), T(LEFT), U(LGUI),END ); + BABLM( BABL_BROWSER_FIND, D(LGUI), T(F), U(LGUI),END ); + BABLM( BABL_BROWSER_BOOKMARK, D(LGUI), T(D), U(LGUI),END ); + //BABLM( BABL_BROWSER_DEV_TOOLS, T(F12), U(LGUI),END ); // EDGE + BABLM( BABL_BROWSER_DEV_TOOLS, D(LGUI), D(LALT), T(I), U(LALT),U(LGUI),END ); // Chrome + // Chrome + BABLM( BABL_BROWSER_RELOAD, D(LGUI), T(R), U(LGUI),END ); // add shift for reload w/o cache + BABLM( BABL_BROWSER_FULLSCREEN, D(LGUI), D(LCTL), T(P), U(LCTL), U(LGUI),END ); //command shift F + BABLM( BABL_BROWSER_ZOOM_IN, D(LGUI), T(PLUS), U(LGUI),END ); + BABLM( BABL_BROWSER_ZOOM_OUT, D(LGUI), T(MINS), U(LGUI),END ); +*/ +#endif #endif return MACRO_NONE; -- cgit v1.2.3 From 89aba30c7f50aa733262f4add253817e2fb84e8a Mon Sep 17 00:00:00 2001 From: milestogo Date: Wed, 8 Mar 2017 01:25:33 -0800 Subject: fix stupid error w/ mode switch --- keyboards/handwired/MS-sculpt-mobile/babblePaste.c | 38 +++++++++++++++------- 1 file changed, 27 insertions(+), 11 deletions(-) (limited to 'keyboards/handwired/MS-sculpt-mobile/babblePaste.c') diff --git a/keyboards/handwired/MS-sculpt-mobile/babblePaste.c b/keyboards/handwired/MS-sculpt-mobile/babblePaste.c index 491a79333e..3a9b86997d 100644 --- a/keyboards/handwired/MS-sculpt-mobile/babblePaste.c +++ b/keyboards/handwired/MS-sculpt-mobile/babblePaste.c @@ -19,7 +19,7 @@ uint8_t babble_mode =0 ; macro_t* switch_babble_mode( uint8_t id) { babble_mode= id; - return MACRO_NONE; //less typing above + return MACRO_NONE; //less typing where called } @@ -42,12 +42,32 @@ const macro_t *babblePaste (keyrecord_t *record, uint8_t shortcut) { return MACRO_NONE; } */ - switch(babble_mode) { - - + + +#ifdef MS_MODE + if ( BABL_WINDOWS == shortcut ) { return switch_babble_mode(MS_MODE); } +#endif +#ifdef MAC_MODE + if ( BABL_MAC == shortcut) { return switch_babble_mode(MAC_MODE); } +#endif +#ifdef LINUX_MODE + if ( BABL_LINUX == shortcut ) { return switch_babble_mode(LINUX_MODE); } +#endif + #ifdef READMUX_MODE + if ( BABL_READLINE == shortcut ) { switch_babble_mode(READMUX_MODE); return MACRO_NONE; } +#endif +#ifdef VI_MODE + if ( BABL_VI == shortcut ) { return switch_babble_mode(VI_MODE); } +#endif +#ifdef EMACS_MODE + if ( BABL_EMACS == shortcut ) { return switch_babble_mode(EMACS_MODE); } +#endif + + + + switch(babble_mode) { #ifdef MS_MODE - if ( BABL_WINDOWS == shortcut ) { return switch_babble_mode(MS_MODE); } case MS_MODE: BABLM( BABL_GO_LEFT_1C, T(LEFT), END ); @@ -111,7 +131,6 @@ const macro_t *babblePaste (keyrecord_t *record, uint8_t shortcut) { #ifdef LINUX_MODE - if ( BABL_LINUX == shortcut ) { return switch_babble_mode(LINUX_MODE); } case LINUX_MODE: BABLM( BABL_GO_LEFT_1C , T(LEFT), END ); @@ -172,7 +191,6 @@ const macro_t *babblePaste (keyrecord_t *record, uint8_t shortcut) { #endif #ifdef MAC_MODE - if ( BABL_MAC == shortcut) { return switch_babble_mode(MAC_MODE); } case MAC_MODE: BABLM( BABL_GO_LEFT_1C , T(LEFT), END ); @@ -234,8 +252,6 @@ const macro_t *babblePaste (keyrecord_t *record, uint8_t shortcut) { #ifdef EMACS_MODE - if ( BABL_EMACS == shortcut ) { return switch_babble_mode(EMACS_MODE); } - case EMACS_MODE: switch(shortcut) { //probably should allow meta to not be ALT @@ -303,7 +319,6 @@ const macro_t *babblePaste (keyrecord_t *record, uint8_t shortcut) { #ifdef VI_MODE - if ( BABL_VI == shortcut ) { return switch_babble_mode(VI_MODE); } case VI_MODE: // you have to track the modes yourself. Otherwise motion is awful (bell, bell, bell) @@ -371,7 +386,8 @@ const macro_t *babblePaste (keyrecord_t *record, uint8_t shortcut) { #ifdef READMUX_MODE // Readline command line editing + tmux windowing // I havent decided how much to do readline and how much tmux - if ( BABL_READLINE == shortcut ) { switch_babble_mode(READMUX_MODE); return MACRO_NONE; } + + case READMUX_MODE: BABLM( BABL_GO_LEFT_1C , T(LEFT), END ); -- cgit v1.2.3