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