aboutsummaryrefslogtreecommitdiffstats
path: root/users/miles2go/babl_readmux.c
blob: 8887d523bb297b68182cf9c3f82aa335d2157853 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// Readline command line editing + tmux windowing
// I haven't decided how much to do readline and how much tmux
// see https://tiswww.case.edu/php/chet/readline/rluserman.html for other possible
// keybindings.

#include QMK_KEYBOARD_H

#ifdef USE_BABBLEPASTE
#    include "babblePaste.h"

#    ifdef BABL_READMUX

// Redefine if you use something other than CTRL-B to activate tmux.
#        define TMUX SS_LCTL("b")

bool babblePaste_readmux(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, SS_LALT("b"));
    BABLM(BABL_GO_RIGHT_WORD, SS_LALT("f"));
    BABLM(BABL_GO_START_LINE, SS_LCTL("a"));
    BABLM(BABL_GO_END_LINE, SS_LCTL("e"));
    // BABLM( BABL_GO_START_DOC		,END );// tmux?
    // BABLM( BABL_GO_END_DOC		,END );  // tmux?
    BABLM(BABL_GO_NEXT_LINE, SS_LCTL("n"));
    BABLM(BABL_GO_PREV_LINE, SS_LCTL("p"));
    // BABLM( BABL_GO_PARA_START,	// undefined
    // BABLM( BABL_GO_PARA_END,	 	// undefinedBABLM( BABL_PGDN ,

    BABLM(BABL_PGUP, SS_TAP(X_PGUP));
    BABLM(BABL_PGDN, SS_TAP(X_PGDOWN));
    BABLM(BABL_DEL_RIGHT_1C, SS_LCTL("d"));
    BABLM(BABL_DEL_LEFT_WORD, SS_LCTL("w"));  // meta-DEL instead?
    BABLM(BABL_DEL_RIGHT_WORD, SS_LALT("d"));
    BABLM(BABL_DEL_TO_LINE_END, SS_LCTL("k"));
    BABLM(BABL_DEL_TO_LINE_START, SS_LCTL("u"));
    BABLM(BABL_MODE, "Readline ");
#        endif
#        ifdef BABL_OSKEYS
    BABLM(BABL_UNDO, SS_LALT("r"));
    BABLM(BABL_REDO, SS_LCTL("x") "c");  // arguably
    BABLM(BABL_CUT, SS_LCTL("k"));       // wrong half the time
    // BABLM( BABL_COPY		,END );
    BABLM(BABL_PASTE, SS_LCTL("y"));
    BABLM(BABL_SELECT_ALL, SS_LCTL("aky"));
    BABLM(BABL_FIND, SS_LCTL("r"));  // search history
    BABLM(BABL_FIND_NEXT, SS_LCTL("r"));
    BABLM(BABL_FIND_PREV, SS_LCTL("s"));
    // BABLM( BABL_FIND_REPLACE		,END ); // not offered in readline
    BABLM(BABL_RUNAPP, TMUX "c");           // tmux
    BABLM(BABL_SWITCH_APP_NEXT, TMUX "n");  // tmux
    BABLM(BABL_SWITCH_APP_LAST, TMUX "p");  // tmux
    BABLM(BABL_CLOSE_APP, TMUX "d");        // usually what I want
    BABLM(BABL_HELP, TMUX IMSFT(X_SLASH));
    BABLM(BABL_LOCK, TMUX "L");  // assuming you set up VLOCK yourself
    BABLM(BABL_SCREENCAPTURE, TMUX ":capture-pane");
#        endif
#        ifdef BABL_BROWSER
/* Add lynx shortcuts, brow.sh?
 */
#            ifdef BABL_MAC
    // this is stock OS X Terminal, alter for windows &etc.
    BABLM(BABL_BROWSER_NEW_TAB, IMGUI(X_T));
    BABLM(BABL_BROWSER_CLOSE_TAB, SS_LGUI("w"));
    BABLM(BABL_BROWSER_NEXT_TAB, IMCTL(X_TAB));
    BABLM(BABL_BROWSER_PREV_TAB, OMSFT(IMCTL(X_TAB)));
#            endif
#        endif
#        ifdef BABL_APP
    // Save makes no sense here
    BABLM(BABL_SPLIT_FRAME_VERT, TMUX IMSFT(X_5));
    // BUG - misleading. This is currently set to convert frame to a window.
    BABLM(BABL_UNSPLIT_FRAME_VERT, TMUX IMSFT(X_1));
    BABLM(BABL_SPLIT_FRAME_HORIZONTAL, TMUX IMSFT(X_QUOTE));
    // This one closes the current pane.
    BABLM(BABL_UNSPLIT_FRAME_HORIZONTAL, SS_LCTL("b") "x");
    BABLM(BABL_NEXT_FRAME, SS_LCTL("b") "o");
    BABLM(BABL_PREV_FRAME, SS_LCTL("w") SS_TAP(X_SCOLON));
#        endif

    // Todo, ring bell, flash light, show user this isn't supported
    return false;
}
#    endif /* readmux*/
#endif