aboutsummaryrefslogtreecommitdiff
path: root/users/miles2go/babl_emacs.c
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/babl_emacs.c
parentcd0edbb1fba91df97be233e30c145f352eda31c0 (diff)
downloadqmk_firmware-803610a284ac886eaeb319b4a8d25ffbd2861152.tar.gz
qmk_firmware-803610a284ac886eaeb319b4a8d25ffbd2861152.zip
[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/babl_emacs.c')
-rw-r--r--users/miles2go/babl_emacs.c85
1 files changed, 85 insertions, 0 deletions
diff --git a/users/miles2go/babl_emacs.c b/users/miles2go/babl_emacs.c
new file mode 100644
index 000000000..201da0d1a
--- /dev/null
+++ b/users/miles2go/babl_emacs.c
@@ -0,0 +1,85 @@
1/* A library to output the right key shortcut in any common app.
2Given a global variable babble_mode to show the environment and a
3key that calls the paste macro, do the right type of paste.
4Setting the context is done by another macro, or TBD interaction with the host.
5
6Emacs mode is probably most useful for people who don't usually use emacs
7
8https://www.ast.cam.ac.uk/~vasily/idl/emacs_commands_list.html
9*/
10
11#include QMK_KEYBOARD_H
12
13#ifdef USE_BABBLEPASTE
14# include "babblePaste.h"
15
16# ifdef BABL_EMACS
17
18// probably should allow meta to not be ALT
19# define DMETA IMALT
20
21bool babblePaste_emacs(uint16_t keycode) {
22# ifdef BABL_MOVE
23 BABLM(BABL_GO_LEFT_1C, SS_TAP(X_LEFT));
24 BABLM(BABL_GO_RIGHT_1C, SS_TAP(X_RIGHT));
25 BABLM(BABL_GO_LEFT_WORD, IMALT(X_B));
26 BABLM(BABL_GO_RIGHT_WORD, IMALT(X_F));
27 BABLM(BABL_GO_START_LINE, SS_LCTRL("a"));
28 BABLM(BABL_GO_END_LINE, SS_LCTRL("e"));
29 BABLM(BABL_GO_START_DOC, OMALT(IMSFT(X_COMMA)));
30 BABLM(BABL_GO_END_DOC, OMALT(IMSFT(X_DOT)));
31 BABLM(BABL_GO_NEXT_LINE, SS_LCTRL("n"));
32 BABLM(BABL_GO_PREV_LINE, SS_LCTRL("p"));
33 BABLM(BABL_GO_PARA_START, OMALT(IMSFT(X_LBRACKET)));
34 BABLM(BABL_GO_PARA_END, OMALT(IMSFT(X_RBRACKET)));
35 BABLM(BABL_PGDN, SS_LCTRL("v"));
36 BABLM(BABL_PGUP, IMALT(X_V));
37 BABLM(BABL_DEL_RIGHT_1C, SS_LCTRL("d"));
38 BABLM(BABL_DEL_LEFT_WORD, IMCTL(X_BSPACE));
39 BABLM(BABL_DEL_RIGHT_WORD, IMALT(X_D));
40 BABLM(BABL_DEL_TO_LINE_END, SS_LCTRL("k"));
41 BABLM(BABL_DEL_TO_LINE_START, SS_TAP(X_ESCAPE) "0" SS_LCTRL("k"));
42 BABLM(BABL_MODE, "Emacs ");
43# endif
44# ifdef BABL_OSKEYS
45 BABLM(BABL_UNDO, SS_LCTRL("x") "c");
46 BABLM(BABL_REDO, SS_LCTRL("x") "c"); // arguably
47 BABLM(BABL_CUT, SS_LCTRL("w"));
48 BABLM(BABL_COPY, SS_LALT("w")); // really?
49 BABLM(BABL_PASTE, SS_LCTRL("y"));
50 BABLM(BABL_SELECT_ALL, SS_LCTRL("x") "h");
51 BABLM(BABL_FIND, SS_LCTRL("s"));
52 BABLM(BABL_FIND_NEXT, SS_LCTRL("s"));
53 BABLM(BABL_FIND_PREV, SS_LCTRL("r"));
54 BABLM(BABL_FIND_REPLACE, OMALT(IMSFT(X_5)));
55 // BABLM( BABL_RUNAPP , //(SS_LALT("x") "shell") );// arguably
56 BABLM(BABL_RUNAPP, IMALT(X_X) "split-window" SS_TAP(X_ENTER)); // arguably
57 BABLM(BABL_WINDOW_NEXT, SS_LCTRL("x") "o");
58 BABLM(BABL_WINDOW_PREV, SS_LCTRL("x") "o"); // arguably
59 // BABLM( BABL_WINDOW_NEW, IMCTL(X_X)"n" ); //
60 BABLM(BABL_CLOSE_APP, SS_LCTRL("x") "c");
61 BABLM(BABL_HELP, SS_LCTRL("h") "a"); // start search in help
62 // BABLM( BABL_LOCK, () ); // lock buffer? Too many options.
63 // BABLM( BABL_SCREENCAPTURE, () ); // requires plugin?
64
65# endif
66# ifdef BABL_BROWSER
67/* you get to figure w3 out */
68# endif
69
70# ifdef BABL_APP
71 BABLM(BABL_APP_SAVE, SS_LCTL("x") SS_LCTL("s"));
72 /// BABLM( BABL_APP_MULTI_SELECT, SS_LCTRL("x") "rt" ); // arguably
73 BABLM(BABL_SPLIT_FRAME_VERT, SS_LCTRL("x") "3");
74 BABLM(BABL_UNSPLIT_FRAME_VERT, SS_LCTRL("u") SS_LCTRL("x") "0");
75 BABLM(BABL_SPLIT_FRAME_HORIZONTAL, SS_LCTRL("x") "2");
76 BABLM(BABL_UNSPLIT_FRAME_HORIZONTAL, SS_LCTRL("u") SS_LCTRL("x") "0");
77 BABLM(BABL_NEXT_FRAME, SS_LCTRL("x") "o");
78 BABLM(BABL_PREV_FRAME, SS_LCTRL("u") "-1" SS_LCTRL("x") "o");
79# endif
80
81 // Todo, ring bell, flash light, show user this isn't supported
82 return false;
83}
84# endif /* emacs mode*/
85#endif