qmk

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.z3bra.org/qmk.git
Log | Files | Refs | Submodules | LICENSE

babblePaste.c (21310B)


      1 /*  A library to output the right key shortcut in any common app.
      2 Given a global variable babble_mode to show the environment and a
      3 key that calls the paste macro, do the right type of paste.
      4 Setting the context is done by another macro, or TBD interaction with the host.
      5 
      6 Huge thanks to https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts
      7 and https://github.com/qmk/qmk_firmware/blob/master/keyboards/planck/keymaps/jeebak/keymap.c
      8 */
      9 
     10 #include "babblePaste.h"
     11 
     12 #include "action_macro.h"
     13 
     14 #ifdef USE_BABLPASTE
     15 
     16 // GLOBAL variable to determine mode.  Sets startup default if no eeppom
     17 uint8_t babble_mode =0 ;
     18 
     19 // small function that we might also want to call from a keymap.
     20 
     21 macro_t* switch_babble_mode( uint8_t id) {
     22  babble_mode= id;
     23  return MACRO_NONE; //less typing where called
     24 }
     25 
     26 
     27 // Today I learned that the preprocessor can not create a switch statement label from an argument
     28 // And else statements have problems, see https://gcc.gnu.org/onlinedocs/gcc-3.0.1/cpp_3.html#SEC15
     29 #define BABLM(ent, macro...) \
     30 	if ( ent == shortcut ) \
     31 		 {  action_macro_play( MACRO(macro)); return MACRO_NONE; }
     32 
     33 
     34 /* this function runs the appropriate babblepaste macro, given
     35 the global babble_mode, and a shortcut from the ENUM in babblePaste.h
     36 TODO, the pointers in this function should be stored in a PROGMEM array, not ram.
     37 But that requires even more clever preprocessor foo.
     38 */
     39 const  macro_t *babblePaste (keyrecord_t *record,  uint8_t shortcut) {
     40 /*
     41 	 if ( shortcut < BABL_START_NUM || \
     42 			 shortcut >= (BABL_START_NUM + BABL_NUM_MACROS ) ) {
     43 			return MACRO_NONE;
     44 		}
     45 */
     46 
     47 
     48 #ifdef MS_MODE
     49 	if ( BABL_WINDOWS  == shortcut ) { return switch_babble_mode(MS_MODE);  }
     50 #endif
     51 #ifdef MAC_MODE
     52 	if ( BABL_MAC == shortcut) { return switch_babble_mode(MAC_MODE);  }
     53 #endif
     54 #ifdef LINUX_MODE
     55 	if ( BABL_LINUX == shortcut ) { return switch_babble_mode(LINUX_MODE);  }
     56 #endif
     57  #ifdef READMUX_MODE
     58 	if ( BABL_READLINE == shortcut  ) { switch_babble_mode(READMUX_MODE); return MACRO_NONE; }
     59 #endif
     60 #ifdef VI_MODE
     61 	if ( BABL_VI == shortcut  ) { return switch_babble_mode(VI_MODE);   }
     62 #endif
     63 #ifdef EMACS_MODE
     64 	if ( BABL_EMACS == shortcut  ) { return switch_babble_mode(EMACS_MODE);   }
     65 #endif
     66 
     67 
     68 
     69     switch(babble_mode) {
     70 
     71 #ifdef MS_MODE
     72 
     73 	 case MS_MODE:
     74 		BABLM( BABL_GO_LEFT_1C,	T(LEFT), END );
     75 		BABLM( BABL_GO_RIGHT_1C ,	T(RIGHT), END );
     76 		BABLM( BABL_GO_LEFT_WORD,	D(LCTL), T(LEFT), U(LCTL), END );
     77 		BABLM( BABL_GO_RIGHT_WORD, D(LCTL), T(RIGHT), U(LCTL), END );
     78 		BABLM( BABL_GO_START_LINE,	T(HOME), END );
     79 		BABLM( BABL_GO_END_LINE,	T(END), END );
     80 		BABLM( BABL_GO_START_DOC,	D(LCTL),T(HOME),  U(LCTL),END );
     81 		BABLM( BABL_GO_END_DOC,	D(LCTL),T(END),  U(LCTL),END );
     82 		BABLM( BABL_GO_NEXT_LINE,	T(DOWN), END );
     83 		BABLM( BABL_GO_PREV_LINE,	T(UP), END );
     84 		BABLM( BABL_PGDN,			T(PGDN), END );
     85 		BABLM( BABL_PGUP,			T(PGUP), END );
     86 		BABLM( BABL_DEL_RIGHT_1C,	T(DEL), END );
     87 		BABLM( BABL_DEL_LEFT_WORD,	D(LCTL), T(BSPACE), U(LCTL), END );
     88 		BABLM( BABL_DEL_RIGHT_WORD,		D(LCTL), T(DEL), U(LCTL), END );
     89 		BABLM( BABL_DEL_TO_LINE_END,	D(RSFT), T(HOME), U(RSFT), T(DEL),  END);
     90 		BABLM( BABL_DEL_TO_LINE_START,	D(RSFT), T(END), U(RSFT), T(DEL),  END );
     91 #ifndef BABL_MOVEMENTONLY
     92 		BABLM( BABL_UNDO, 		D(LCTL), T(Z), U(LCTL), END );
     93 		BABLM( BABL_REDO, 		D(LCTL), T(Y), U(LCTL), END );
     94 		BABLM( BABL_CUT, 		D(LCTL), T(X), U(LCTL), END );
     95 		BABLM( BABL_COPY, 		D(LCTL), T(C), U(LCTL), END );
     96 		BABLM( BABL_PASTE, 		D(LCTL), T(V), U(LCTL), END );
     97 		BABLM( BABL_SELECT_ALL, D(LCTL), T(A), U(LCTL), END );
     98 		BABLM( BABL_FIND, 		D(LCTL),T(F),  U(LCTL),END );
     99 		BABLM( BABL_FIND_NEXT, 			T(F3),END );
    100 		BABLM( BABL_FIND_REPLACE,		D(LCTL),T(H),  U(LCTL),END );
    101 		BABLM( BABL_RUNAPP, 	D(LGUI),T(R),  U(LGUI),END );
    102 		BABLM( BABL_SWITCH_APP_NEXT, D(LALT),T(TAB), U(LALT),END );
    103 		BABLM( BABL_SWITCH_APP_LAST, D(LSFT),D(LALT),T(TAB), U(LALT), U(LSFT),END );
    104 		BABLM( BABL_CLOSE_APP, 	D(LALT),T(F4), U(LALT),END );
    105 		BABLM( BABL_HELP,		T(F1),END );
    106 #ifndef BABL_NOBROWSER
    107 		BABLM( BABL_BROWSER_NEW_TAB,		D(LCTL), T(T), U(LCTL),END );
    108 		BABLM( BABL_BROWSER_CLOSE_TAB,		D(LCTL), T(W), U(LCTL),END );
    109 		BABLM( BABL_BROWSER_REOPEN_LAST_TAB,		D(LCTL), D(RSFT),T(T), U(RSFT),U(LCTL),END );
    110 		BABLM( BABL_BROWSER_NEXT_TAB,		D(LCTL), T(TAB), U(LCTL),END );
    111 		BABLM( BABL_BROWSER_PREV_TAB,		D(LCTL), D(RSFT), T(TAB), U(RSFT), U(LCTL),END );
    112 		BABLM( BABL_BROWSER_URL_BAR,		D(LCTL), T(L), U(LCTL),END );
    113 		BABLM( BABL_BROWSER_FORWARD,		D(LALT), T(RIGHT), U(LALT),END );
    114 		BABLM( BABL_BROWSER_BACK,			D(LALT), T(LEFT), U(LALT),END );
    115 		BABLM( BABL_BROWSER_FIND,			D(LCTL), T(F), U(LCTL),END );
    116 		BABLM( BABL_BROWSER_BOOKMARK,		D(LCTL), T(D), U(LCTL),END );
    117 		//BABLM( BABL_BROWSER_DEV_TOOLS,	T(F12), U(LCTL),END  ); // EDGE
    118 		BABLM( BABL_BROWSER_DEV_TOOLS,		D(LCTL), T(T), U(LCTL),END  ); // Chrome
    119 		// Chrome
    120 		BABLM( BABL_BROWSER_RELOAD,			D(LCTL), T(F5), U(LCTL),END ); // hard reload w/o cache
    121 		BABLM( BABL_BROWSER_FULLSCREEN,		T(F11),END ); //command shift F
    122 		BABLM( BABL_BROWSER_ZOOM_IN,		D(LCTL), D(RSFT), T(EQL), U(RSFT), U(LCTL),END ); // ctr+ +
    123 		BABLM( BABL_BROWSER_ZOOM_OUT,		D(LCTL), T(MINS), U(LCTL),END );
    124 #endif
    125 #endif
    126 
    127 		// Todo, ring bell, flash light, show user this isn't supported
    128 		return MACRO_NONE;
    129 
    130 
    131 #endif /* MS_MODE*/
    132 
    133 
    134 #ifdef LINUX_MODE
    135 
    136 	 case LINUX_MODE:
    137 		BABLM( BABL_GO_LEFT_1C  , 	T(LEFT), END );
    138 		BABLM( BABL_GO_RIGHT_1C  , 	T(RIGHT), END );
    139 		BABLM( BABL_GO_LEFT_WORD  , 	D(LCTL), T(LEFT), U(LCTL), END );
    140 		BABLM( BABL_GO_RIGHT_WORD  , D(LCTL), T(RIGHT), U(LCTL), END );
    141 		BABLM( BABL_GO_START_LINE , 	T(HOME), END );
    142 		BABLM( BABL_GO_END_LINE  ,	T(END), END );
    143 		BABLM( BABL_GO_START_DOC  , 	D(LCTL),T(HOME),  U(LCTL),END );
    144 		BABLM( BABL_GO_END_DOC  , 	D(LCTL),T(END),  U(LCTL),END );
    145 		BABLM( BABL_GO_NEXT_LINE  , 	T(DOWN), END );
    146 		BABLM( BABL_GO_PREV_LINE  , 	T(UP), END );
    147 		BABLM( BABL_PGDN  , 			T(PGDN), END );
    148 		BABLM( BABL_PGUP  , 			T(PGUP), END );
    149 		BABLM( BABL_DEL_RIGHT_1C  , 	D(DEL), END );
    150 		BABLM( BABL_DEL_LEFT_WORD  ,	D(LCTL), T(BSPACE), U(LCTL), END );
    151 		BABLM( BABL_DEL_RIGHT_WORD  , D(LCTL), T(DEL), U(LCTL), END );
    152 		BABLM( BABL_DEL_TO_LINE_END,	D(RSFT), T(HOME), U(RSFT), T(DEL),  END);
    153 		BABLM( BABL_DEL_TO_LINE_START,	D(RSFT), T(END), U(RSFT), T(DEL),  END );
    154 #ifndef BABL_MOVEMENTONLY
    155 		BABLM( BABL_UNDO  , 	D(LCTL), T(Z), U(LCTL), END );
    156 		BABLM( BABL_REDO  , 	D(LCTL), T(Y), U(LCTL), END );
    157 		BABLM( BABL_CUT  , 	D(LCTL), T(X), U(LCTL), END );
    158 		BABLM( BABL_COPY  , 	D(LCTL), T(C), U(LCTL), END );
    159 		BABLM( BABL_PASTE  ,	D(LCTL), T(V), U(LCTL), END );
    160 		BABLM( BABL_SELECT_ALL, D(LCTL), T(A), U(LCTL), END );
    161 		BABLM( BABL_FIND,	D(LCTL),T(F),  U(LCTL),END );
    162 		/* BABLM(BABL_FIND_NEXT  , T(F3),END ); KDE */
    163 		BABLM( BABL_FIND_NEXT,	D(LCTL),T(G),  U(LCTL),END ); // Gnome*/
    164 		/* BABLM(  , D(LCTL),T(R),  U(LCTL),END ); KDE */
    165 		BABLM( BABL_FIND_REPLACE,	D(LCTL),T(H),  U(LCTL),END ); // Gnome*/
    166 		BABLM( BABL_RUNAPP,			D(LALT),T(F2),  U(LALT),END );
    167 		BABLM( BABL_SWITCH_APP_NEXT,	D(LCTL),T(TAB), U(LCTL),END );
    168 		BABLM( BABL_SWITCH_APP_LAST,	D(LSFT),D(LCTL),T(TAB), U(LCTL), U(LSFT),END );
    169 		BABLM( BABL_CLOSE_APP,	D(LALT),T(F4), U(LALT),END );
    170 		//BABLM( BABL_HELP, 		END );
    171 
    172 #ifndef BABL_NOBROWSER
    173 		BABLM( BABL_BROWSER_NEW_TAB,		D(LCTL), T(T), U(LCTL),END );
    174 		BABLM( BABL_BROWSER_CLOSE_TAB,		D(LCTL), T(W), U(LCTL),END );
    175 		BABLM( BABL_BROWSER_REOPEN_LAST_TAB,		D(LCTL), D(RSFT),T(T), U(RSFT),U(LCTL),END );
    176 		BABLM( BABL_BROWSER_NEXT_TAB,		D(LCTL), T(TAB), U(LCTL),END );
    177 		BABLM( BABL_BROWSER_PREV_TAB,		D(LCTL), D(RSFT), T(TAB), U(RSFT), U(LCTL),END );
    178 		BABLM( BABL_BROWSER_URL_BAR,		D(LCTL), T(L), U(LCTL),END );
    179 		BABLM( BABL_BROWSER_FORWARD,		D(LALT), T(RIGHT), U(LALT),END );
    180 		BABLM( BABL_BROWSER_BACK,			D(LALT), T(LEFT), U(LALT),END );
    181 		BABLM( BABL_BROWSER_FIND,			D(LCTL), T(F), U(LCTL),END );
    182 		BABLM( BABL_BROWSER_BOOKMARK,		D(LCTL), T(D), U(LCTL),END );
    183 		BABLM( BABL_BROWSER_DEV_TOOLS,		D(LCTL), T(T), U(LCTL),END  ); // Chrome
    184 		BABLM( BABL_BROWSER_RELOAD,			D(LCTL), T(F5), U(LCTL),END ); // hard reload w/o cache
    185 		BABLM( BABL_BROWSER_FULLSCREEN,		T(F11),END ); //command shift F
    186 		BABLM( BABL_BROWSER_ZOOM_IN,		D(LCTL), T(PLUS), U(LCTL),END );
    187 		BABLM( BABL_BROWSER_ZOOM_OUT,		D(LCTL), T(MINS), U(LCTL),END );
    188 #endif
    189 #endif
    190 	 return MACRO_NONE;
    191 
    192 #endif
    193 
    194 #ifdef MAC_MODE
    195 
    196 	 case MAC_MODE:
    197 		BABLM( BABL_GO_LEFT_1C ,	T(LEFT), END );
    198 		BABLM( BABL_GO_RIGHT_1C,	T(RIGHT), END );
    199 		BABLM( BABL_GO_LEFT_WORD ,	D(LALT), T(LEFT), U(LALT), END );
    200 		BABLM( BABL_GO_RIGHT_WORD ,	D(LALT), T(RIGHT), U(LALT), END );
    201 		BABLM( BABL_GO_START_LINE ,	D(LGUI), T(LEFT), U(LGUI),  END );
    202 		BABLM( BABL_GO_END_LINE ,	D(LGUI), T(RIGHT), U(LGUI), END );
    203 		BABLM( BABL_GO_START_DOC ,	D(LGUI),T(UP),  U(LGUI),END );
    204 		BABLM( BABL_GO_END_DOC ,	D(LGUI),T(DOWN),  U(LGUI),END );
    205 		BABLM( BABL_GO_NEXT_LINE ,	T(DOWN), END );
    206 		BABLM( BABL_GO_PREV_LINE ,	T(UP), END );
    207 		BABLM( BABL_PGDN ,		D(LALT),T(DOWN), U(LALT), END );
    208 		BABLM( BABL_PGUP ,  	D(LALT),T(UP), U(LALT), END );
    209 		BABLM( BABL_DEL_RIGHT_1C ,	D(DEL), END );
    210 		BABLM( BABL_DEL_LEFT_WORD ,	D(LALT), T(BSPACE), U(LALT), END );
    211 		BABLM( BABL_DEL_RIGHT_WORD,	D(LALT), T(DEL), U(LALT), END );
    212 		BABLM( BABL_DEL_TO_LINE_END,	D(LCTL), T(K), U(LCTL), END );// there must be another way
    213 		BABLM( BABL_DEL_TO_LINE_START,	D(LGUI), T(BSPACE), U(LGUI),   END );
    214 #ifndef BABL_MOVEMENTONLY
    215 		BABLM( BABL_UNDO , 		D(1), D(LGUI), T(Z), U(LGUI), END );
    216 		BABLM( BABL_REDO , 		D(LSFT),D(LGUI), T(Z), U(LSFT),U(LGUI), END );
    217 		BABLM( BABL_CUT ,		D(LGUI), T(X), U(LGUI), END );
    218 		BABLM( BABL_COPY ,		D(LGUI), T(C), U(LGUI), END );
    219 		BABLM( BABL_PASTE ,		D(LGUI), T(V), U(LGUI), END );
    220 		BABLM( BABL_SELECT_ALL ,	D(LGUI), T(A), U(LGUI), END );
    221 		BABLM( BABL_FIND ,			D(LGUI),T(F),  U(LGUI),END );
    222 		BABLM( BABL_FIND_NEXT, 		D(LGUI),T(G),  U(LGUI),END );
    223 		BABLM( BABL_FIND_REPLACE,	D(LGUI),T(F),  U(LGUI),END );
    224 		BABLM( BABL_RUNAPP ,		D(LGUI),T(R), U(LGUI),END );
    225 		BABLM( BABL_SWITCH_APP_NEXT ,	D(LGUI),T(TAB), U(LGUI),END );
    226 		BABLM( BABL_SWITCH_APP_LAST ,	D(LSFT),D(LGUI),T(TAB), U(LGUI), U(LSFT),END );
    227 		BABLM( BABL_CLOSE_APP ,			D(LGUI),T(Q),  U(LGUI),END );
    228 		BABLM( BABL_HELP ,				D(LSFT),D(LGUI),T(SLASH), U(LGUI), U(LSFT),END );
    229 
    230 #ifndef BABL_NOBROWSER
    231 		BABLM( BABL_BROWSER_NEW_TAB,		D(LGUI), T(T), U(LGUI),END );
    232 		BABLM( BABL_BROWSER_CLOSE_TAB,		D(LGUI), T(W), U(LGUI),END );
    233 		BABLM( BABL_BROWSER_REOPEN_LAST_TAB,		D(LGUI), D(RSFT),T(T), U(RSFT),U(LGUI),END );
    234 		BABLM( BABL_BROWSER_NEXT_TAB,		D(LGUI),D(LALT), T(RIGHT),U(LALT), U(LGUI),END );
    235 		BABLM( BABL_BROWSER_PREV_TAB,		D(LGUI), D(RSFT), T(LEFT), U(RSFT), U(LGUI),END );
    236 		BABLM( BABL_BROWSER_URL_BAR,		D(LGUI), T(L), U(LGUI),END );
    237 		BABLM( BABL_BROWSER_FORWARD,		D(LGUI), T(RIGHT), U(LGUI),END );
    238 		BABLM( BABL_BROWSER_BACK,			D(LGUI), T(LEFT), U(LGUI),END );
    239 		BABLM( BABL_BROWSER_FIND,			D(LGUI), T(F), U(LGUI),END );
    240 		BABLM( BABL_BROWSER_BOOKMARK,		D(LGUI), T(D), U(LGUI),END );
    241 		//BABLM( BABL_BROWSER_DEV_TOOLS,	T(F12), U(LGUI),END  ); // EDGE
    242 		BABLM( BABL_BROWSER_DEV_TOOLS,		D(LGUI), D(LALT), T(I), U(LALT),U(LGUI),END  ); // Chrome
    243 		// Chrome
    244 		BABLM( BABL_BROWSER_RELOAD,			D(LGUI), T(R), U(LGUI),END ); // add shift for reload w/o cache
    245 		BABLM( BABL_BROWSER_FULLSCREEN,		D(LGUI), D(LCTL), T(P), U(LCTL), U(LGUI),END ); //command shift F
    246 		BABLM( BABL_BROWSER_ZOOM_IN,		D(LGUI), D(RSFT), T(EQL), U(RSFT), U(LGUI),END ); // ctr+ +
    247 		BABLM( BABL_BROWSER_ZOOM_OUT,		D(LGUI), T(MINS), U(LGUI),END );
    248 #endif
    249 #endif
    250 
    251 	 return MACRO_NONE;
    252 #endif
    253 
    254 #ifdef EMACS_MODE
    255 
    256 	 case EMACS_MODE:
    257 	 	switch(shortcut) {
    258 //probably should allow meta to not be ALT
    259 
    260 		BABLM( BABL_GO_LEFT_1C,			T(LEFT), END );
    261 		BABLM( BABL_GO_RIGHT_1C, 		T(RIGHT), END );
    262 		BABLM( BABL_GO_LEFT_WORD, 		D(LALT), T(B), U(LALT), END );
    263 		BABLM( BABL_GO_RIGHT_WORD ,		D(LALT), T(F), U(LALT), END );
    264 		BABLM( BABL_GO_START_LINE ,  	D(LCTL), T(A), U(LCTL),  END );
    265 		BABLM( BABL_GO_END_LINE ,  		D(LCTL), T(E), U(LCTL), END );
    266 		BABLM( BABL_GO_START_DOC , 		D(LALT), D(LSFT), T(COMM),U(LSFT), U(LALT) ,END );
    267 		BABLM( BABL_GO_END_DOC , 		D(LALT), D(LSFT), T(DOT), U(LSFT), U(LALT) ,END );
    268 		BABLM( BABL_GO_NEXT_LINE , 		D(LCTL), T(N), U(LCTL), END );
    269 		BABLM( BABL_GO_PREV_LINE ,  	D(LCTL), T(P), U(LCTL), END );
    270 		BABLM( BABL_PGDN ,				D(LCTL), T(V), U(LCTL), END );
    271 		BABLM( BABL_PGUP ,  			D(LALT), T(V), U(LALT), END );
    272 		BABLM( BABL_DEL_RIGHT_1C, 		D(LCTL), T(D), U(LCTL),END );
    273 		BABLM( BABL_DEL_LEFT_WORD , 	D(LCTL), T(BSPACE), U(LCTL), END );
    274 		BABLM( BABL_DEL_RIGHT_WORD , 	D(LALT), T(D), U(LALT), END );
    275 		BABLM( BABL_DEL_TO_LINE_END,	D(LCTL), T(K), U(LCTL), END );
    276 		BABLM( BABL_DEL_TO_LINE_START,	T(ESC),  T(0), D(LCTL), T(K), U(LCTL),  END );
    277 #ifndef BABL_MOVEMENTONLY
    278 		BABLM( BABL_UNDO , 		D(LCTL), T(X), U(LCTL),T(C), END );
    279 		BABLM( BABL_REDO , 		D(LCTL), T(X), U(LCTL),T(C), END ); // arguably
    280 		BABLM( BABL_CUT , 		D(LCTL), T(W), U(LCTL), END );
    281 		BABLM( BABL_COPY , 		D(LALT), T(W), U(LALT), END ); //really?
    282 		BABLM( BABL_PASTE ,  	D(LCTL), T(Y), U(LCTL), END );
    283 		BABLM( BABL_SELECT_ALL ,D(LCTL), T(X), U(LCTL),T(H), END );
    284 		BABLM( BABL_FIND , 		D(LCTL), T(S), U(LCTL),END );
    285 		BABLM( BABL_FIND_NEXT , D(LCTL), T(S), U(LCTL),END );
    286 		BABLM( BABL_FIND_REPLACE , 		D(LALT),D(LSFT), T(5),U(LSFT),  U(LALT), END );
    287 		BABLM( BABL_RUNAPP , 			D(LALT), T(X), U(LALT),T(S),T(H),T(E),T(L),T(L),END );// arguably
    288 		BABLM( BABL_SWITCH_APP_NEXT , 	D(LCTL), T(X), U(LCTL),T(RIGHT), END ); // arguably
    289 		BABLM( BABL_SWITCH_APP_LAST , 	D(LCTL), T(X), U(LCTL),T(LEFT), END ); // arguably
    290 		BABLM( BABL_CLOSE_APP ,			D(LCTL), T(X), U(LCTL),T(C),END );
    291 		BABLM( BABL_HELP , 				D(LCTL),T(H), U(LCTL),T(A),END); // start search in help
    292 #ifndef BABL_NOBROWSER
    293 /* you get to figure w3 out
    294 		BABLM( BABL_BROWSER_NEW_TAB,		D(LGUI), T(T), U(LGUI),END );
    295 		BABLM( BABL_BROWSER_CLOSE_TAB,		D(LGUI), T(W), U(LGUI),END );
    296 		BABLM( BABL_BROWSER_REOPEN_LAST_TAB,		D(LGUI), D(RSFT),T(T), U(RSFT),U(LGUI),END );
    297 		BABLM( BABL_BROWSER_NEXT_TAB,		D(LGUI),D(LALT), T(RIGHT),U(LALT), U(LGUI),END );
    298 		BABLM( BABL_BROWSER_PREV_TAB,		D(LGUI), D(RSFT), T(LEFT), U(RSFT), U(LGUI),END );
    299 		BABLM( BABL_BROWSER_URL_BAR,		D(LGUI), T(L), U(LGUI),END );
    300 		BABLM( BABL_BROWSER_FORWARD,		D(LGUI), T(RIGHT), U(LGUI),END );
    301 		BABLM( BABL_BROWSER_BACK,			D(LGUI), T(LEFT), U(LGUI),END );
    302 		BABLM( BABL_BROWSER_FIND,			D(LGUI), T(F), U(LGUI),END );
    303 		BABLM( BABL_BROWSER_BOOKMARK,		D(LGUI), T(D), U(LGUI),END );
    304 		//BABLM( BABL_BROWSER_DEV_TOOLS,	T(F12), U(LGUI),END  ); // EDGE
    305 		BABLM( BABL_BROWSER_DEV_TOOLS,		D(LGUI), D(LALT), T(I), U(LALT),U(LGUI),END  ); // Chrome
    306 		// Chrome
    307 		BABLM( BABL_BROWSER_RELOAD,			D(LGUI), T(R), U(LGUI),END ); // add shift for reload w/o cache
    308 		BABLM( BABL_BROWSER_FULLSCREEN,		D(LGUI), D(LCTL), T(P), U(LCTL), U(LGUI),END ); //command shift F
    309 		BABLM( BABL_BROWSER_ZOOM_IN,		D(LGUI), D(RSFT), T(EQL), U(RSFT), U(LGUI),END ); // ctr+ +
    310 		BABLM( BABL_BROWSER_ZOOM_OUT,		D(LGUI), T(MINS), U(LGUI),END );
    311 */
    312 #endif
    313 #endif
    314 				break;
    315 
    316 	 return MACRO_NONE;
    317 	}
    318 
    319 #endif
    320 
    321 
    322 #ifdef VI_MODE
    323 	 case VI_MODE:
    324 // you have to track the modes yourself. Otherwise motion is awful (bell, bell, bell)
    325 
    326 
    327 			BABLM( BABL_GO_LEFT_1C , T(H), END );
    328 			BABLM( BABL_GO_RIGHT_1C , T(L), END );
    329 			BABLM( BABL_GO_LEFT_WORD , T(B),END );
    330 			BABLM( BABL_GO_RIGHT_WORD , T(W), END );
    331 			BABLM( BABL_GO_START_LINE , D(LSFT), T(6),U(LSFT), END ); //^
    332 			BABLM( BABL_GO_END_LINE ,   D(LSFT), T(4),U(LSFT) , END ); //$
    333 			BABLM( BABL_GO_START_DOC , T(G),T(G) ,END );
    334 			BABLM( BABL_GO_END_DOC , D(LSFT), T(G),U(LSFT),END );
    335 			BABLM( BABL_GO_NEXT_LINE ,  T(J), END );
    336 			BABLM( BABL_GO_PREV_LINE,  T(K), END );
    337 			BABLM( BABL_PGDN ,D(LCTL), T(F), U(LCTL), END );
    338 			BABLM( BABL_PGUP , D(LCTL), T(B), U(LCTL), END );
    339 			BABLM( BABL_DEL_RIGHT_1C ,  T(X),END );
    340 			BABLM( BABL_DEL_LEFT_WORD ,  T(D),T(G),T(E),END );
    341 			BABLM( BABL_DEL_RIGHT_WORD ,  T(D),T(W),END );
    342 			BABLM( BABL_DEL_TO_LINE_END,	T(D),D(LSFT), T(4),U(LSFT) ,END ); // d$
    343 			BABLM( BABL_DEL_TO_LINE_START,	T(D),D(LSFT), T(6),U(LSFT) ,END );
    344 #ifndef BABL_MOVEMENTONLY
    345 			BABLM( BABL_UNDO , T(U), END );
    346  			BABLM( BABL_REDO ,  D(LCTL), T(R), U(LCTL), END );
    347  			BABLM( BABL_CUT ,  T(X), END );
    348  			BABLM( BABL_COPY , T(Y),END );
    349 			BABLM( BABL_PASTE ,  T(P), END );
    350 			BABLM( BABL_SELECT_ALL , D(LSFT), T(SCLN),U(LSFT),D(LSFT), T(5),U(LSFT),T(Y), END ); // wrong but helpful?
    351 			BABLM( BABL_FIND ,   T(SLASH),END );
    352 			BABLM( BABL_FIND_NEXT , T(N),END );
    353 			BABLM( BABL_FIND_REPLACE ,  D(LALT),D(LSFT), T(5),U(LSFT),  U(LALT), END );
    354 			BABLM( BABL_RUNAPP,END );
    355 			BABLM( BABL_SWITCH_APP_NEXT		,END );
    356 			BABLM( BABL_SWITCH_APP_LAST		,END );
    357 			BABLM(BABL_CLOSE_APP,	D(LSFT), T(SCLN),U(LSFT), T(Q), D(RSFT), T(1),U(RSFT), END );
    358 			BABLM(BABL_HELP,	 D(LSFT), T(SCLN),U(LSFT),T(H),END); // start search in help
    359 #ifndef BABL_NOBROWSER
    360 /* you get to figure this out
    361 		BABLM( BABL_BROWSER_NEW_TAB,		D(LGUI), T(T), U(LGUI),END );
    362 		BABLM( BABL_BROWSER_CLOSE_TAB,		D(LGUI), T(W), U(LGUI),END );
    363 		BABLM( BABL_BROWSER_REOPEN_LAST_TAB,		D(LGUI), D(RSFT),T(T), U(RSFT),U(LGUI),END );
    364 		BABLM( BABL_BROWSER_NEXT_TAB,		D(LGUI),D(LALT), T(RIGHT),U(LALT), U(LGUI),END );
    365 		BABLM( BABL_BROWSER_PREV_TAB,		D(LGUI), D(RSFT), T(LEFT), U(RSFT), U(LGUI),END );
    366 		BABLM( BABL_BROWSER_URL_BAR,		D(LGUI), T(L), U(LGUI),END );
    367 		BABLM( BABL_BROWSER_FORWARD,		D(LGUI), T(RIGHT), U(LGUI),END );
    368 		BABLM( BABL_BROWSER_BACK,			D(LGUI), T(LEFT), U(LGUI),END );
    369 		BABLM( BABL_BROWSER_FIND,			D(LGUI), T(F), U(LGUI),END );
    370 		BABLM( BABL_BROWSER_BOOKMARK,		D(LGUI), T(D), U(LGUI),END );
    371 		//BABLM( BABL_BROWSER_DEV_TOOLS,	T(F12), U(LGUI),END  ); // EDGE
    372 		BABLM( BABL_BROWSER_DEV_TOOLS,		D(LGUI), D(LALT), T(I), U(LALT),U(LGUI),END  ); // Chrome
    373 		// Chrome
    374 		BABLM( BABL_BROWSER_RELOAD,			D(LGUI), T(R), U(LGUI),END ); // add shift for reload w/o cache
    375 		BABLM( BABL_BROWSER_FULLSCREEN,		D(LGUI), D(LCTL), T(P), U(LCTL), U(LGUI),END ); //command shift F
    376 		BABLM( BABL_BROWSER_ZOOM_IN,		D(LGUI), T(PLUS), U(LGUI),END );
    377 		BABLM( BABL_BROWSER_ZOOM_OUT,		D(LGUI), T(MINS), U(LGUI),END );
    378 */
    379 #endif
    380 #endif
    381 		 return MACRO_NONE;
    382 #endif
    383 
    384 
    385 
    386 
    387 #ifdef READMUX_MODE
    388 // Readline command line editing + tmux windowing
    389 // I havent decided how much to do readline and how much tmux
    390 
    391 
    392 	case READMUX_MODE:
    393 
    394 		BABLM( BABL_GO_LEFT_1C , 		T(LEFT), END );
    395 		BABLM( BABL_GO_RIGHT_1C , 		T(RIGHT), END );
    396 		BABLM( BABL_GO_LEFT_WORD , 		D(LALT), T(B), U(LALT), END );
    397 		BABLM( BABL_GO_RIGHT_WORD , 	D(LALT), T(F), U(LALT), END );
    398 		BABLM( BABL_GO_START_LINE ,  	D(LCTL), T(A), U(LCTL),  END );
    399 		BABLM( BABL_GO_END_LINE ,  		D(LCTL), T(E), U(LCTL), END );
    400 		//BABLM( BABL_GO_START_DOC		,END );// tmux?
    401 		//BABLM( BABL_GO_END_DOC		,END );  // tmux?
    402 		BABLM( BABL_GO_NEXT_LINE ,  	D(LCTL), T(N), U(LCTL), END );
    403 		BABLM( BABL_GO_PREV_LINE ,  	D(LCTL), T(P), U(LCTL), END );
    404 		BABLM( BABL_PGDN , 			T(PGDN), END );
    405 		BABLM( BABL_PGUP , 			T(PGUP), END );
    406 		BABLM( BABL_DEL_RIGHT_1C , 	D(LCTL), T(D), U(LCTL),END );
    407 		BABLM( BABL_DEL_LEFT_WORD , D(LCTL), T(W), U(LCTL), END );
    408 		BABLM( BABL_DEL_RIGHT_WORD , 	D(LALT), T(D), U(LALT), END );
    409 		BABLM( BABL_DEL_TO_LINE_END,	D(LCTL), T(K), U(LCTL), END );
    410 		BABLM( BABL_DEL_TO_LINE_START,	D(LCTL), T(U), U(LCTL),  END );
    411 #ifndef BABL_MOVEMENTONLY
    412 		BABLM( BABL_UNDO , 			D(LALT), T(R), U(LALT) , END );
    413 		BABLM( BABL_REDO , 			D(LCTL), T(X), U(LCTL),T(C), END ); // arguably
    414 		BABLM( BABL_CUT , 			D(LCTL), T(K), U(LCTL), END ); // wrong half the time
    415 		//BABLM( BABL_COPY		,END );
    416 		BABLM( BABL_PASTE ,  		D(LCTL), T(Y), U(LCTL), END );
    417 		BABLM( BABL_SELECT_ALL ,	D(LCTL), T(A), T(K), T(Y), U(LCTL) , END );
    418 		BABLM( BABL_FIND ,  		D(LCTL), T(R), U(LCTL), END ); // search history
    419 		BABLM(BABL_FIND_NEXT,  		D(LCTL), T(S), U(LCTL), END );
    420 		//BABLM( BABL_FIND_REPLACE		,END );
    421 		BABLM( BABL_RUNAPP ,  		D(LCTL), T(B), U(LCTL),  T(C),END );  //tmux
    422 		BABLM( BABL_SWITCH_APP_NEXT ,  D(LCTL), T(B), U(LCTL),  T(N),END );  //tmux
    423 		BABLM( BABL_SWITCH_APP_LAST ,  D(LCTL), T(B), U(LCTL),  T(P),END );  //tmux
    424 		BABLM( BABL_CLOSE_APP , 		D(LCTL), T(B), U(LCTL),  T(D),END); // usually what I want
    425 		// BABLM( BABL_HELP		,END );
    426 #ifndef BABL_NOBROWSER
    427 /* Add lynx shortcuts?
    428 		BABLM( BABL_BROWSER_NEW_TAB,		D(LGUI), T(T), U(LGUI),END );
    429 		BABLM( BABL_BROWSER_CLOSE_TAB,		D(LGUI), T(W), U(LGUI),END );
    430 		BABLM( BABL_BROWSER_REOPEN_LAST_TAB,		D(LGUI), D(RSFT),T(T), U(RSFT),U(LGUI),END );
    431 		BABLM( BABL_BROWSER_NEXT_TAB,		D(LGUI),D(LALT), T(RIGHT),U(LALT), U(LGUI),END );
    432 		BABLM( BABL_BROWSER_PREV_TAB,		D(LGUI), D(RSFT), T(LEFT), U(RSFT), U(LGUI),END );
    433 		BABLM( BABL_BROWSER_URL_BAR,		D(LGUI), T(L), U(LGUI),END );
    434 		BABLM( BABL_BROWSER_FORWARD,		D(LGUI), T(RIGHT), U(LGUI),END );
    435 		BABLM( BABL_BROWSER_BACK,			D(LGUI), T(LEFT), U(LGUI),END );
    436 		BABLM( BABL_BROWSER_FIND,			D(LGUI), T(F), U(LGUI),END );
    437 		BABLM( BABL_BROWSER_BOOKMARK,		D(LGUI), T(D), U(LGUI),END );
    438 		//BABLM( BABL_BROWSER_DEV_TOOLS,	T(F12), U(LGUI),END  ); // EDGE
    439 		BABLM( BABL_BROWSER_DEV_TOOLS,		D(LGUI), D(LALT), T(I), U(LALT),U(LGUI),END  ); // Chrome
    440 		// Chrome
    441 		BABLM( BABL_BROWSER_RELOAD,			D(LGUI), T(R), U(LGUI),END ); // add shift for reload w/o cache
    442 		BABLM( BABL_BROWSER_FULLSCREEN,		D(LGUI), D(LCTL), T(P), U(LCTL), U(LGUI),END ); //command shift F
    443 		BABLM( BABL_BROWSER_ZOOM_IN,		D(LGUI), T(PLUS), U(LGUI),END );
    444 		BABLM( BABL_BROWSER_ZOOM_OUT,		D(LGUI), T(MINS), U(LGUI),END );
    445 */
    446 #endif
    447 #endif
    448 
    449 	return MACRO_NONE;
    450 
    451 #endif
    452 
    453 	default:
    454     	return MACRO_NONE;
    455     }
    456 
    457 }
    458 
    459 
    460 #endif