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.txt (3728B)


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