summaryrefslogtreecommitdiffstats
path: root/users/miles2go
diff options
context:
space:
mode:
authormilestogo <milestogo@users.noreply.github.com>2020-05-08 23:15:26 -0700
committerGitHub <noreply@github.com>2020-05-08 23:15:26 -0700
commit803610a284ac886eaeb319b4a8d25ffbd2861152 (patch)
tree46c074727b4015bdd345d762e78f89144498ce24 /users/miles2go
parentcd0edbb1fba91df97be233e30c145f352eda31c0 (diff)
[Keymap] initial user directory for milestogo + babblepaste (#7698)
* initial user directory * fix missing endif in vi mode * fix includes per drashna and a few typos. I have not tested the userspace keymap, it is just there to help keep the user space and keymap in sync * move babblepaste docs to md format * clean up block quotes * TIL clang-format - miles2go userspace
Diffstat (limited to 'users/miles2go')
-rw-r--r--users/miles2go/babblePaste.c125
-rw-r--r--users/miles2go/babblePaste.h349
-rw-r--r--users/miles2go/babblePaste.md207
-rw-r--r--users/miles2go/babl_chromeos.c103
-rw-r--r--users/miles2go/babl_emacs.c85
-rw-r--r--users/miles2go/babl_linux.c102
-rw-r--r--users/miles2go/babl_mac.c152
-rw-r--r--users/miles2go/babl_readmux.c86
-rw-r--r--users/miles2go/babl_vi.c76
-rw-r--r--users/miles2go/babl_windows.c151
-rw-r--r--users/miles2go/config.h53
-rw-r--r--users/miles2go/keymaps/handwired/ms_sculpt_mobile/config.h41
-rw-r--r--users/miles2go/keymaps/handwired/ms_sculpt_mobile/keymap.c463
-rw-r--r--users/miles2go/keymaps/handwired/ms_sculpt_mobile/readme.md10
-rw-r--r--users/miles2go/keymaps/handwired/ms_sculpt_mobile/rules.mk24
-rw-r--r--users/miles2go/milestogo.c142
-rw-r--r--users/miles2go/milestogo.h289
-rw-r--r--users/miles2go/readme.md10
-rw-r--r--users/miles2go/rules.mk10
19 files changed, 2478 insertions, 0 deletions
diff --git a/users/miles2go/babblePaste.c b/users/miles2go/babblePaste.c
new file mode 100644
index 0000000000..2a32024cd2
--- /dev/null
+++ b/users/miles2go/babblePaste.c
@@ -0,0 +1,125 @@
+/* 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 QMK_KEYBOARD_H
+
+#ifdef USE_BABBLEPASTE
+# include "babblePaste.h"
+
+// small function that we might also want to call from a keymap.
+
+// GLOBAL variable to determine mode. Sets startup default if no eeppom
+uint8_t babble_mode = 0;
+
+// function to tell the user that the mode has changed
+__attribute__((weak)) void babble_led_user(void) {}
+
+void set_babble_mode(uint8_t id) { babble_mode = id; }
+
+void babble_mode_increment() {
+ babble_mode += 1;
+ if (babble_mode >= BABL_MODEMAX) {
+ babble_mode = 0;
+ }
+}
+
+void babble_mode_decrement() {
+ if (babble_mode >= 1) {
+ babble_mode -= 1;
+ } else {
+ babble_mode = BABL_MODEMAX - 1;
+ }
+}
+
+/* this function runs the appropriate babblepaste macro, given
+the global babble_mode and a keycode defined in the babble_keycodes enum.
+
+This could be made faster by splitting into two functions sorted by keycode range
+But that makes for a *lot* of ifdefs.
+*/
+bool babblePaste(uint16_t keycode) {
+ // handle the OS/mode switching first
+
+# ifdef BABL_MAC
+ if (keycode == BABL_DO_MAC) {
+ set_babble_mode(BABL_MAC_MODE);
+ babble_led_user();
+ return true;
+ }
+
+ if (babble_mode == BABL_MAC_MODE) {
+ babblePaste_mac(keycode);
+ }
+# endif
+
+# ifdef BABL_VI
+ if (keycode == BABL_DO_VI) {
+ set_babble_mode(BABL_VI_MODE);
+ babble_led_user();
+ return true;
+ }
+ if (babble_mode == BABL_VI_MODE) {
+ babblePaste_vi(keycode);
+ }
+# endif
+# ifdef BABL_WINDOWS
+ if (keycode == BABL_DO_WINDOWS) {
+ set_babble_mode(BABL_WINDOWS_MODE);
+ babble_led_user();
+ return true;
+ }
+ if (babble_mode == BABL_WINDOWS_MODE) {
+ babblePaste_win(keycode);
+ }
+# endif
+# ifdef BABL_LINUX
+ if (keycode == BABL_DO_LINUX) {
+ set_babble_mode(BABL_LINUX_MODE);
+ babble_led_user();
+ return true;
+ }
+ if (babble_mode == BABL_LINUX_MODE) {
+ babblePaste_linux(keycode);
+ }
+# endif
+# ifdef BABL_EMACS
+ if (keycode == BABL_DO_EMACS) {
+ set_babble_mode(BABL_EMACS_MODE);
+ babble_led_user();
+ return true;
+ }
+ if (babble_mode == BABL_EMACS_MODE) {
+ babblePaste_emacs(keycode);
+ }
+# endif
+# ifdef BABL_CHROME
+ if (keycode == BABL_DO_CHROMEOS) {
+ set_babble_mode(BABL_CHROMEOS_MODE);
+ babble_led_user();
+ return true;
+ }
+ if (babble_mode == BABL_CHROMEOS_MODE) {
+ babblePaste_readmux(keycode);
+ }
+# endif
+# ifdef BABL_READMUX
+ if (keycode == BABL_DO_READMUX) {
+ set_babble_mode(BABL_READMUX_MODE);
+ babble_led_user();
+ return true;
+ }
+ if (babble_mode == BABL_READMUX_MODE) {
+ babblePaste_readmux(keycode);
+ }
+# endif
+
+ return false;
+}
+
+#endif // USE_BABBLEPASTE
diff --git a/users/miles2go/babblePaste.h b/users/miles2go/babblePaste.h
new file mode 100644
index 0000000000..606640227c
--- /dev/null
+++ b/users/miles2go/babblePaste.h
@@ -0,0 +1,349 @@
+/* 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 bable_mode is done by another macro, or TBD interaction with the host.
+
+Huge thanks to https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts
+and jeebak & algernon's keymap
+*/
+
+#pragma once
+#include "quantum.h"
+
+#ifdef USE_BABBLEPASTE
+
+void set_babble_mode(uint8_t id);
+void babble_mode_increment(void);
+void babble_mode_decrement(void);
+void babble_led_user(void);
+
+// manually re-order these if you want to set the order or default.
+enum babble_modes {
+# ifdef BABL_MAC
+ BABL_MAC_MODE,
+# endif
+# ifdef BABL_READMUX
+ BABL_READMUX_MODE,
+# endif
+# ifdef BABL_WINDOWS
+ BABL_WINDOWS_MODE,
+# endif
+# ifdef BABL_VI
+ BABL_VI_MODE,
+# endif
+# ifdef BABL_LINUX
+ BABL_LINUX_MODE,
+# endif
+# ifdef BABL_EMACS
+ BABL_EMACS_MODE,
+# endif
+# ifdef BABL_CHROMEOS
+ BABL_CHROMEOS_MODE,
+# endif
+ BABL_MODEMAX
+};
+
+// void babble_led_user( uint8_t id)
+
+/// Hacks to make it easier to create sendstring macros
+
+//"outer" versions wrap text
+# define OMCTL(arg) SS_DOWN(X_LCTRL) arg SS_UP(X_LCTRL)
+# define OMGUI(arg) SS_DOWN(X_LGUI) arg SS_UP(X_LGUI)
+# define OMALT(arg) SS_DOWN(X_LALT) arg SS_UP(X_LALT)
+# define OMSFT(...) SS_DOWN(X_LSHIFT) __VA_ARGS__ SS_UP(X_LSHIFT)
+//"inner" versions wrap a key tap
+# define IMCTL(arg) SS_DOWN(X_LCTRL) SS_TAP(arg) SS_UP(X_LCTRL)
+# define IMGUI(arg) SS_DOWN(X_LGUI) SS_TAP(arg) SS_UP(X_LGUI)
+# define IMALT(arg) SS_DOWN(X_LALT) SS_TAP(arg) SS_UP(X_LALT)
+# define IMSFT(arg) SS_DOWN(X_LSHIFT) SS_TAP(arg) SS_UP(X_LSHIFT)
+
+# define BABLM(ent, ...) \
+ if (ent == keycode) { \
+ SEND_STRING(__VA_ARGS__); \
+ return true; \
+ }
+
+// BabblePaste should be loaded first (header in userspace .h file, before all else)
+// if not,we'll do our best.
+# if defined(NEW_SAFE_RANGE)
+# define BABBLE_START NEW_SAFE_RANGE
+# else
+# if defined(KEYMAP_SAFE_RANGE)
+# define BABBLE_START KEYMAP_SAFE_RANGE
+# else
+# define BABBLE_START SAFE_RANGE
+# endif
+# endif
+
+enum babble_keycodes {
+ FIRST = BABBLE_START,
+# ifdef BABL_MOVE
+ // Movement macros
+ // left & right
+ BABL_GO_LEFT_1C,
+ BABL_GO_RIGHT_1C,
+ BABL_GO_LEFT_WORD,
+ BABL_GO_RIGHT_WORD,
+ BABL_GO_START_LINE,
+ BABL_GO_END_LINE,
+ // now up & down
+ BABL_GO_START_DOC,
+ BABL_GO_END_DOC,
+ BABL_GO_NEXT_LINE,
+ BABL_GO_PREV_LINE,
+ BABL_GO_PARA_START,
+ BABL_GO_PARA_END,
+ BABL_PGDN,
+ BABL_PGUP,
+ // And the delete options
+ BABL_DEL_LEFT_1C, // == backspace, so why bother?
+ BABL_DEL_RIGHT_1C, // usually = Del
+ BABL_DEL_LEFT_WORD,
+ BABL_DEL_RIGHT_WORD,
+ BABL_DEL_TO_LINE_END, // delete from cursor to end of line
+ BABL_DEL_TO_LINE_START, // delete from cursor to begining line
+ BABL_MODE, // print out string saying what mode we're in.
+# endif
+# ifdef BABL_OSKEYS
+ BABL_UNDO,
+ BABL_REDO,
+ BABL_CUT,
+ BABL_COPY,
+ BABL_PASTE,
+ BABL_SELECT_ALL,
+ /* not yet implemented
+ BABL_SWAP_LAST2C, // swap last characters before the cursor
+ BABL_SWAP_LAST2W, // Swap the last two words before the cursor
+ */
+ // find & replace
+ BABL_FIND,
+ BABL_FIND_NEXT,
+ BABL_FIND_PREV,
+ BABL_FIND_REPLACE,
+ // GUI or app
+ BABL_RUNAPP,
+ BABL_SWITCH_APP_NEXT,
+ BABL_SWITCH_APP_LAST, // previous
+ BABL_WINDOW_NEXT,
+ BABL_WINDOW_PREV,
+ BABL_WINDOW_NEW,
+ BABL_CLOSE_APP,
+ BABL_HELP,
+ BABL_LOCK,
+ BABL_SCREENCAPTURE,
+ BABL_SWITCH_KEYBOARD_LAYOUT,
+# endif
+# ifdef BABL_BROWSER
+ BABL_BROWSER_NEW_TAB,
+ BABL_BROWSER_CLOSE_TAB,
+ BABL_BROWSER_REOPEN_LAST_TAB,
+ BABL_BROWSER_NEXT_TAB,
+ BABL_BROWSER_PREV_TAB,
+ BABL_BROWSER_URL_BAR,
+ BABL_BROWSER_FORWARD,
+ BABL_BROWSER_BACK,
+ BABL_BROWSER_FIND,
+ BABL_BROWSER_BOOKMARK,
+ BABL_BROWSER_DEV_TOOLS, // hard one to remember
+ BABL_BROWSER_RELOAD,
+ BABL_BROWSER_FULLSCREEN,
+ BABL_BROWSER_ZOOM_IN,
+ BABL_BROWSER_ZOOM_OUT,
+ BABL_BROWSER_VIEWSRC,
+# endif
+# ifdef BABL_APP
+ BABL_APP_SAVE, // save file blurs app & os. Move?
+ BABL_APP_PASTE_VALUES, // paste only values, or with some special formatting. ctrl shift v chrome, // Ctrl+Alt+V, excel
+ // App hotkeys will be flawed, since you may use different spreadsheets across OSes.
+# ifdef BABL_APP_CELLS // spreadsheets and tables
+ BABL_APP_CENTER_ALIGN, // Center align contents of a cell in table or spreadsheet.
+ BABL_APP_CLEAR_FORMATTING, //
+ BABL_APP_SCROLL_ACTIVE_CELL, // scroll to active cell.
+ BABL_NEWLINE_IN_CELL, // newline inside cell of table,
+ BABL_INSERT_COMMENT, // insert comment
+ BABL_INSERT_COL_LEFT, // insert columns to the left
+ BABL_INSERT_ROW, // insert row
+ BABL_DELETE_ROW, // delete row // excel ctrl minus // chrome ctrl alt minus
+ BABL_SELECT_COL, // select column - ctrl space //same in both
+ BABL_SELECT_ROW, // select row shift spaced // same in both.
+# endif // BABL_APP_CELLS
+# ifdef BABL_APP_EDITOR
+ BABL_APP_MULTI_SELECT, /* www.sublimetext.com/docs/2/multiple_selection_with_the_keyboard.html */
+# endif // BABL_APP_EDITOR
+# ifdef BABL_APP_WINDOWSPLITTING
+ // These aren't useful on most oses.
+ BABL_SPLIT_FRAME_VERT,
+ BABL_UNSPLIT_FRAME_VERT,
+ BABL_SPLIT_FRAME_HORIZONTAL,
+ BABL_UNSPLIT_FRAME_HORIZONTAL,
+ BABL_NEXT_FRAME,
+ BABL_PREV_FRAME,
+# endif
+
+# endif
+
+// Macros for mode switching
+# ifdef BABL_WINDOWS
+ BABL_DO_WINDOWS,
+# endif
+# ifdef BABL_MAC
+ BABL_DO_MAC,
+# endif
+# ifdef BABL_LINUX
+ BABL_DO_LINUX,
+# endif
+# ifdef BABL_EMACS
+ BABL_DO_EMACS,
+# endif
+# ifdef BABL_VI
+ BABL_DO_VI,
+# endif
+# ifdef BABL_READMUX
+ BABL_DO_READMUX,
+# endif
+# ifdef BABL_CHROMEOS
+ BABL_DO_CHROMEOS,
+# endif
+ BABBLE_END_RANGE
+};
+
+// primary function.
+bool babblePaste(uint16_t keycode);
+
+/****************************************************/
+/* All per-os includes and short mode switch macros*/
+# ifdef BABL_WINDOWS
+# define B_WIN BABL_DO_WINDOWS
+bool babblePaste_win(uint16_t keycode);
+# endif
+# ifdef BABL_MAC
+# define B_MAC BABL_DO_MAC
+bool babblePaste_mac(uint16_t keycode);
+# endif
+# ifdef BABL_LINUX
+# define B_LINUX BABL_DO_LINUX
+bool babblePaste_linux(uint16_t keycode);
+# endif
+# ifdef BABL_EMACS
+# define B_EMACS BABL_DO_EMACS
+bool babblePaste_emacs(uint16_t keycode);
+# endif
+# ifdef BABL_VI
+# define B_VI BABL_DO_VI
+bool babblePaste_vi(uint16_t keycode);
+# endif
+# ifdef BABL_READMUX
+# define B_READ BABL_DO_READMUX
+bool babblePaste_readmux(uint16_t keycode);
+# endif
+# ifdef BABL_CHROMEOS
+# define B_CROM BABL_DO_CHROMEOS
+bool babblePaste_chromeos(uint16_t keycode);
+# endif
+
+# define BABL_INC babble_mode_increment();
+# define BABL_DEC babble_mode_decrement();
+
+/****************************************************
+** All keyboard macros for Babble Actions
+*****************************************************/
+
+# ifdef BABL_MOVE
+# define B_L1C BABL_GO_LEFT_1C
+# define B_R1C BABL_GO_RIGHT_1C
+# define B_L1W BABL_GO_LEFT_WORD
+# define B_R1W BABL_GO_RIGHT_WORD
+# define B_GSOL BABL_GO_START_LINE
+# define B_GEOL BABL_GO_END_LINE
+# define B_GTOP BABL_GO_START_DOC
+# define B_GEND BABL_GO_END_DOC
+# define B_DOWN BABL_GO_NEXT_LINE
+# define B_UP BABL_GO_PREV_LINE
+# define B_PTOP BABL_GO_PARA_START
+# define B_PEND BABL_GO_PARA_END
+# define B_PGDN BABL_PGDN
+# define B_PGUP BABL_PGUP
+//#define B_BKSP BABL_DEL_LEFT_1C == backspace so why bother.
+# define B_DEL BABL_DEL_RIGHT_1C // usually = Del
+# define B_DLW BABL_DEL_LEFT_WORD
+# define B_DRW BABL_DEL_RIGHT_WORD
+# define B_DEOL BABL_DEL_TO_LINE_END // delete from cursor to end of line
+# define B_DSOL BABL_DEL_TO_LINE_START // delete from cursor to begining line
+# define B_MODE BABL_MODE // type out name of current mode.
+# endif
+
+# ifdef BABL_OSKEYS
+# define B_UNDO BABL_UNDO
+# define B_REDO BABL_REDO
+# define B_CUT BABL_CUT
+# define B_COPY BABL_COPY
+# define B_PASTE BABL_PASTE
+# define B_SELALL BABL_SELECT_ALL
+# define B_SELA BABL_SELECT_ALL
+# define B_FIND BABL_FIND
+# define B_FINDN BABL_FIND_NEXT
+# define B_FINDP BABL_FIND_PREV
+# define B_RPLACE BABL_FIND_REPLACE
+# define B_RUNAPP BABL_RUNAPP
+# define B_NAPP BABL_SWITCH_APP_NEXT
+# define B_PAPP BABL_SWITCH_APP_LAST // previous
+# define B_NWIN BABL_WINDOW_NEXT
+# define B_PWIN BABL_WINDOW_PREV
+# define B_WINN BABL_WINDOW_NEW
+# define B_CAPP BABL_CLOSE_APP
+# define B_HELP BABL_HELP
+# define B_LOCK BABL_LOCK
+# define B_SCAP BABL_SCREENCAPTURE
+# define B_KEYB BABL_SWITCH_KEYBOARD_LAYOUT
+# endif
+
+# ifdef BABL_BROWSER
+# define B_NTAB BABL_BROWSER_NEW_TAB
+# define B_CTAB BABL_BROWSER_CLOSE_TAB
+# define B_ROTB BABL_BROWSER_REOPEN_LAST_TAB
+# define B_NXTB BABL_BROWSER_NEXT_TAB
+# define B_PTAB BABL_BROWSER_PREV_TAB
+# define B_NURL BABL_BROWSER_URL_BAR
+# define B_BFWD BABL_BROWSER_FORWARD
+# define B_BBAK BABL_BROWSER_BACK
+# define B_BFND BABL_BROWSER_FIND
+# define B_BOOK BABL_BROWSER_BOOKMARK
+# define B_BDEV BABL_BROWSER_DEV_TOOLS // hard one to remember
+# define B_BRLD BABL_BROWSER_RELOAD
+# define B_BFULL BABL_BROWSER_FULLSCREEN
+# define B_ZIN BABL_BROWSER_ZOOM_IN
+# define B_ZOUT BABL_BROWSER_ZOOM_OUT
+# endif
+
+# ifdef BABL_APP
+# define B_SAVE BABL_APP_SAVE
+# ifdef BABL_APP_CELLS // spreadsheets and tables
+# define B_PASTV BABL_APP_PASTE_VALUES
+# define B_CALN BABL_APP_CENTER_ALIGN
+# define B_CFMT BABL_APP_CLEAR_FORMATTING
+# define B_SCLA BABL_APP_SCROLL_ACTIVE_CELL
+# define B_NCEL BABL_NEWLINE_IN_CELL
+# define B_IPRW BABL_INSERT_ROW_ABOVE
+# define B_ICOL BABL_INSERT_COL_LEFT
+# define B_IROW BABL_INSERT_ROW
+# define B_DROW BABL_DELETE_ROW
+# define B_SELC BABL_SELECT_COL
+# define B_SELR BABL_SELECT_ROW
+# endif // BABL_APP_CELLS
+# ifdef BABL_APP_EDITOR
+# define B_MSEL BABL_APP_MULTI_SELECT
+/* www.sublimetext.com/docs/2/multiple_selection_with_the_keyboard.html */
+# endif // BABL_APP_EDITOR
+# ifdef BABL_APP_WINDOWSPLITTING
+# define B_VSPLIT BABL_SPLIT_FRAME_VERT
+# define B_VUNSPT BABL_UNSPLIT_FRAME_VERT
+# define B_HSPLIT BABL_SPLIT_FRAME_HORIZONTAL
+# define B_HUNSPT BABL_UNSPLIT_FRAME_HORIZONTAL
+# define B_NXTFM BABL_NEXT_FRAME
+# define B_PRVFM BABL_PREV_FRAME
+# endif // BABL_APP_WINDOWSPLITTING
+# endif // BABL_APP
+
+#endif
diff --git a/users/miles2go/babblePaste.md b/users/miles2go/babblePaste.md
new file mode 100644
index 0000000000..cc1c31bd0d
--- /dev/null
+++ b/users/miles2go/babblePaste.md
@@ -0,0 +1,207 @@
+## Babblepaste, a universal translator for keyboard shortcuts
+
+The idea is to have one "paste" key do the right thing for any operating system.
+Put the keyboard in Windows mode, and "paste" means Ctrl-v.
+Switch to Emacs and "Paste" means Ctrl-y. Mac is GUI-v and so on.
+
+Currently supported modes are Windows, OS X, Gnome/KDE, Emacs, VI , ChromeOS, and Readline, with 70+ common macro actions.
+
+The babblepaste library looks for the current OS in the babble_mode global variable.
+To switch modes, run the switch_babble_mode() function, or a pre defined BABL_DO_x macro.
+
+**BE CAREFUL**
+ * Not all actions are defined for all OSes. The default is to do nothing.
+ * Not all actions are _TESTED_ on all OSes.
+ * Keys can have very different meanings between windows in the same OS. If you switch apps without switching modes, bad things can happen.
+
+###To use the library
+#### Add #defines to your config.h.
+```
+ #define USE_BABBLEPASTE
+
+ //// Uncomment the modes you want to enable
+ #define BABL_WINDOWS
+ #define BABL_READMUX
+ #define BABL_VI
+ #define BABL_MAC
+ #define BABL_LINUX
+ #define BABL_EMACS
+ #define BABL_CHROMEOS
+
+ //// These enable subsets of babble macros. Disable options to save space
+ #define BABL_MOVE // Uncomment to add basic cursor movement
+ #define BABL_OSKEYS // This adds Cut, paste, window movement and common OS shortcuts
+ #define BABL_BROWSER // Browser shortcuts
+
+ //// What Browser shortcuts?
+ #define BABL_BROWSER_CHROME // Chrome browser, Google apps
+ //#define BABL_BROWSER_MS
+ //#define BABL_BROWSER_SAFARI // Safari, Apple defaults.
+
+ //// applications vary even more between OSes. We'll do our best.
+ #define BABL_APP
+ // To enable specific App options.
+ #define BABL_APP_CELLS // spreadsheets and tables
+ #define BABL_APP_EDITOR // Fancy editor commands
+ #define BABL_APP_WINDOWSPLITTING // splitting frames & windows
+
+ //// What App keybinding is assumed?
+ //#define BABL_APP_GOOGLE // Google office
+ #define BABL_APP_MSOFFICE // MS office
+ //#define BABL_APP_APPLE // Apple office
+ #define BABL_APP_SUBLIME
+```
+
+#### Enable Babblepaste in your Keymap
+
+Add the following to your keymap in process_record_user, before the main switch statement.
+```
+ #ifdef USE_BABBLEPASTE
+ if( keycode > BABBLE_START && keycode < BABBLE_END_RANGE ) {
+ if (record->event.pressed) { // is there a case where this isn't desired?
+ babblePaste ( keycode );
+ } else{
+ return true;
+ }
+ }
+ #endif
+```
+
+#### Add makefile rules
+
+Update your rules.mk to include the modes you want.
+
+ `SRC += babblePaste.c babl_windows.c babl_mac.c babl_vi.c babl_readmux.c babl_chromeos.c babl_emacs.c babl_linux.c`
+
+
+#### Custom Keycodes
+
+If you are using custom keycodes, update the safe range in your user.h
+```
+ #if defined(BABBLE_END_RANGE)
+ #define USER_START BABBLE_END_RANGE
+ #else
+ #if defined(KEYMAP_SAFE_RANGE)
+ #define USER_START KEYMAP_SAFE_RANGE
+ #else
+ #define USER_START SAFE_RANGE
+ #endif
+ #endif
+```
+
+#### Add Babblepaste actions to your keymap.
+See the full list in babblePaste.h, or the list below
+```
+ B_WIN // switch babblepaste to windows mode.
+ B_MAC // Mac Mode
+ B_LNX // switch to linux
+ B_VI // switch to Vi mode
+ B_EMAX // switch mode to emacs
+ B_READ // switch to readline /tmux mode
+ B_CROM // switch to chromeos mode.
+
+ #define B_L1C BABL_GO_LEFT_1C
+ #define B_R1C BABL_GO_RIGHT_1C
+ #define B_L1W BABL_GO_LEFT_WORD
+ #define B_R1W BABL_GO_RIGHT_WORD
+ #define B_GSOL BABL_GO_START_LINE
+ #define B_GEOL BABL_GO_END_LINE
+ #define B_GTOP BABL_GO_START_DOC
+ #define B_GEND BABL_GO_END_DOC
+ #define B_DOWN BABL_GO_NEXT_LINE
+ #define B_UP BABL_GO_PREV_LINE
+ #define B_PTOP BABL_GO_PARA_START
+ #define B_PEND BABL_GO_PARA_END
+ #define B_PGDN BABL_PGDN
+ #define B_PGUP BABL_PGUP
+ #define B_DEL BABL_DEL_RIGHT_1C
+ #define B_DLW BABL_DEL_LEFT_WORD
+ #define B_DRW BABL_DEL_RIGHT_WORD
+ #define B_DEOL BABL_DEL_TO_LINE_END // delete from cursor to end of line
+ #define B_DSOL BABL_DEL_TO_LINE_START // delete from cursor to begining line
+ #define B_MODE BABL_MODE //type out name of current mode.
+
+ #define B_UNDO BABL_UNDO
+ #define B_REDO BABL_REDO
+ #define B_CUT BABL_CUT
+ #define B_COPY BABL_COPY
+ #define B_PASTE BABL_PASTE
+ #define B_SELALL BABL_SELECT_ALL
+ #define B_SELA BABL_SELECT_ALL
+ #define B_FIND BABL_FIND
+ #define B_FINDN BABL_FIND_NEXT
+ #define B_FINDP BABL_FIND_PREV
+ #define B_RPLACE BABL_FIND_REPLACE
+ #define B_RUNAPP BABL_RUNAPP
+ #define B_NAPP BABL_SWITCH_APP_NEXT
+ #define B_PAPP BABL_SWITCH_APP_LAST // previous
+ #define B_CAPP BABL_CLOSE_APP
+ #define B_HELP BABL_HELP
+
+ #define B_NTAB BABL_BROWSER_NEW_TAB
+ #define B_CTAB BABL_BROWSER_CLOSE_TAB
+ #define B_ROTB BABL_BROWSER_REOPEN_LAST_TAB
+ #define B_NXTB BABL_BROWSER_NEXT_TAB
+ #define B_PTAB BABL_BROWSER_PREV_TAB
+ #define B_NURL BABL_BROWSER_URL_BAR
+ #define B_BFWD BABL_BROWSER_FORWARD
+ #define B_BBAK BABL_BROWSER_BACK
+ #define B_BFND BABL_BROWSER_FIND
+ #define B_BOOK BABL_BROWSER_BOOKMARK
+ #define B_BDEV BABL_BROWSER_DEV_TOOLS // hard one to remember
+ #define B_BRLD BABL_BROWSER_RELOAD
+ #define B_BFULL BABL_BROWSER_FULLSCREEN
+ #define B_ZIN BABL_BROWSER_ZOOM_IN
+ #define B_ZOUT BABL_BROWSER_ZOOM_OUT
+
+ #define B_PASTV BABL_APP_PASTE_VALUES
+ #define B_CALN BABL_APP_CENTER_ALIGN
+ #define B_CFMT BABL_APP_CLEAR_FORMATTING
+ #define B_SCLA BABL_APP_SCROLL_ACTIVE_CELL
+ #define B_NCEL BABL_NEWLINE_IN_CELL
+ #define B_IPRW BABL_INSERT_ROW_ABOVE
+ #define B_ICOL BABL_INSERT_COL_LEFT
+ #define B_IROW BABL_INSERT_ROW
+ #define B_DROW BABL_DELETE_ROW
+ #define B_SELC BABL_SELECT_COL
+ #define B_SELR BABL_SELECT_ROW
+
+ #define B_MSEL BABL_APP_MULTI_SELECT
+ #define B_VSPLIT BABL_SPLIT_FRAME_VERT
+ #define B_VUNSPT BABL_UNSPLIT_FRAME_VERT
+ #define B_HSPLIT BABL_SPLIT_FRAME_HORIZONTAL
+ #define B_HUNSPT BABL_UNSPLIT_FRAME_HORIZONTAL
+ #define B_NXTFM BABL_NEXT_FRAME
+ #define B_PRVFM BABL_PREV_FRAME
+```
+
+
+## Development FAQs
+
+**Todos**
+eeprom store state of babble_mode? or update docs so that people can change the order of the enum in
+babblespace.h?
+
+**You have huge ifdef stanzas instead of functions**
+This fails gracefully if you don't have all options defined. Patch if you can think how to use fewer defines.
+
+** Why not an array of arrays as a lookup instead of a function?**
+This would allow you to store the lookup table in PROGMEM.
+True, but that takes more pre-processor skill than I have, and may be less portable to ARM or other flash mappings.
+
+** Have you tested every key on every platform?**
+No. Be careful, submit a patch.
+
+** Why not update Apps at the same global level as the OS? **
+This is only a good thing if it doesn't confuse the user. If you can show state of OS vs App, it's probably a good thing.
+
+** Can the OS tell the keyboard what mode to use? **
+The keyboard side is easy to do with virtser_recv & a function that updates babble_mode. It still needs a PC side app to track where the keyboard focus is.
+One could use a keyboard macro to launch an app & switch modes for that app.
+
+## Thanks
+
+Thanks to [wikipedia shortcuts page](https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts)
+and [Jeebak's keymap](https://github.com/qmk/qmk_firmware/blob/master/keyboards/planck/keymaps/jeebak/keymap.c)
+this [howtogeek shortcuts page](https://www.howtogeek.com/115664/42-text-editing-keyboard-shortcuts-that-work-almost-everywhere/)
+And of course QMK...
diff --git a/users/miles2go/babl_chromeos.c b/users/miles2go/babl_chromeos.c
new file mode 100644
index 0000000000..a0c461f24e
--- /dev/null
+++ b/users/miles2go/babl_chromeos.c
@@ -0,0 +1,103 @@
+/* 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.
+
+https://support.google.com/docs/answer/181110?co=GENIE.Platform%3DDesktop&hl=en
+
+*/
+
+#include QMK_KEYBOARD_H
+
+#ifdef USE_BABBLEPASTE
+# include "babblePaste.h"
+
+# ifdef BABL_CHROMEOS
+
+bool babblepaste_chromeos(uint16_t keycode) {
+# ifdef BABL_MOVE
+ BABLM(BABL_GO_LEFT_1C, SS_TAP(X_LEFT));
+ BABLM(BABL_GO_RIGHT_1C, SS_TAP(X_RIGHT));
+ BABLM(BABL_GO_LEFT_WORD, IMCTL(X_LEFT));
+ BABLM(BABL_GO_RIGHT_WORD, IMCTL(X_RIGHT));
+ BABLM(BABL_GO_START_LINE, SS_TAP(X_HOME));
+ BABLM(BABL_GO_END_LINE, SS_TAP(X_END));
+ BABLM(BABL_GO_START_DOC, IMCTL(X_HOME));
+ BABLM(BABL_GO_END_DOC, IMCTL(X_END));
+ BABLM(BABL_GO_NEXT_LINE, SS_TAP(X_DOWN));
+ BABLM(BABL_GO_PREV_LINE, SS_TAP(X_UP));
+ BABLM(BABL_GO_PARA_START, IMCTL(X_UP)); // untested
+ BABLM(BABL_GO_PARA_END, IMCTL(X_DOWN)); // untested
+ BABLM(BABL_PGDN, IMGUI(X_DOWN));
+ BABLM(BABL_PGUP, IMGUI(X_UP));
+ BABLM(BABL_DEL_RIGHT_1C, IMALT(X_BSPACE));
+ BABLM(BABL_DEL_LEFT_WORD, IMCTL(X_BSPACE));
+ BABLM(BABL_DEL_RIGHT_WORD, OMSFT(IMCTL(X_RIGHT)) SS_TAP(X_BSPACE));
+ BABLM(BABL_DEL_TO_LINE_END, OMSFT(IMGUI(X_LEFT)) SS_TAP(X_BSPACE));
+ BABLM(BABL_DEL_TO_LINE_START, OMSFT(IMGUI(X_RIGHT)) SS_TAP(X_BSPACE));
+ BABLM(BABL_MODE, ("ChromeOS "));
+# endif
+# ifdef BABL_OSKEYS
+ BABLM(BABL_UNDO, SS_LCTRL("z"));
+ BABLM(BABL_REDO, OMSFT(IMCTL(X_Z)));
+ BABLM(BABL_CUT, SS_LCTRL("x"));
+ BABLM(BABL_COPY, SS_LCTRL("c"));
+ BABLM(BABL_PASTE, SS_LCTRL("v"));
+ BABLM(BABL_SELECT_ALL, SS_LCTRL("a"));
+ BABLM(BABL_FIND, SS_LCTRL("f"));
+ BABLM(BABL_FIND_NEXT, SS_LCTRL("g"));
+ BABLM(BABL_FIND_PREV, OMSFT(IMCTL(X_G)));
+ BABLM(BABL_WINDOW_NEW, IMCTL(X_N));
+ // BABLM( BABL_FIND_REPLACE, () ); // not part of Chrome
+ // BABLM( BABL_RUNAPP, SS_TAP(X_LGUI) ); // not sure of this
+ BABLM(BABL_SWITCH_APP_NEXT, IMALT(X_TAB));
+ BABLM(BABL_SWITCH_APP_LAST, OMSFT(IMALT(X_TAB)));
+ BABLM(BABL_CLOSE_APP, OMSFT(IMCTL(X_W)));
+ // BABLM( BABL_HELP, OMCTL(IMALT(X_SLASH)) ); // general help
+ BABLM(BABL_HELP, IMCTL(X_SLASH)); // this is keyboard accelerator lookup
+ BABLM(BABL_LOCK, SS_LGUI("l")); // should be caps?
+ BABLM(BABL_SCREENCAPTURE, OMSFT(IMCTL(X_F5)));
+ BABLM(BABL_SWITCH_KEYBOARD_LAYOUT, IMCTL(X_SPACE));
+# endif
+# ifdef BABL_BROWSER
+ BABLM(BABL_BROWSER_NEW_TAB, SS_LCTRL("t"));
+ BABLM(BABL_BROWSER_CLOSE_TAB, SS_LCTRL("w"));
+ BABLM(BABL_BROWSER_REOPEN_LAST_TAB, OMSFT(IMCTL(X_T)));
+ BABLM(BABL_BROWSER_NEXT_TAB, IMCTL(X_TAB));
+ BABLM(BABL_BROWSER_PREV_TAB, OMSFT(IMCTL(X_TAB)));
+ BABLM(BABL_BROWSER_URL_BAR, SS_LCTRL("l"));
+ BABLM(BABL_BROWSER_FORWARD, IMALT(X_RIGHT));
+ BABLM(BABL_BROWSER_BACK, IMALT(X_LEFT));
+ ;
+ BABLM(BABL_BROWSER_FIND, SS_LCTRL("f"));
+ BABLM(BABL_BROWSER_BOOKMARK, SS_LCTRL("d"));
+ BABLM(BABL_BROWSER_DEV_TOOLS, OMSFT(IMCTL(X_I)));
+ BABLM(BABL_BROWSER_RELOAD, OMSFT(IMCTL(X_R))); // hard reload w/o cache
+ BABLM(BABL_BROWSER_FULLSCREEN, SS_TAP(X_F4)); // untested
+ BABLM(BABL_BROWSER_ZOOM_IN, OMSFT(IMCTL(X_EQUAL))); // ctr+ +
+ BABLM(BABL_BROWSER_ZOOM_OUT, IMCTL(X_MINUS));
+ BABLM(BABL_BROWSER_VIEWSRC, SS_LCTRL("u")); // Chrome or firefox
+# endif
+
+# ifdef BABL_APP
+ BABLM(BABL_APP_SAVE, SS_LCTL("s"));
+ //#ifdef BABL_APP_GOOGLE -- we're going to make an assumption.
+ BABLM(BABL_APP_CENTER_ALIGN, OMSFT(IMCTL(X_E)));
+ BABLM(BABL_APP_SCROLL_ACTIVE_CELL, IMCTL(X_BSPACE));
+ BABLM(BABL_NEWLINE_IN_CELL, IMALT(X_ENTER));
+ BABLM(BABL_INSERT_COMMENT, OMALT(IMCTL(X_M)));
+ BABLM(BABL_APP_CLEAR_FORMATTING, IMCTL(X_BSLASH));
+ BABLM(BABL_DELETE_ROW, IMALT(X_E) "d");
+ BABLM(BABL_INSERT_COL_LEFT, IMALT(X_I) "c"); // o for to the right.
+ BABLM(BABL_INSERT_ROW, IMALT(X_I) "w"); // r for above.
+ BABLM(BABL_SELECT_COL, IMCTL(X_SPACE));
+ BABLM(BABL_SELECT_ROW, IMSFT(X_SPACE));
+ BABLM(BABL_DELETE_ROW, OMALT(IMCTL(X_KP_MINUS))); // once selected
+//#endif // BABL_APP_CELLS
+# endif // BABL_APP
+
+ // Todo, ring bell, flash light, show user this isn't supported
+ return false;
+}
+# endif
+#endif /* chromeos*/
diff --git a/users/miles2go/babl_emacs.c b/users/miles2go/babl_emacs.c
new file mode 100644
index 0000000000..201da0d1a3
--- /dev/null
+++ b/users/miles2go/babl_emacs.c
@@ -0,0 +1,85 @@
+/* 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.
+
+Emacs mode is probably most useful for people who don't usually use emacs
+
+https://www.ast.cam.ac.uk/~vasily/idl/emacs_commands_list.html
+*/
+
+#include QMK_KEYBOARD_H
+
+#ifdef USE_BABBLEPASTE
+# include "babblePaste.h"
+
+# ifdef BABL_EMACS
+
+// probably should allow meta to not be ALT
+# define DMETA IMALT
+
+bool babblePaste_emacs(uint16_t keycode) {
+# ifdef BABL_MOVE
+ BABLM(BABL_GO_LEFT_1C, SS_TAP(X_LEFT));
+ BABLM(BABL_GO_RIGHT_1C, SS_TAP(X_RIGHT));
+ BABLM(BABL_GO_LEFT_WORD, IMALT(X_B));
+ BABLM(BABL_GO_RIGHT_WORD, IMALT(X_F));
+ BABLM(BABL_GO_START_LINE, SS_LCTRL("a"));
+ BABLM(BABL_GO_END_LINE, SS_LCTRL("e"));
+ BABLM(BABL_GO_START_DOC, OMALT(IMSFT(X_COMMA)));
+ BABLM(BABL_GO_END_DOC, OMALT(IMSFT(X_DOT)));
+ BABLM(BABL_GO_NEXT_LINE, SS_LCTRL("n"));
+ BABLM(BABL_GO_PREV_LINE, SS_LCTRL("p"));
+ BABLM(BABL_GO_PARA_START, OMALT(IMSFT(X_LBRACKET)));
+ BABLM(BABL_GO_PARA_END, OMALT(IMSFT(X_RBRACKET)));
+ BABLM(BABL_PGDN, SS_LCTRL("v"));
+ BABLM(BABL_PGUP, IMALT(X_V));
+ BABLM(BABL_DEL_RIGHT_1C, SS_LCTRL("d"));
+ BABLM(BABL_DEL_LEFT_WORD, IMCTL(X_BSPACE));
+ BABLM(BABL_DEL_RIGHT_WORD, IMALT(X_D));
+ BABLM(BABL_DEL_TO_LINE_END, SS_LCTRL("k"));
+ BABLM(BABL_DEL_TO_LINE_START, SS_TAP(X_ESCAPE) "0" SS_LCTRL("k"));
+ BABLM(BABL_MODE, "Emacs ");
+# endif
+# ifdef BABL_OSKEYS
+ BABLM(BABL_UNDO, SS_LCTRL("x") "c");
+ BABLM(BABL_REDO, SS_LCTRL("x") "c"); // arguably
+ BABLM(BABL_CUT, SS_LCTRL("w"));
+ BABLM(BABL_COPY, SS_LALT("w")); // really?
+ BABLM(BABL_PASTE, SS_LCTRL("y"));
+ BABLM(BABL_SELECT_ALL, SS_LCTRL("x") "h");
+ BABLM(BABL_FIND, SS_LCTRL("s"));
+ BABLM(BABL_FIND_NEXT, SS_LCTRL("s"));
+ BABLM(BABL_FIND_PREV, SS_LCTRL("r"));
+ BABLM(BABL_FIND_REPLACE, OMALT(IMSFT(X_5)));
+ // BABLM( BABL_RUNAPP , //(SS_LALT("x") "shell") );// arguably
+ BABLM(BABL_RUNAPP, IMALT(X_X) "split-window" SS_TAP(X_ENTER)); // arguably
+ BABLM(BABL_WINDOW_NEXT, SS_LCTRL("x") "o");
+ BABLM(BABL_WINDOW_PREV, SS_LCTRL("x") "o"); // arguably
+ // BABLM( BABL_WINDOW_NEW, IMCTL(X_X)"n" ); //
+ BABLM(BABL_CLOSE_APP, SS_LCTRL("x") "c");
+ BABLM(BABL_HELP, SS_LCTRL("h") "a"); // start search in help
+ // BABLM( BABL_LOCK, () ); // lock buffer? Too many options.
+ // BABLM( BABL_SCREENCAPTURE, () ); // requires plugin?
+
+# endif
+# ifdef BABL_BROWSER
+/* you get to figure w3 out */
+# endif
+
+# ifdef BABL_APP
+ BABLM(BABL_APP_SAVE, SS_LCTL("x") SS_LCTL("s"));
+ /// BABLM( BABL_APP_MULTI_SELECT, SS_LCTRL("x") "rt" ); // arguably
+ BABLM(BABL_SPLIT_FRAME_VERT, SS_LCTRL("x")