Browse Source

Vim Layout for Ergodox-EZ (mac only) (#2112)

* ignore libs

* Clang complete file

* Add VIM_A, VIM_S, VIM_COMMAND_SHIFT_D, and VIM_COMMAND_SHIFT_A

Add VIM_A, VIM_S, VIM_COMMAND_SHIFT_D, and VIM_COMMAND_SHIFT_A

a s O

* Comment blocks for minimap

generated at
http://patorjk.com/software/taag/#p=display&h=0&v=0&c=c&f=Banner&t=COMMENT

* Be explicit

* More Comment blocks

* Add J

* add A, C, D, J, S, O

* Make h j k l explicitly vim commands (useful for JOIN)

* add cb ce cw ch cj ck cl db de dw dh dj dk dl vb ve vh vj vk vl x ciw diw viw

* debug messages for ci di vi

* Var capitalized

* Save bytes by disabling mouse keys

* Add Y P

* Be more explicit about which key was pressed

* Be more explicit about which key was sent

* Move project to new directory structure

* Remove non-vim layout folder

* Replace KC_TRNS with KC_NO on normal layer

* Insert Mode as default

* Try to prevent crashes

* Put normal mode back

* Revert "ignore libs"

This reverts commit 4c5d7592d6.

* add rules.mk

* Add mouse bindings

* Checkout most recent keymap following rebase

* Realign mouse button keys

* Make a macro for TO(NORMAL_MODE)
pjones-keymap
Benny Powers 1 year ago
parent
commit
98ac32b417

+ 24
- 0
.clang_complete View File

@@ -0,0 +1,24 @@
1
+
2
+-I.
3
+-I./drivers
4
+-I./drivers/avr
5
+-I./keyboards/ergodox_ez
6
+-I./keyboards/ergodox_ez/keymaps/vim
7
+-I./lib
8
+-I./lib/lufa
9
+-I./quantum
10
+-I./quantum/api
11
+-I./quantum/audio
12
+-I./quantum/keymap_extras
13
+-I./quantum/process_keycode
14
+-I./quantum/serial_link
15
+-I./quantum/template
16
+-I./quantum/tools
17
+-I./quantum/visualizer
18
+-I./tmk_core
19
+-I./tmk_core/common
20
+-I./tmk_core/common/debug.h
21
+-I./tmk_core/protocol
22
+-I./tmk_core/protocol/lufa
23
+-I./util
24
+-DQMK_KEYBOARD=\"$(KEYBOARD)\" -DQMK_KEYMAP=\"$(KEYMAP)\"

+ 10
- 0
keyboards/ergodox_ez/keymaps/vim/config.h View File

@@ -0,0 +1,10 @@
1
+#ifndef CONFIG_USER_H
2
+#define CONFIG_USER_H
3
+#endif
4
+
5
+#define NORMAL_MODE 0
6
+#define INSERT_MODE 1
7
+#define SYMB 2
8
+#define MOUSE 3
9
+
10
+#include "../../config.h"

+ 384
- 0
keyboards/ergodox_ez/keymaps/vim/keymap.c View File

@@ -0,0 +1,384 @@
1
+#include QMK_KEYBOARD_H
2
+#include "quantum_keycodes.h"
3
+#include "action_layer.h"
4
+#include "version.h"
5
+#include "vim.h"
6
+
7
+#define VERSION_STRING QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION
8
+#define _______ KC_TRNS
9
+#define X_____X KC_TRNS
10
+#define KC_ATM LGUI(LSFT(KC_P))
11
+#define KC_ATP LGUI(LCTL(KC_P))
12
+#define TO_NORM TO(NORMAL_MODE)
13
+
14
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
15
+
16
+  /* Normal mode
17
+  *
18
+  * ,--------------------------------------------------.           ,--------------------------------------------------.
19
+  * |        |      |      |      |      |      |      |           |      |      |      |      |      |      |        |
20
+  * |--------+------+------+------+------+-------------|           |------+------+------+------+------+------+--------|
21
+  * |  TAB   |      | WORD |  END |      |      |      |           |      | YANK | UNDO |      | OPEN |  PUT |        |
22
+  * |--------+------+------+------+------+------|      |           |      |------+------+------+------+------+--------|
23
+  * |    ⎋   |      |      |  DEL |      |      |------|           |------|  ←   |  ↓   |  ↑   |  →   |      |    ⎋   |
24
+  * |--------+------+------+------+------+------|      |           |      |------+------+------+------+------+--------|
25
+  * | SHIFT  |      |      |      |VISUAL| BACK |      |           |      |      |      |      |      |      | SHIFT  |
26
+  * `--------+------+------+------+------+-------------'           `-------------+------+------+------+------+--------'
27
+  *   |      |      |      |      |      |                                       |      |      |      |      |      |
28
+  *   `----------------------------------'                                       `----------------------------------'
29
+  *                                        ,-------------.       ,-------------.
30
+  *                                        |      |      |       |      |      |
31
+  *                                 ,------|------|------|       |------+------+------.
32
+  *                                 |      |      |      |       |      |      |      |
33
+  *                                 |SPACE |DELETE|------|       |------|ENTER |BACKSP|
34
+  *                                 |      |      |      |       |      |      |      |
35
+  *                                 `--------------------'       `--------------------'
36
+  */
37
+  [NORMAL_MODE] = KEYMAP(
38
+    // Layer 2 Left Hand
39
+    X_____X,X_____X,X_____X,X_____X,X_____X,X_____X,X_____X,
40
+    KC_TAB ,X_____X,VIM_W,  VIM_E  ,X_____X,X_____X,X_____X,
41
+    X_____X,VIM_A  ,VIM_S  ,VIM_D  ,X_____X,X_____X,
42
+    KC_LSFT,X_____X,VIM_X  ,VIM_C  ,VIM_V  ,VIM_B  ,X_____X,
43
+    KC_LCTL,KC_LALT,X_____X,X_____X,X_____X,
44
+
45
+                                            KC_HOME,KC_END ,
46
+                                            TO(SYMB),
47
+                                            GUI_T(KC_SPC),  KC_ESC ,_______,
48
+
49
+
50
+    // Layer 2 Right Hand
51
+                              X_____X,X_____X,X_____X,X_____X,X_____X,X_____X,X_____X,
52
+                              X_____X,VIM_Y  ,VIM_U  ,VIM_I  ,VIM_O  ,VIM_P  ,X_____X,
53
+                                      VIM_H  ,VIM_J  ,VIM_K  ,VIM_L  ,X_____X,X_____X,
54
+                              X_____X,X_____X,X_____X,X_____X,X_____X,X_____X,KC_LSFT,
55
+                                              X_____X,X_____X,X_____X,KC_RALT,KC_RCTL,
56
+
57
+    KC_PGUP,  KC_PGDN,
58
+    TO(SYMB),
59
+    KC_DEL , KC_ENT, GUI_T(KC_BSPC)
60
+),
61
+
62
+  /* Insert mode
63
+  *
64
+  * ,--------------------------------------------------.           ,--------------------------------------------------.
65
+  * | NORMAL |   1  |   2  |   3  |   4  |   5  | ⇧⌘P  |           | PROJ |   6  |   7  |   8  |   9  |   0  |   -    |
66
+  * |--------+------+------+------+------+-------------|           |------+------+------+------+------+------+--------|
67
+  * |    ⇥   |   Q  |   W  |   E  |   R  |   T  |  `   |           |   -  |   Y  |   U  |   I  |   O  |   P  |   \    |
68
+  * |--------+------+------+------+------+------|      |           |      |------+------+------+------+------+--------|
69
+  * |    ⎋   |   A  |   S  |   D  |   F  |   G  |------|           |------|   H  |   J  |   K  |   L  |   ;  |   '    |
70
+  * |--------+------+------+------+------+------|   =  |           |   +  |------+------+------+------+------+--------|
71
+  * |   L⇧   |   Z  |   X  |   C  |   V  |   B  |      |           |      |   N  |   M  |   ,  |   .  |   /  |   R⇧   |
72
+  * `--------+------+------+------+------+-------------'           `-------------+------+------+------+------+--------'
73
+  *   |  ⌃  |   ⌥  |  (   |  [   |   {  |                                       |  }   |  ]   |   )  |   ⌥   |   ⌃  |
74
+  *   `----------------------------------'                                       `----------------------------------'
75
+  *                                        ,-------------.       ,-------------.
76
+  *                                        | HOME | END  |       | PGDN | PGUP |
77
+  *                                 ,------|------|------|       |------+------+------.
78
+  *                                 |SPACE |      |      |       |      |      | BSPC |
79
+  *                                 |      |NORMAL|------|       |------| ENTER|      |
80
+  *                                 |   ⌘  |      |      |       |      |      |   ⌘  |
81
+  *                                 `--------------------'       `--------------------'
82
+  */
83
+  [INSERT_MODE] = KEYMAP(
84
+    // Left Hand
85
+    NOR_MOD,KC_1,   KC_2,   KC_3,    KC_4,   KC_5, KC_ATM,
86
+    KC_TAB ,KC_Q,   KC_W,   KC_E,    KC_R,   KC_T, KC_GRV,
87
+    KC_ESC ,KC_A,   KC_S,   KC_D,    KC_F,   KC_G,
88
+    KC_LSFT,KC_Z,   KC_X,   KC_C,    KC_V,   KC_B, KC_EQL,
89
+    KC_LCTL,KC_LALT,KC_LPRN,KC_LBRC, KC_LCBR,
90
+
91
+                                            KC_HOME,KC_END ,
92
+                                            TO(SYMB),
93
+                                            GUI_T(KC_SPC),KC_ESC ,TO_NORM,
94
+
95
+
96
+    // Right Hand
97
+                              KC_ATP , KC_6, KC_7,   KC_8,    KC_9,   KC_0,   KC_MINS,
98
+                              KC_MINS, KC_Y, KC_U,   KC_I,    KC_O,   KC_P,   KC_BSLS,
99
+                                       KC_H, KC_J,   KC_K,    KC_L,   KC_SCLN,KC_QUOT,
100
+                              KC_PLUS, KC_N, KC_M,   KC_COMM, KC_DOT, KC_SLSH,KC_RSFT,
101
+                                             KC_RCBR,KC_RBRC, KC_RPRN,KC_RALT,KC_RCTL,
102
+
103
+    KC_PGUP,  KC_PGDN,
104
+    TO(SYMB),
105
+    MO(MOUSE) , KC_ENT, GUI_T(KC_BSPC)
106
+  ),
107
+
108
+  [SYMB] = KEYMAP(
109
+    // Left Hand
110
+    NOR_MOD,KC_1,   KC_2,   KC_3,    KC_4,   KC_5, KC_ATM,
111
+    KC_TAB ,KC_Q,   KC_W,   KC_E,    KC_R,   KC_T, KC_GRV,
112
+    _______,KC_A,   KC_S,   KC_D,    KC_F,   KC_G,
113
+    KC_LSFT,KC_Z,   KC_X,   KC_C,    KC_V,   KC_B, KC_EQL,
114
+    KC_LCTL,KC_LALT,KC_LPRN,KC_LBRC, KC_LCBR,
115
+
116
+                                                                _______,_______,
117
+                                                                        _______,
118
+                                                        _______,_______,TO_NORM,
119
+
120
+    // Right Hand
121
+                              KC_ATP , KC_6, KC_7,   KC_8,    KC_9,   KC_0,   KC_MINS,
122
+                              KC_MINS, KC_Y, KC_U,   KC_I,    KC_O,   KC_P,   KC_BSLS,
123
+                                       KC_H, KC_J,   KC_K,    KC_L,   KC_SCLN,KC_QUOT,
124
+                              KC_PLUS, KC_N, KC_M,   KC_COMM, KC_DOT, KC_SLSH,KC_RSFT,
125
+                                             KC_RCBR,KC_RBRC, KC_RPRN,KC_RALT,KC_RCTL,
126
+
127
+    _______,_______,
128
+    _______,
129
+    _______,_______,_______
130
+  ),
131
+
132
+  [MOUSE] = KEYMAP(
133
+    // Left Hand
134
+    _______,_______,_______,_______,_______,_______,_______,
135
+    _______,_______,_______,_______,_______,_______,_______,
136
+    _______,_______,_______,_______,_______,_______,
137
+    _______,_______,_______,_______,_______,_______,_______,
138
+    _______,_______,_______,_______,_______,
139
+
140
+                                                                _______,_______,
141
+                                                                        _______,
142
+                                                        _______,_______,_______,
143
+
144
+    // Right Hand
145
+                              _______,_______,_______,_______,_______,_______,_______,
146
+                              _______,_______,KC_BTN1,KC_BTN3,KC_BTN2,_______,_______,
147
+                                      KC_MS_L,KC_MS_D,KC_MS_U,KC_MS_R,_______,_______,
148
+                              _______,_______,_______,_______,_______,_______,_______,
149
+                                              _______,_______,_______,_______,_______,
150
+
151
+    _______,_______,
152
+    _______,
153
+    _______,_______,_______
154
+  ),
155
+};
156
+
157
+const uint16_t PROGMEM fn_actions[] = {
158
+  [1] = ACTION_LAYER_TAP_TOGGLE(1)
159
+};
160
+
161
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
162
+  switch(id) {
163
+    case 0:
164
+        if (record->event.pressed) { SEND_STRING (VERSION_STRING); }
165
+        break;
166
+  }
167
+return MACRO_NONE;
168
+};
169
+
170
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
171
+  bool SHIFTED = (keyboard_report->mods & MOD_BIT(KC_LSFT)) |
172
+                 (keyboard_report->mods & MOD_BIT(KC_RSFT));
173
+
174
+  switch (keycode) {
175
+
176
+    case VIM_A:
177
+      if (record->event.pressed) { SHIFTED ? VIM_APPEND_LINE() : VIM_APPEND(); }
178
+      return false;
179
+
180
+    case VIM_B:
181
+      if (record->event.pressed) {
182
+        switch(VIM_QUEUE) {
183
+          case KC_NO: VIM_BACK(); break;
184
+          case VIM_C: VIM_CHANGE_BACK(); break;
185
+          case VIM_D: VIM_DELETE_BACK(); break;
186
+          case VIM_V: VIM_VISUAL_BACK(); break;
187
+        }
188
+      }
189
+      return false;
190
+
191
+    case VIM_C:
192
+      if (record->event.pressed) {
193
+        switch(VIM_QUEUE) {
194
+          case KC_NO: SHIFTED ? VIM_CHANGE_LINE() : VIM_LEADER(VIM_C); break;
195
+          case VIM_C: VIM_CHANGE_WHOLE_LINE(); break;
196
+        }
197
+      }
198
+      return false;
199
+
200
+    case VIM_D:
201
+      if (record->event.pressed) {
202
+        switch(VIM_QUEUE) {
203
+          case KC_NO: SHIFTED ? VIM_DELETE_LINE() : VIM_LEADER(VIM_D); break;
204
+          case VIM_D: VIM_DELETE_WHOLE_LINE(); break;
205
+        }
206
+      }
207
+      return false;
208
+
209
+    case VIM_E:
210
+      if (record->event.pressed) {
211
+        switch (VIM_QUEUE) {
212
+          case KC_NO: VIM_END(); break;
213
+          case VIM_C: VIM_CHANGE_END(); break;
214
+          case VIM_D: VIM_DELETE_END(); break;
215
+          case VIM_V: VIM_VISUAL_END(); break;
216
+        }
217
+      }
218
+      return false;
219
+
220
+    case VIM_H:
221
+      if (record->event.pressed) {
222
+        switch (VIM_QUEUE) {
223
+          case KC_NO: VIM_LEFT(); break;
224
+          case VIM_C: VIM_CHANGE_LEFT(); break;
225
+          case VIM_D: VIM_DELETE_LEFT(); break;
226
+          case VIM_V: VIM_VISUAL_LEFT(); break;
227
+        }
228
+      }
229
+      return false;
230
+
231
+    case VIM_I:
232
+      if (record->event.pressed) {
233
+        switch (VIM_QUEUE) {
234
+          case KC_NO: layer_on(INSERT_MODE); break;
235
+          case VIM_C: VIM_LEADER(VIM_CI); break;
236
+          case VIM_D: VIM_LEADER(VIM_DI); break;
237
+          case VIM_V: VIM_LEADER(VIM_VI); break;
238
+        }
239
+      }
240
+      return false;
241
+
242
+    case VIM_J:
243
+      if (record->event.pressed) {
244
+        switch (VIM_QUEUE) {
245
+          case KC_NO: SHIFTED ? VIM_JOIN() : VIM_DOWN(); break;
246
+          case VIM_C: VIM_CHANGE_DOWN(); break;
247
+          case VIM_D: VIM_DELETE_DOWN(); break;
248
+          case VIM_V: VIM_VISUAL_DOWN(); break;
249
+        }
250
+      }
251
+      return false;
252
+
253
+    case VIM_K:
254
+      if (record->event.pressed) {
255
+        switch (VIM_QUEUE) {
256
+          case KC_NO: VIM_UP(); break;
257
+          case VIM_C: VIM_CHANGE_UP(); break;
258
+          case VIM_D: VIM_DELETE_UP(); break;
259
+          case VIM_V: VIM_VISUAL_UP(); break;
260
+        }
261
+      }
262
+      return false;
263
+
264
+    case VIM_L:
265
+      if (record->event.pressed) {
266
+        switch (VIM_QUEUE) {
267
+          case KC_NO: VIM_RIGHT(); break;
268
+          case VIM_C: VIM_CHANGE_RIGHT(); break;
269
+          case VIM_D: VIM_DELETE_RIGHT(); break;
270
+          case VIM_V: VIM_VISUAL_RIGHT(); break;
271
+        }
272
+      }
273
+      return false;
274
+
275
+    case VIM_O:
276
+      if (record->event.pressed) { SHIFTED ? VIM_OPEN_ABOVE() : VIM_OPEN(); }
277
+      return false;
278
+
279
+    case VIM_P:
280
+      if (record->event.pressed) { SHIFTED ? VIM_PUT_BEFORE() : VIM_PUT(); }
281
+      return false;
282
+
283
+    case VIM_S:
284
+      if (record->event.pressed) { SHIFTED ? VIM_CHANGE_WHOLE_LINE() : VIM_SUBSTITUTE(); }
285
+      return false;
286
+
287
+    case VIM_U:
288
+      if (record->event.pressed) { VIM_UNDO(); }
289
+      return false;
290
+
291
+    case VIM_V:
292
+      if (record->event.pressed) { VIM_LEADER(VIM_V); }
293
+      return false;
294
+
295
+    case VIM_W:
296
+      if (record->event.pressed) {
297
+        switch (VIM_QUEUE) {
298
+          case KC_NO: VIM_WORD(); break;
299
+          case VIM_C: VIM_CHANGE_WORD(); break;
300
+          case VIM_CI: VIM_CHANGE_INNER_WORD(); break;
301
+          case VIM_D: VIM_DELETE_WORD(); break;
302
+          case VIM_DI: VIM_DELETE_INNER_WORD(); break;
303
+          case VIM_V: VIM_VISUAL_WORD(); break;
304
+          case VIM_VI: VIM_VISUAL_INNER_WORD(); break;
305
+        }
306
+      }
307
+      return false;
308
+
309
+    case VIM_X:
310
+      if (record->event.pressed) { VIM_CUT(); }
311
+      return false;
312
+
313
+    case VIM_Y:
314
+      if (record->event.pressed) { SHIFTED ? VIM_YANK_LINE() : VIM_YANK(); }
315
+      return false;
316
+
317
+    // dynamically generate these.
318
+    case EPRM:
319
+      if (record->event.pressed) { eeconfig_init(); }
320
+      return false;
321
+    case VRSN:
322
+      if (record->event.pressed) { SEND_STRING(VERSION_STRING); }
323
+      return false;
324
+    case RGB_SLD:
325
+      if (record->event.pressed) { rgblight_mode(1); }
326
+      return false;
327
+  }
328
+
329
+  // End by clearing the queue unless keycode is a
330
+  // if ((record->event.pressed) &&
331
+  //     (keycode != VIM_I ||
332
+  //     keycode != VIM_C ||
333
+  //     keycode != VIM_D ||
334
+  //     keycode != VIM_V)) {
335
+  //   VIM_LEADER(KC_NO);
336
+  // }
337
+
338
+  return true;
339
+};
340
+
341
+void matrix_init_user(void) {
342
+  debug_enable = true;
343
+  VIM_LEADER(KC_NO);
344
+};
345
+
346
+void matrix_scan_user(void) {
347
+    uint8_t layer = biton32(layer_state);
348
+
349
+    ergodox_board_led_off();
350
+    ergodox_right_led_1_off();
351
+    ergodox_right_led_2_off();
352
+    ergodox_right_led_3_off();
353
+    switch (layer) {
354
+        case 1:
355
+            ergodox_right_led_1_on();
356
+            break;
357
+        case 2:
358
+            ergodox_right_led_2_on();
359
+            break;
360
+        case 3:
361
+            ergodox_right_led_3_on();
362
+            break;
363
+        case 4:
364
+            ergodox_right_led_1_on();
365
+            ergodox_right_led_2_on();
366
+            break;
367
+        case 5:
368
+            ergodox_right_led_1_on();
369
+            ergodox_right_led_3_on();
370
+            break;
371
+        case 6:
372
+            ergodox_right_led_2_on();
373
+            ergodox_right_led_3_on();
374
+            break;
375
+        case 7:
376
+            ergodox_right_led_1_on();
377
+            ergodox_right_led_2_on();
378
+            ergodox_right_led_3_on();
379
+            break;
380
+        default:
381
+            break;
382
+    }
383
+
384
+};

+ 5
- 0
keyboards/ergodox_ez/keymaps/vim/readme.md View File

@@ -0,0 +1,5 @@
1
+# Vim-like keymap for macOS
2
+
3
+This keymap adds vim emulation to the keyboard firmware. Layer 0 is 'normal mode', providing a number of commands like `w`, `e`, `a`, `dw`, etc.
4
+
5
+The keymap works by using macOS text-editing shortcuts, so currently it only chooches on macOS.

+ 1
- 0
keyboards/ergodox_ez/keymaps/vim/rules.mk View File

@@ -0,0 +1 @@
1
+MOUSEKEY_ENABLE = yes

+ 756
- 0
keyboards/ergodox_ez/keymaps/vim/vim.h View File

@@ -0,0 +1,756 @@
1
+#include "config.h"
2
+#include "print.h"
3
+#include "keycode.h"
4
+#include "quantum.h"
5
+#include "quantum_keycodes.h"
6
+
7
+#define NOR_MOD TO(NORMAL_MODE)
8
+#define INS_MOD TO(INSERT_MODE)
9
+
10
+#define PRESS(keycode) register_code16(keycode)
11
+#define RELEASE(keycode) unregister_code16(keycode)
12
+#define PREVENT_STUCK_MODIFIERS
13
+
14
+uint16_t VIM_QUEUE = KC_NO;
15
+
16
+enum custom_keycodes {
17
+  PLACEHOLDER = SAFE_RANGE, // can always be here
18
+  VIM_A,
19
+  VIM_B,
20
+  VIM_C,
21
+  VIM_CI,
22
+  VIM_D,
23
+  VIM_DI,
24
+  VIM_E,
25
+  VIM_H,
26
+  VIM_I,
27
+  VIM_J,
28
+  VIM_K,
29
+  VIM_L,
30
+  VIM_O,
31
+  VIM_P,
32
+  VIM_S,
33
+  VIM_U,
34
+  VIM_V,
35
+  VIM_VI,
36
+  VIM_W,
37
+  VIM_X,
38
+  VIM_Y,
39
+  EPRM,
40
+  VRSN,
41
+  RGB_SLD,
42
+};
43
+
44
+void VIM_APPEND(void);
45
+void VIM_APPEND_LINE(void);
46
+void VIM_BACK(void);
47
+void VIM_CHANGE_BACK(void);
48
+void VIM_CHANGE_DOWN(void);
49
+void VIM_CHANGE_END(void);
50
+void VIM_CHANGE_INNER_WORD(void);
51
+void VIM_CHANGE_LEFT(void);
52
+void VIM_CHANGE_LINE(void);
53
+void VIM_CHANGE_RIGHT(void);
54
+void VIM_CHANGE_UP(void);
55
+void VIM_CHANGE_WHOLE_LINE(void);
56
+void VIM_CHANGE_WORD(void);
57
+void VIM_CUT(void);
58
+void VIM_DELETE_BACK(void);
59
+void VIM_DELETE_DOWN(void);
60
+void VIM_DELETE_END(void);
61
+void VIM_DELETE_INNER_WORD(void);
62
+void VIM_DELETE_LEFT(void);
63
+void VIM_DELETE_LINE(void);
64
+void VIM_DELETE_RIGHT(void);
65
+void VIM_DELETE_UP(void);
66
+void VIM_DELETE_WHOLE_LINE(void);
67
+void VIM_DELETE_WORD(void);
68
+void VIM_END(void);
69
+void VIM_JOIN(void);
70
+void VIM_OPEN(void);
71
+void VIM_OPEN_ABOVE(void);
72
+void VIM_PUT(void);
73
+void VIM_SUBSTITUTE(void);
74
+void VIM_UNDO(void);
75
+void VIM_VISUAL_BACK(void);
76
+void VIM_VISUAL_DOWN(void);
77
+void VIM_VISUAL_END(void);
78
+void VIM_VISUAL_INNER_WORD(void);
79
+void VIM_VISUAL_LEFT(void);
80
+void VIM_VISUAL_RIGHT(void);
81
+void VIM_VISUAL_UP(void);
82
+void VIM_VISUAL_WORD(void);
83
+void VIM_WORD(void);
84
+void VIM_YANK(void);
85
+
86
+void TAP(uint16_t keycode) {
87
+    PRESS(keycode);
88
+    RELEASE(keycode);
89
+}
90
+
91
+void CMD(uint16_t keycode) {
92
+  PRESS(KC_LGUI);
93
+    TAP(keycode);
94
+  RELEASE(KC_LGUI);
95
+}
96
+
97
+void CTRL(uint16_t keycode) {
98
+  PRESS(KC_LCTRL);
99
+    TAP(keycode);
100
+  RELEASE(KC_LCTRL);
101
+}
102
+
103
+void SHIFT(uint16_t keycode) {
104
+  PRESS(KC_LSHIFT);
105
+    TAP(keycode);
106
+  RELEASE(KC_LSHIFT);
107
+}
108
+
109
+void ALT(uint16_t keycode) {
110
+  PRESS(KC_LALT);
111
+    TAP(keycode);
112
+  RELEASE(KC_LALT);
113
+}
114
+
115
+/**
116
+ * Sets the `VIM_QUEUE` variable to the incoming keycode.
117
+ * Pass `KC_NO` to cancel the operation.
118
+ * @param keycode
119
+ */
120
+void VIM_LEADER(uint16_t keycode) {
121
+  VIM_QUEUE = keycode;
122
+  switch(keycode) {
123
+    case VIM_C: print("\e[32mc\e[0m"); break;
124
+    case VIM_CI: print("\e[32mi\e[0m"); break;
125
+    case VIM_D: print("\e[32md\e[0m"); break;
126
+    case VIM_DI: print("\e[32mi\e[0m"); break;
127
+    case VIM_V: print("\e[32mv\e[0m"); break;
128
+    case VIM_VI: print("\e[32mi\e[0m"); break;
129
+    case KC_NO: print("❎"); break;
130
+  }
131
+}
132
+
133
+/***
134
+ *     #######  #     #  #######       #####   #     #  #######  #######
135
+ *     #     #  ##    #  #            #     #  #     #  #     #     #
136
+ *     #     #  # #   #  #            #        #     #  #     #     #
137
+ *     #     #  #  #  #  #####         #####   #######  #     #     #
138
+ *     #     #  #   # #  #                  #  #     #  #     #     #
139
+ *     #     #  #    ##  #            #     #  #     #  #     #     #
140
+ *     #######  #     #  #######       #####   #     #  #######     #
141
+ *
142
+ */
143
+
144
+/**
145
+ * Vim-like `append` command.
146
+ * Works by sending →.
147
+ */
148
+void VIM_APPEND(void) {
149
+  print("\e[31ma\e[0m");
150
+  TAP(KC_RIGHT);
151
+  layer_on(INSERT_MODE);
152
+}
153
+
154
+/**
155
+ * Vim-like `back` command
156
+ * Simulates vim's `b` command by sending ⌥←
157
+ */
158
+void VIM_BACK(void) {
159
+  print("\e[31mb\e[0m");
160
+  ALT(KC_LEFT);
161
+}
162
+
163
+/**
164
+ * Vim-like `cut` command
165
+ * Simulates vim's `x` command by sending ⇧→ then ⌘X.
166
+ */
167
+void VIM_CUT(void) {
168
+  print("\e[31mx\e[0m");
169
+  SHIFT(KC_RIGHT);
170
+  CMD(KC_X);
171
+}
172
+
173
+/**
174
+ * Vim-like `down` command
175
+ * Sends ↓
176
+ */
177
+void VIM_DOWN(void) {
178
+  print("\e[31mj\e[0m");
179
+  TAP(KC_DOWN);
180
+}
181
+
182
+/**
183
+ * Vim-like `end` command
184
+ * Simulates vim's `e` command by sending ⌥→
185
+ */
186
+void VIM_END(void) {
187
+  print("\e[31me\e[0m");
188
+  ALT(KC_RIGHT);
189
+}
190
+
191
+/**
192
+ * Vim-like `left` command
193
+ * Sends ←
194
+ */
195
+void VIM_LEFT(void) {
196
+  print("\e[31mh\e[0m");
197
+  VIM_LEADER(KC_NO);
198
+  TAP(KC_LEFT);
199
+}
200
+
201
+/**
202
+ * Vim-like `open` command.
203
+ * Works by sending ⌘→ to move to the end of the line, `enter` to open a new line,
204
+ * then switching to insert mode.
205
+ */
206
+void VIM_OPEN(void) {
207
+  print("\e[31mo\e[0m");
208
+  VIM_LEADER(KC_NO);
209
+  CMD(KC_RIGHT);
210
+  TAP(KC_ENTER);
211
+  layer_on(INSERT_MODE);
212
+}
213
+
214
+/**
215
+ * Vim-like `put` command
216
+ * Simulates vim's `p` command by sending ⌘V
217
+ */
218
+void VIM_PUT(void) {
219
+  print("\e[31mp\e[0m");
220
+  VIM_LEADER(KC_NO);
221
+  CMD(KC_V);
222
+}
223
+
224
+/**
225
+ * Vim-like `put before` command
226
+ * Simulates vim's `P` command by sending ↑, ⌘←, then ⌘V
227
+ */
228
+void VIM_PUT_BEFORE(void) {
229
+  print("\e[31mP\e[0m");
230
+  VIM_LEADER(KC_NO);
231
+  TAP(KC_UP);
232
+  CMD(KC_LEFT);
233
+  CMD(KC_V);
234
+}
235
+
236
+/**
237
+ * Vim-like `right` command
238
+ * Sends →
239
+ */
240
+void VIM_RIGHT(void) {
241
+  print("\e[31ml\e[0m");
242
+  VIM_LEADER(KC_NO);
243
+  TAP(KC_RIGHT);
244
+}
245
+
246
+/**
247
+ * Vim-like `substitute` command
248
+ * Simulates vim's `s` command by sending ⇧→ to select the next character, then
249
+ * ⌘X to cut it, then entering insert mode.
250
+ */
251
+void VIM_SUBSTITUTE(void) {
252
+  print("\e[31ms\e[0m");
253
+  VIM_LEADER(KC_NO);
254
+  SHIFT(KC_RIGHT);
255
+  CMD(KC_X);
256
+  layer_on(INSERT_MODE);
257
+}
258
+
259
+/**
260
+ * Vim-like `undo` command
261
+ * Simulates vim's `u` command by sending ⌘Z
262
+ */
263
+void VIM_UNDO(void) {
264
+  print("\e[31mu\e[0m");
265
+  VIM_LEADER(KC_NO);
266
+  CMD(KC_Z);
267
+}
268
+
269
+/**
270
+ * Vim-like `up` command
271
+ * Sends ↑
272
+ */
273
+void VIM_UP(void) {
274
+  print("\e[31mk\e[0m");
275
+  VIM_LEADER(KC_NO);
276
+  TAP(KC_UP);
277
+}
278
+
279
+/**
280
+ * Vim-like `word` command
281
+ * Simulates vim's `w` command by moving the cursor first to the
282
+ * end of the current word, then to the end of the next word,
283
+ * then to the beginning of that word.
284
+ */
285
+void VIM_WORD(void) {
286
+  print("\e[31mw\e[0m");
287
+  VIM_LEADER(KC_NO);
288
+  PRESS(KC_LALT);
289
+    TAP(KC_RIGHT);
290
+    TAP(KC_RIGHT);
291
+    TAP(KC_LEFT);
292
+  RELEASE(KC_LALT);
293
+}
294
+
295
+/**
296
+ * Vim-like `yank` command
297
+ * Simulates vim's `y` command by sending ⌘C
298
+ */
299
+void VIM_YANK(void) {
300
+  print("\e[31my\e[0m");
301
+  VIM_LEADER(KC_NO);
302
+  CMD(KC_C);
303
+}
304
+
305
+/**
306
+ * Vim-like `yank line` command
307
+ * Simulates vim's `y` command by sending ⌘← then ⇧⌘→ then ⌘C
308
+ */
309
+void VIM_YANK_LINE(void) {
310
+  print("\e[31mY\e[0m");
311
+  VIM_LEADER(KC_NO);
312
+  CMD(KC_LEFT);
313
+  PRESS(KC_LSHIFT);
314
+    CMD(KC_RIGHT);
315
+  RELEASE(KC_LSHIFT);
316
+  CMD(KC_C);
317
+}
318
+
319
+/***
320
+ *      #####   #     #  ###  #######  #######  #######  ######
321
+ *     #     #  #     #   #   #           #     #        #     #
322
+ *     #        #     #   #   #           #     #        #     #
323
+ *      #####   #######   #   #####       #     #####    #     #
324
+ *           #  #     #   #   #           #     #        #     #
325
+ *     #     #  #     #   #   #           #     #        #     #
326
+ *      #####   #     #  ###  #           #     #######  ######
327
+ *
328
+ */
329
+
330
+/**
331
+ * Vim-like `append to line` command
332
+ * Simulates vim's `A` command by sending ⌘→ then switching to insert mode.
333
+ */
334
+void VIM_APPEND_LINE(void) {
335
+  print("\e[31mA\e[0m");
336
+  VIM_LEADER(KC_NO);
337
+  CMD(KC_RIGHT);
338
+  layer_on(INSERT_MODE);
339
+}
340
+
341
+/**
342
+ * Vim-like `change line` command
343
+ * Simulates vim's `C` command by sending ⌃K then switching to insert mode.
344
+ */
345
+void VIM_CHANGE_LINE(void) {
346
+  print("\e[31mC\e[0m");
347
+  VIM_LEADER(KC_NO);
348
+  VIM_DELETE_LINE();
349
+  layer_on(INSERT_MODE);
350
+}
351
+
352
+/**
353
+ * Vim-like 'delete line' command
354
+ * Simulates vim's `D` command by sending ⌃K to kill the line
355
+ */
356
+void VIM_DELETE_LINE(void) {
357
+  print("\e[31mD\e[0m");
358
+  VIM_LEADER(KC_NO);
359
+  CTRL(KC_K);
360
+}
361
+
362
+/**
363
+ * Vim-like 'join lines' command
364
+ * Simulates vim's `J` command by sending ⌘→ to go to the end of the line, then
365
+ * DELETE to join the lines
366
+ */
367
+void VIM_JOIN(void) {
368
+  print("\e[31mJ\e[0m");
369
+  VIM_LEADER(KC_NO);
370
+  CMD(KC_RIGHT);
371
+  TAP(KC_DELETE);
372
+  VIM_LEADER(KC_NO);
373
+}
374
+
375
+/**
376
+ * Vim-like 'open above' command
377
+ * Simulates vim's `O` command by sending ⌘→ to go to the start of the line,
378
+ * enter to move the line down, ↑ to move up to the new line, then switching to
379
+ * insert mode.
380
+ */
381
+void VIM_OPEN_ABOVE(void) {
382
+  print("\e[31mO\e[0m");
383
+  VIM_LEADER(KC_NO);
384
+  CMD(KC_LEFT);
385
+  TAP(KC_ENTER);
386
+  TAP(KC_UP);
387
+  layer_on(INSERT_MODE);
388
+}
389
+
390
+/**
391
+ * Vim-like 'change whole line' command
392
+ * Simulates vim's `S` `cc` or `c$` commands by sending ⌘← to go to the start of the line,
393
+ * ⌃K to kill the line, then switching to insert mode.
394
+ */
395
+void VIM_CHANGE_WHOLE_LINE(void) {
396
+  print("\e[31mS\e[0m");
397
+  VIM_LEADER(KC_NO);
398
+  CMD(KC_LEFT);
399
+  VIM_CHANGE_LINE();
400
+}
401
+
402
+/***
403
+ *     ######       ######   ######   #######  #######  ###  #     #  #######  ######
404
+ *     #     #      #     #  #     #  #        #         #    #   #   #        #     #
405
+ *     #     #      #     #  #     #  #        #         #     # #    #        #     #
406
+ *     #     #      ######   ######   #####    #####     #      #     #####    #     #
407
+ *     #     #      #        #   #    #        #         #     # #    #        #     #
408
+ *     #     #      #        #    #   #        #         #    #   #   #        #     #
409
+ *     ######       #        #     #  #######  #        ###  #     #  #######  ######
410
+ *
411
+ */
412
+
413
+/**
414
+ * Vim-like `delete to end` command
415
+ * Simulates vim's `de` command by sending ⌥⇧→ then ⌘X.
416
+ */
417
+void VIM_DELETE_END(void) {
418
+  print("\e[31me\e[0m");
419
+  VIM_LEADER(KC_NO);
420
+  PRESS(KC_LALT);
421
+    SHIFT(KC_RIGHT); // select to end of this word
422
+  RELEASE(KC_LALT);
423
+  CMD(KC_X);
424
+}
425
+
426
+/**
427
+ * Vim-like `delete whole line` command
428
+ * Simulates vim's `dd` command by sending ⌘← to move to start of line,
429
+ * selecting the whole line, then sending ⌘X to cut the line.
430
+ * alternate method: ⌘⌫, ⌃K
431
+ */
432
+void VIM_DELETE_WHOLE_LINE(void) {
433
+  print("\e[31md\e[0m");
434
+  VIM_LEADER(KC_NO);
435
+  CMD(KC_LEFT);
436
+  PRESS(KC_LSHIFT);
437
+    CMD(KC_RIGHT);
438
+  RELEASE(KC_LSHIFT);
439
+  CMD(KC_X);
440
+}
441
+
442
+/**
443
+ * Vim-like `delete word` command
444
+ * Simulates vim's `dw` command by sending ⌥⇧→→← then ⌘X to select to the start
445
+ * of the next word then cut.
446
+ */
447
+void VIM_DELETE_WORD(void) {
448
+  print("\e[31mw\e[0m");
449
+  VIM_LEADER(KC_NO);
450
+  PRESS(KC_LALT);
451
+    SHIFT(KC_RIGHT); // select to end of this word
452
+    SHIFT(KC_RIGHT); // select to end of next word
453
+    SHIFT(KC_LEFT); // select to start of next word
454
+  RELEASE(KC_LALT);
455
+  CMD(KC_X); // delete selection
456
+}
457
+
458
+/**
459
+ * Vim-like `delete back` command
460
+ * Simulates vim's `db` command by selecting to the end of the word then deleting.
461
+ */
462
+void VIM_DELETE_BACK(void) {
463
+  print("\e[31mb\e[0m");
464
+  VIM_LEADER(KC_NO);
465
+  PRESS(KC_LALT);
466
+    SHIFT(KC_LEFT); // select to start of word
467
+    SHIFT(KC_DEL); // delete selection
468
+  RELEASE(KC_LSHIFT);
469
+}
470
+
471
+/**
472
+ * Vim-like `delete left` command
473
+ * Simulates vim's `dh` command by sending ⇧← then ⌘X.
474
+ */
475
+void VIM_DELETE_LEFT(void) {
476
+  print("\e[31mh\e[0m");
477
+  VIM_LEADER(KC_NO);
478
+  SHIFT(KC_LEFT);
479
+  CMD(KC_X);
480
+}
481
+
482
+/**
483
+ * Vim-like `delete right` command
484
+ * Simulates vim's `dl` command by sending ⇧→ then ⌘X.
485
+ */
486
+void VIM_DELETE_RIGHT(void) {
487
+  print("\e[31ml\e[0m");
488
+  VIM_LEADER(KC_NO);
489
+  SHIFT(KC_RIGHT);
490
+  CMD(KC_X);
491
+}
492
+
493
+/**
494
+ * Vim-like `delete up` command
495
+ * Simulates vim's `dk` command by sending ↑ then deleting the line.
496
+ */
497
+void VIM_DELETE_UP(void) {
498
+  print("\e[31mk\e[0m");
499
+  VIM_LEADER(KC_NO);
500
+  TAP(KC_UP);
501
+  VIM_DELETE_LINE();
502
+}
503
+
504
+/**
505
+ * Vim-like `delete down` command
506
+ * Simulates vim's `dj` command by sending ↓ then deleting the line.
507
+ */
508
+void VIM_DELETE_DOWN(void) {
509
+  print("\e[31mj\e[0m");
510
+  VIM_LEADER(KC_NO);
511
+  TAP(KC_DOWN);
512
+  VIM_DELETE_LINE();
513
+}
514
+
515
+/***
516
+ *     ######   ###      ######   ######   #######  #######  ###  #     #  #######  ######
517
+ *     #     #   #       #     #  #     #  #        #         #    #   #   #        #     #
518
+ *     #     #   #       #     #  #     #  #        #         #     # #    #        #     #
519
+ *     #     #   #       ######   ######   #####    #####     #      #     #####    #     #
520
+ *     #     #   #       #        #   #    #        #         #     # #    #        #     #
521
+ *     #     #   #       #        #    #   #        #         #    #   #   #        #     #
522
+ *     ######   ###      #        #     #  #######  #        ###  #     #  #######  ######
523
+ *
524
+ */
525
+
526
+/**
527
+ * Vim-like `delete inner word` command
528
+ * Simulates vim's `diw` command by moving back then cutting to the end of the word.
529
+ */
530
+void VIM_DELETE_INNER_WORD(void) {
531
+  print("\e[31mw\e[0m");
532
+  VIM_LEADER(KC_NO);
533
+  VIM_BACK();
534
+  VIM_DELETE_END();
535
+}
536
+
537
+/***
538
+ *      #####        ######   ######   #######  #######  ###  #     #  #######  ######
539
+ *     #     #       #     #  #     #  #        #         #    #   #   #        #     #
540
+ *     #             #     #  #     #  #        #         #     # #    #        #     #
541
+ *     #             ######   ######   #####    #####     #      #     #####    #     #
542
+ *     #             #        #   #    #        #         #     # #    #        #     #
543
+ *     #     #       #        #    #   #        #         #    #   #   #        #     #
544
+ *      #####        #        #     #  #######  #        ###  #     #  #######  ######
545
+ *
546
+ */
547
+
548
+/**
549
+ * Vim-like `change back` command
550
+ * Simulates vim's `cb` command by first deleting to the start of the word,
551
+ * then switching to insert mode.
552
+ */
553
+void VIM_CHANGE_BACK(void) {
554
+  print("\e[31mb\e[0m");
555
+  VIM_LEADER(KC_NO);
556
+  VIM_DELETE_BACK();
557
+  layer_on(INSERT_MODE);
558
+}
559
+
560
+/**
561
+ * Vim-like `change down` command
562
+ * Simulates vim's `cj` command by sending ↓ then changing the line.
563
+ */
564
+void VIM_CHANGE_DOWN(void) {
565
+  print("\e[31mj\e[0m");
566
+  VIM_LEADER(KC_NO);
567
+  VIM_DELETE_DOWN();
568
+  layer_on(INSERT_MODE);
569
+}
570
+
571
+/**
572
+ * Vim-like `change to end` command
573
+ * Simulates vim's `ce` command by first deleting to the end of the word,
574
+ * then switching to insert mode.
575
+ */
576
+void VIM_CHANGE_END(void) {
577
+  print("\e[31mce\e[0m");
578
+  VIM_LEADER(KC_NO);
579
+  VIM_DELETE_END();
580
+  layer_on(INSERT_MODE);
581
+}
582
+
583
+/**
584
+ * Vim-like `change left` command
585
+ * Simulates vim's `ch` command by deleting left then switching to insert mode.
586
+ */
587
+void VIM_CHANGE_LEFT(void) {
588
+  print("\e[31mch\e[0m");
589
+  VIM_LEADER(KC_NO);
590
+  VIM_DELETE_LEFT();
591
+  layer_on(INSERT_MODE);
592
+}
593
+
594
+/**
595
+ * Vim-like `change right` command
596
+ * Simulates vim's `cl` command by deleting right then switching to insert mode.
597
+ */
598
+void VIM_CHANGE_RIGHT(void) {
599
+  print("\e[31mcl\e[0m");
600
+  VIM_DELETE_RIGHT();
601
+  layer_on(INSERT_MODE);
602
+}
603
+
604
+/**
605
+ * Vim-like `change up` command
606
+ * Simulates vim's `ck` command by deleting up then switching to insert mode.
607
+ */
608
+void VIM_CHANGE_UP(void) {
609
+  print("\e[31mck\e[0m");
610
+  VIM_DELETE_UP();
611
+  layer_on(INSERT_MODE);
612
+}
613
+
614
+/**
615
+ * Vim-like `change word` command
616
+ * Simulates vim's `cw` command by first deleting to the end of the word,
617
+ * then switching to insert mode.
618
+ */
619
+void VIM_CHANGE_WORD(void) {
620
+  print("\e[31mcw\e[0m");
621
+  VIM_LEADER(KC_NO);
622
+  VIM_DELETE_WORD();
623
+  layer_on(INSERT_MODE);
624
+}
625
+
626
+/***
627
+ *      #####   ###      ######   ######   #######  #######  ###  #     #  #######  ######
628
+ *     #     #   #       #     #  #     #  #        #         #    #   #   #        #     #
629
+ *     #         #       #     #  #     #  #        #         #     # #    #        #     #
630
+ *     #         #       ######   ######   #####    #####     #      #     #####    #     #
631
+ *     #         #       #        #   #    #        #         #     # #    #        #     #
632
+ *     #     #   #       #        #    #   #        #         #    #   #   #        #     #
633
+ *      #####   ###      #        #     #  #######  #        ###  #     #  #######  ######
634
+ *
635
+ */
636
+
637
+/**
638
+ * Vim-like `change inner word` command
639
+ * Simulates vim's `ciw` command by deleting the inner word then switching to insert mode.
640
+ */
641
+void VIM_CHANGE_INNER_WORD(void) {
642
+  print("\e[31mciw\e[0m");
643
+  VIM_DELETE_INNER_WORD();
644
+  layer_on(INSERT_MODE);
645
+}
646
+
647
+/***
648
+ *     #     #      ######   ######   #######  #######  ###  #     #  #######  ######
649
+ *     #     #      #     #  #     #  #        #         #    #   #   #        #     #
650
+ *     #     #      #     #  #     #  #        #         #     # #    #        #     #
651
+ *     #     #      ######   ######   #####    #####     #      #     #####    #     #
652
+ *      #   #       #        #   #    #        #         #     # #    #        #     #
653
+ *       # #        #        #    #   #        #         #    #   #   #        #     #
654
+ *        #         #        #     #  #######  #        ###  #     #  #######  ######
655
+ *
656
+ */
657
+
658
+/**
659
+ * Vim-like `visual select back` command
660
+ * Simulates vim's `vb` command by selecting to the enc of the word.
661
+ */
662
+void VIM_VISUAL_BACK(void) {
663
+  print("\e[31mvb\e[0m");
664
+  VIM_LEADER(KC_NO);
665
+  PRESS(KC_LALT);
666
+    SHIFT(KC_LEFT); // select to start of word
667
+  RELEASE(KC_LALT);
668
+}
669
+
670
+/**
671
+ * Vim-like `visual select to end` command
672
+ * Simulates vim's `ve` command by selecting to the end of the word.
673
+ */
674
+void VIM_VISUAL_END(void) {
675
+  print("\e[31mve\e[0m");
676
+  VIM_LEADER(KC_NO);
677
+  PRESS(KC_LALT);
678
+    SHIFT(KC_RIGHT); // select to end of this word
679
+  RELEASE(KC_LALT);
680
+}
681
+
682
+/**
683
+ * Vim-like `visual select word` command
684
+ * Simulates vim's `vw` command by selecting to the end of the word.
685
+ */
686
+void VIM_VISUAL_WORD(void) {
687
+  print("\e[31mvw\e[0m");
688
+  VIM_LEADER(KC_NO);
689
+  PRESS(KC_LALT);
690
+    SHIFT(KC_RIGHT); // select to end of this word
691
+    SHIFT(KC_RIGHT); // select to end of next word
692
+    SHIFT(KC_LEFT); // select to start of next word
693
+  RELEASE(KC_LALT);
694
+}
695
+
696
+/**
697
+ * Vim-like `visual left` command
698
+ * Simulates vim's `vh` command by sending ⇧←.
699
+ */
700
+void VIM_VISUAL_LEFT(void) {
701
+  print("\e[31mvh\e[0m");
702
+  VIM_LEADER(KC_NO);
703
+  SHIFT(KC_LEFT);
704
+}
705
+
706
+/**
707
+ * Vim-like `visual right` command
708
+ * Simulates vim's `vl` command by sending ⇧→.
709
+ */
710
+void VIM_VISUAL_RIGHT(void) {
711
+  print("\e[31mvl\e[0m");
712
+  VIM_LEADER(KC_NO);
713
+  SHIFT(KC_RIGHT);
714
+}
715
+
716
+/**
717
+ * Vim-like `visual up` command
718
+ * Simulates vim's `vk` command by sending ⇧↑.
719
+ */
720
+void VIM_VISUAL_UP(void) {
721
+  print("\e[31mvk\e[0m");
722
+  VIM_LEADER(KC_NO);
723
+  SHIFT(KC_UP);
724
+}
725
+
726
+/**
727
+ * Vim-like `visual down` command
728
+ * Simulates vim's `vj` command by sending ⇧↓.
729
+ */
730
+void VIM_VISUAL_DOWN(void) {
731
+  print("\e[31mdj\e[0m");
732
+  VIM_LEADER(KC_NO);
733
+  SHIFT(KC_DOWN);
734
+}
735
+
736
+/***
737
+ *     #     #  ###      ######   ######   #######  #######  ###  #     #  #######  ######
738
+ *     #     #   #       #     #  #     #  #        #         #    #   #   #        #     #
739
+ *     #     #   #       #     #  #     #  #        #         #     # #    #        #     #
740
+ *     #     #   #       ######   ######   #####    #####     #      #     #####    #     #
741
+ *      #   #    #       #        #   #    #        #         #     # #    #        #     #
742
+ *       # #     #       #        #    #   #        #         #    #   #   #        #     #
743
+ *        #     ###      #        #     #  #######  #        ###  #     #  #######  ######
744
+ *
745
+ */
746
+
747
+/**
748
+ * Vim-like `visual inner word` command
749
+ * Simulates vim's `viw` command by moving back then selecting to the end of the word.
750
+ */
751
+void VIM_VISUAL_INNER_WORD(void) {
752
+  print("\e[31mviw\e[0m");
753
+  VIM_LEADER(KC_NO);
754
+  VIM_BACK();
755
+  VIM_VISUAL_END();
756
+}

Loading…
Cancel
Save