-
Notifications
You must be signed in to change notification settings - Fork 3
/
helix.vs.vim
1544 lines (1496 loc) · 30.8 KB
/
helix.vs.vim
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
" This file was compiled by helix.vim/compile.sh
""""""""""""""""""""""""""""""""
" Disable default vim bindings "
""""""""""""""""""""""""""""""""
" List all keys for completeness, but only disable keys that are not remapped by helix.vim
" Move cursor left
"noremap a <nop>
" Move to the beginning of previous word
"noremap b <nop>
" Change command
"noremap c <nop>
" Delete command
"noremap d <nop>
" Move to the end of word
"noremap e <nop>
"" Find a character after the cursor in the line
noremap f <nop>
" Various commands prefixed with 'g'
noremap g <nop>
" Move cursor left
"noremap h <nop>
" Insert mode
"noremap i <nop>
" Move cursor down
"noremap j <nop>
" Move cursor up
"noremap k <nop>
" Move cursor right
"noremap l <nop>
" Set mark
noremap m <nop>
" Repeat last search
"noremap n <nop>
" Open a new line below and enter insert mode
"noremap o <nop>
" Put after the cursor
"noremap p <nop>
" Start recording a macro
noremap q <nop>
" Replace a single character
"noremap r <nop>
" Substitute a single character with new text
noremap s <nop>
" Till - find a character in the line
"noremap t <nop>
" Undo
"noremap u <nop>
" Start visual mode
"noremap v <nop>
" Move cursor forward to the beginning of a word
"noremap w <nop>
" Delete a single character
"noremap x <nop>
" Yank command
"noremap y <nop>
" Various commands prefixed with 'z' to modify the view
noremap z <nop>
" Append text at the end of the line
"noremap A <nop>
" Move backward by space-separated words
"noremap B <nop>
" Change text from the cursor position to the end of the line
noremap C <nop>
" Delete from the cursor to the end of the line
noremap D <nop>
" Move to the end of a space-separated word
"noremap E <nop>
" Find a character before the cursor in the line
"noremap F <nop>
" Go to the specified line (default: end of the file)
noremap G <nop>
" Move the cursor to the top of the screen
noremap H <nop>
" Insert text at the beginning of the line
"noremap I <nop>
" Join the current line with the next one
"noremap J <nop>
" Look up the keyword under the cursor (manpage, help file, etc.)
noremap K <nop>
" Move the cursor to the bottom of the screen
noremap L <nop>
" Move the cursor to the middle of the screen
noremap M <nop>
" Repeat the last search, but in the opposite direction
noremap N <nop>
" Open a new line above the current one and enter insert mode
"noremap O <nop>
" Put before the cursor
"noremap P <nop>
" Enter Ex mode
noremap Q <nop>
" Enter replace mode
"noremap R <nop>
" Substitute entire line
noremap S <nop>
" Till - find a character in the line before the cursor
"noremap T <nop>
" Undo all changes to the line
"noremap U <nop>
" Start visual line mode
noremap V <nop>
" Move forward by space-separated words
"noremap W <nop>
" Delete a character before the cursor
"noremap X <nop>
" Yank the entire line
noremap Y <nop>
" Z is used as a hanging key bind for extend mode
noremap ZZ <nop>
noremap ZQ <nop>
" Move to the end of the line
noremap $ <nop>
" Move to the first non-blank character of the line
noremap ^ <nop>
" Search for the word under the cursor
noremap * <nop>
" Change the case of the character under the cursor
noremap ~ <nop>
" Reverse direction find character
noremap , <nop>
" Repeat last change
noremap . <nop>
" Command-line window
noremap <Bar> <nop>
" Move to the first non-blank character of the next line
noremap + <nop>
" Move to the first non-blank character of the previous line
noremap - <nop>
" Like - but count is line number relative to the cursor
noremap _ <nop>
" Shift lines left
noremap < <nop>
" Shift lines right
noremap > <nop>
" Start command-line
"noremap : <nop>
" Repeat latest f, t, F or T [count] times
noremap ; <nop>
" Filter lines through an external program
noremap ! <nop>
" Find the next item in this line after or under the cursor and jump to its match.
noremap % <nop>
" Move to the exact position of the mark
noremap ` <nop>
" Various commands to move the cursor, typically paired with another character
noremap ] <nop>
" Similar to ], used for various cursor movement commands
noremap [ <nop>
" Move to the beginning of the line of the mark
noremap ' <nop>
" Access named register
noremap " <nop>
" Repeat the last :substitute command
noremap & <nop>
" Start forward search
"noremap / <nop>
" Start backward search
noremap ? <nop>
" Auto-indent lines
noremap = <nop>
" Move to the previous sentence
noremap ( <nop>
" Move to the next sentence
noremap ) <nop>
" Move to the previous paragraph
noremap { <nop>
" Move to the next paragraph
noremap } <nop>
" Increment number
"noremap <C-a> <nop>
" Decrement number
"noremap <C-x> <nop>
" Jump to the tag underneath the cursor
noremap <C-]> <nop>
" Used for window commands
"noremap <C-w> <nop>
"noremap <C-^> <nop>
noremap <C-,> <nop>
noremap <C-.> <nop>
noremap <C-v> <nop>
" TODO: enhance this list to work for all bindings in extend mode, such that extend mode is not left upon pressing an unbound keystroke
"""""""""""""""""""
" Helix emulation "
"""""""""""""""""""
" TODO: checkout https://vimhelp.org/options.txt.html#%27selection%27
" and https://vimhelp.org/options.txt.html#%27virtualedit%27
set notimeout
" Do not restrict movements to lines
set whichwrap=<,>,h,l,[,]
" No range selections in command mode
xnoremap : <Esc>:
" Re-enter visual mode after command/insert mode
cnoremap <CR> <CR>
cnoremap <Esc> <Esc>
inoremap <Esc> <Esc>
xnoremap <Esc> <nop>
nmap v vv
"nnoremap b :silent! normal! b<CR>
"nnoremap l :silent! normal! l<CR>
"nnoremap e :silent! normal! e<CR>
" Movement
xnoremap h <Esc>h
xnoremap <Left> <Esc>h
xnoremap l <Esc>l
xnoremap <Right> <Esc>l
xnoremap j <Esc>gj
xnoremap <Down> <Esc>gj
xnoremap k <Esc>gk
xnoremap <Up> <Esc>gk
" All commands using marks must make sure to overwrite a,b,c before usage.
" Note that [` and ]` will break if any other lowercase marks are in use.
" TODO: the following keys do not behave the same as Helix around newlines
" TODO: make sure movement near file start or end does not break out of helix mode
noremap e <Esc>maembviwovbviwvlmc`blmbhvl[`o
noremap E <Esc>maEmbviWovBviWvlmc`blmbhvl[`o
noremap w <Esc>malwhmb`aeviwovmc`blmbhvl[`o
noremap W <Esc>malWhmb`aEviWovmc`blmbhvl[`o
noremap b <Esc>mabmbviwveviwovhmc`bhmblvh]`o
noremap B <Esc>maBmbviWovEviWvhmc`bhmblvh]`o
" TODO: make these motions work across lines
noremap t <Esc>vt
noremap T <Esc>vT
noremap f <Esc>vf
noremap F <Esc>vF
xnoremap G Gvv
xnoremap <A-.> <Esc>v;
xnoremap <Home> <Esc>0v
xnoremap <End> <Esc>$v
xnoremap <C-b> <Esc><C-b>v
xnoremap <PageDown> <Esc><C-b>v
xnoremap <C-f> <Esc><C-f>v
xnoremap <PageUp> <Esc><C-f>v
xnoremap <C-u> <Esc><C-u>v
xnoremap <C-d> <Esc><C-d>v
xnoremap <C-i> <Esc><C-i>v
xnoremap <C-o> <Esc><C-o>v
nnoremap j gj
nnoremap k gk
" Changes
" r is defined in replace.vim
xnoremap R "_d""P`[v`]
nmap R vR
xnoremap ~ ~gv
nnoremap ~ v~
xnoremap ` ugv
nnoremap ` vu
xnoremap <A-`> Ugv
nnoremap <A-`> vU
xnoremap i <Esc>`<i
xnoremap a <Esc>`>a
xnoremap I <Esc>`<I
xnoremap A <Esc>`>A
xnoremap o <Esc>`>o <BS>
nnoremap o o <BS>
xnoremap O <Esc>`<O <BS>
nnoremap O O <BS>
xnoremap . <Esc>`<.
nnoremap . .
xnoremap u <Esc>uv
xnoremap U <Esc><C-R>v
" TODO: not sure what this should do
noremap <A-u> gv
" TODO: not sure what this should do
xnoremap <A-U> <Esc><C-R>v
xnoremap y ygv
nnoremap y vy
xnoremap p <Esc>`>pgv
xnoremap P <Esc>`<Pgv
" TODO: why don't the register work properly?
xnoremap " "
nnoremap " v"
xnoremap > >gv
nnoremap > >>
xnoremap < <gv
nnoremap < <<
xnoremap = =gv
xnoremap d dv
nnoremap d vd
xnoremap <A-d> "_dv
nnoremap <A-d> v"_d
xnoremap c c
nnoremap c vc
xnoremap <A-c> "_c
xnoremap <C-a> <Esc><C-a>v
xnoremap <C-x> <Esc><C-x>v
" TODO: macros
nnoremap U <C-R>
" Shell
" TODO
" Selection manipulation
" Poor mans multi cursor mode
set gdefault
noremap s :s/
noremap S <Esc>:echo "Not supported in VIM"<CR>gsgv
noremap <A-s> <Esc>:echo "Not supported in VIM"<CR>gsgv
noremap <A-_> <Esc>:echo "Not supported in VIM"<CR>gsgv
noremap & <Esc>:echo "Not supported in VIM"<CR>gsgv
noremap _ <Esc>:echo "Not implemented"<CR>gsgv
xnoremap ; <Esc>
nnoremap ; <nop>
xnoremap <A-;> o
nnoremap <A-;> <nop>
xnoremap <A-:> <Esc>`<v`>
nnoremap <A-:> <nop>
noremap , <Esc>:echo "Not supported in VIM"<CR>gsgv
noremap <A-,> <Esc>:echo "Not supported in VIM"<CR>gsgv
noremap C <Esc>:echo "Not implemented"<CR>gsgv
noremap <A-C> <Esc>:echo "Not implemented"<CR>gsgv
noremap ( <Esc>:echo "Not supported in VIM"<CR>gsgv
noremap ) <Esc>:echo "Not supported in VIM"<CR>gsgv
noremap <A-(> <Esc>:echo "Not supported in VIM"<CR>gsgv
noremap <A-)> <Esc>:echo "Not supported in VIM"<CR>gsgv
noremap % <Esc>gg0vG$
noremap <A-x> <Esc>:echo "Not implemented"<CR>gsgv
xnoremap J Jgv
noremap <A-J> <Esc>:echo "Not supported in VIM"<CR>gsgv
noremap K <Esc>:echo "Not supported in VIM"<CR>gsgv
noremap <A-K> <Esc>:echo "Not supported in VIM"<CR>gsgv
noremap <C-c> <Esc>:echo "Not implemented"<CR>gsgv
" This could perhaps be approached with b% or something
noremap <A-o> <Esc>:echo "Not implemented"<CR>gsgv
noremap <A-i> <Esc>:echo "Not supported in VIM"<CR>gsgv
noremap <A-p> <Esc>:echo "Not supported in VIM"<CR>gsgv
noremap <A-n> <Esc>:echo "Not supported in VIM"<CR>gsgv
nnoremap % gg0vG$
" Search
xnoremap / <Esc>/
xnoremap ? <Esc>?
xnoremap n <Esc>gngnvgn
xnoremap N <Esc>gNgNvgN
" This may not work in all emulators
vnoremap * y/\V<C-R>=escape(@",'/\')<CR><CR>Ngv
nnoremap n gngnvgn
nnoremap N gNgNvgN
" Goto mode
xnoremap gg <Esc>gg
xnoremap ge <Esc>G
xnoremap gf gf
xnoremap gl <Esc>$
xnoremap gh <Esc>0
xnoremap gs <Esc>^
xnoremap gt <Esc>H
xnoremap gc <Esc>M
xnoremap gb <Esc>L
xnoremap gd <Esc>gD
xnoremap gy <Esc>:echo "Not implemented"<CR>gsgv
xnoremap gr <Esc>:echo "Not implemented"<CR>gsgv
xnoremap gi <Esc>:echo "Not implemented"<CR>gsgv
xnoremap ga <Esc><C-^>
xnoremap gm <Esc>:echo "Not implemented"<CR>gsgv
xnoremap gn <Esc>:next<CR>
xnoremap gp <Esc>:previous<CR>
xnoremap g. <Esc>`^
xnoremap gj <Esc>j
xnoremap gk <Esc>k
nnoremap gg gg
nnoremap ge G
nnoremap gf gf
nnoremap gl $
nnoremap gh 0
nnoremap gs ^
nnoremap gt H
nnoremap gc M
nnoremap gb L
nnoremap gd gD
nnoremap gy :echo "Not implemented"<CR>
nnoremap gr :echo "Not implemented"<CR>
nnoremap gi :echo "Not implemented"<CR>
nnoremap ga <C-^>
nnoremap gm :echo "Not implemented"<CR>
nnoremap gn :next<CR>
nnoremap gp :previous<CR>
nnoremap g. `^
nnoremap gj j
nnoremap gk k
" Match mode
nnoremap mm %
xnoremap mm <Esc>%v
nnoremap ms( i(<Esc>la)<Esc>hhvll
nnoremap ms) i(<Esc>la)<Esc>hhvll
nnoremap ms[ i[<Esc>la]<Esc>hhvll
nnoremap ms] i[<Esc>la]<Esc>hhvll
nnoremap ms{ i{<Esc>la}<Esc>hhvll
nnoremap ms} i{<Esc>la}<Esc>hhvll
nnoremap ms< i<<Esc>la><Esc>hhvll
nnoremap ms> i<<Esc>la><Esc>hhvll
nnoremap ms' i'<Esc>la'<Esc>hhvll
nnoremap ms" i"<Esc>la"<Esc>hhvll
nnoremap ms` i`<Esc>la`<Esc>hhvll
nnoremap ms~ i~<Esc>la~<Esc>hhvll
nnoremap ms/ i/<Esc>la/<Esc>hhvll
nnoremap ms_ i_<Esc>la_<Esc>hhvll
nnoremap ms- i-<Esc>la-<Esc>hhvll
nnoremap ms* i*<Esc>la*<Esc>hhvll
nnoremap ms: i:<Esc>la:<Esc>hhvll
nnoremap ms= i=<Esc>la=<Esc>hhvll
nnoremap ms<Bar> i<Bar><Esc>la<Bar><Esc>hhvll
xnoremap ms( <Esc>`<i(<Esc>`>la)<Esc>`<lv`>l
xnoremap ms) <Esc>`<i(<Esc>`>la)<Esc>`<lv`>l
xnoremap ms[ <Esc>`<i[<Esc>`>la]<Esc>`<lv`>l
xnoremap ms] <Esc>`<i[<Esc>`>la]<Esc>`<lv`>l
xnoremap ms{ <Esc>`<i{<Esc>`>la}<Esc>`<lv`>l
xnoremap ms} <Esc>`<i{<Esc>`>la}<Esc>`<lv`>l
xnoremap ms< <Esc>`<i<<Esc>`>la><Esc>`<lv`>l
xnoremap ms> <Esc>`<i<<Esc>`>la><Esc>`<lv`>l
xnoremap ms' <Esc>`<i'<Esc>`>la'<Esc>`<lv`>l
xnoremap ms" <Esc>`<i"<Esc>`>la"<Esc>`<lv`>l
xnoremap ms` <Esc>`<i`<Esc>`>la`<Esc>`<lv`>l
xnoremap ms~ <Esc>`<i~<Esc>`>la~<Esc>`<lv`>l
xnoremap ms/ <Esc>`<i/<Esc>`>la/<Esc>`<lv`>l
xnoremap ms_ <Esc>`<i_<Esc>`>la_<Esc>`<lv`>l
xnoremap ms- <Esc>`<i-<Esc>`>la-<Esc>`<lv`>l
xnoremap ms* <Esc>`<i*<Esc>`>la*<Esc>`<lv`>l
xnoremap ms: <Esc>`<i:<Esc>`>la:<Esc>`<lv`>l
xnoremap ms= <Esc>`<i=<Esc>`>la=<Esc>`<lv`>l
xnoremap ms<Bar> <Esc>`<i<Bar><Esc>`>la<Bar><Esc>`<lv`>l
noremap mr <Esc>:echo "Not implemented"<CR>gsgv
noremap md <Esc>:echo "Not implemented"<CR>gsgv
noremap maw <Esc>vaw
noremap maW <Esc>vaW
noremap map <Esc>vap
noremap ma( <Esc>va(
noremap ma{ <Esc>va{
noremap ma< <Esc>va<
noremap ma[ <Esc>va[
noremap ma' <Esc>va'
noremap ma" <Esc>va"
noremap ma` <Esc>va`
noremap ma~ <Esc>va~
noremap mat <Esc>:echo "Not implemented"<CR>gsgv
noremap maf <Esc>:echo "Not implemented"<CR>gsgv
noremap maa <Esc>:echo "Not implemented"<CR>gsgv
noremap mac <Esc>:echo "Not implemented"<CR>gsgv
noremap maT <Esc>:echo "Not implemented"<CR>gsgv
noremap mam <Esc>:echo "Not implemented"<CR>gsgv
noremap miw <Esc>viw
noremap miW <Esc>viW
noremap mip <Esc>vip
noremap mi( <Esc>vi(
noremap mi{ <Esc>vi{
noremap mi< <Esc>vi<
noremap mi[ <Esc>vi[
noremap mi' <Esc>vi'
noremap mi" <Esc>vi"
noremap mi` <Esc>vi`
noremap mi~ <Esc>vi~
noremap mit <Esc>:echo "Not implemented"<CR>gsgv
noremap mif <Esc>:echo "Not implemented"<CR>gsgv
noremap mia <Esc>:echo "Not implemented"<CR>gsgv
noremap mic <Esc>:echo "Not implemented"<CR>gsgv
noremap miT <Esc>:echo "Not implemented"<CR>gsgv
xnoremap mim <Esc>`>f]ma`>f}mb`>f)mc`>f"md`>f'me`>f>mf`>`]`v%
"nnoremap mim v<Esc>`>f]ma`>f}mb`>f)mc`>f"md`>f'me`>f>mf`>`]`v%
" TODO: The above does not work because the mapping is canceled when a character is not found
nnoremap mim v<Esc>`>f)mb`>]`v%
" Window mode
noremap <Space>w <C-w>
" Space mode
" TODO: almost nothing is supported out of the box
" TODO: investigate select pasted text?
xnoremap <Space>p <Esc>"*p
xnoremap <Space>P <Esc>"*P
xnoremap <Space>y "*yg
xnoremap <Space>Y "*yg
xnoremap <Space>R "*p
nnoremap <Space>p "*p
nnoremap <Space>P "*P
nnoremap <Space>y v"*y
nnoremap <Space>Y v"*y
nnoremap <Space>R v"*pv
" Unimpaired / Bracket mode
" TODO
xnoremap ]p <Esc>v}
xnoremap [p <Esc>v{
nnoremap ]p v}
nnoremap [p v{
xnoremap ]<Space> o<Esc>gv
nnoremap ]<Space> vvo<Esc>gv
xnoremap [<Space> O<Esc>gv
nnoremap [<Space> vvO<Esc>gv
noremap ]d <Esc>:cnext<CR>
noremap [d <Esc>:cprevious<CR>
" Select / extend
" TODO: generate for all normal mode keys in a separate file
xnoremap vv <nop>
xnoremap v<Esc> <nop>
" Movements
xnoremap Zl l
xnoremap Zh h
xnoremap Zj gj
xnoremap Zk gk
xnoremap Ze e
xnoremap Zw w
xnoremap Zb b
xnoremap ZE E
xnoremap ZW W
xnoremap ZB B
xnoremap Zgl $h
xnoremap Zgh 0
xnoremap Zgs ^
xnoremap Zge G
xnoremap Z<A-;> o
xnoremap Zmm %
xnoremap Zgf gf
" TODO: all other match mode operators
xmap vl Zlv
xmap vl Zlv
xmap vh Zhv
xmap vj Zjv
xmap vk Zkv
xmap ve Zev
xmap vw Zwv
xmap vb Zbv
xmap vE ZEv
xmap vW ZWv
xmap vB ZBv
xmap vgl Zglv
xmap vgh Zghv
xmap vgs Zgsv
xmap vge Zgev
xmap v<A-;> Z<A-;>v
xmap vmm Zmmv
xmap vgf Zgf
" Operations
xmap vc c
xmap vr r
xmap vR R
xmap vy y
xmap vo o
xmap vO O
xmap vp p
xmap vP P
xmap va a
xmap vA A
xmap vd d
xmap v<A-d> <A-d>
xmap v> >
xmap v< <
xmap vX X
xmap vx x
xmap v<Space>y <Space>y
xmap v<Space>Y <Space>Y
xmap v<Space>R <Space>R
xmap vms( ms(
xmap vms) ms)
xmap vms[ ms[
xmap vms] ms]
xmap vms{ ms{
xmap vms} ms}
xmap vms< ms<
xmap vms> ms>
xmap vms' ms'
xmap vms" ms"
xmap vms` ms`
xmap vms~ ms~
xmap vms/ ms/
xmap vms_ ms_
xmap vms- ms-
xmap vms* ms*
xmap vms: ms:
xmap vms= ms=
xmap vms<Bar> ms<Bar>
" Select / extend for f/t/F/T is defined in find.vim
" Visual / normal mode mix
noremap ZV V
map x ZVv
xmap vx Zjv
noremap X 0V
" In extend mode, make sure that f/t/F/T stays in extend mode
" Every key stroke x needs the following pair of maps
" xnoremap Zfx fx
" xmap vfx Zfxv
" TODO: document the problem that a not-found results in exiting extend mode due to Vim's error behavior
xnoremap Zf1 f1
xmap vf1 Zf1v
xnoremap Zf2 f2
xmap vf2 Zf2v
xnoremap Zf3 f3
xmap vf3 Zf3v
xnoremap Zf4 f4
xmap vf4 Zf4v
xnoremap Zf5 f5
xmap vf5 Zf5v
xnoremap Zf6 f6
xmap vf6 Zf6v
xnoremap Zf7 f7
xmap vf7 Zf7v
xnoremap Zf8 f8
xmap vf8 Zf8v
xnoremap Zf9 f9
xmap vf9 Zf9v
xnoremap Zf0 f0
xmap vf0 Zf0v
xnoremap Zf- f-
xmap vf- Zf-v
xnoremap Zf= f=
xmap vf= Zf=v
xnoremap Zfq fq
xmap vfq Zfqv
xnoremap Zfw fw
xmap vfw Zfwv
xnoremap Zfe fe
xmap vfe Zfev
xnoremap Zfr fr
xmap vfr Zfrv
xnoremap Zft ft
xmap vft Zftv
xnoremap Zfy fy
xmap vfy Zfyv
xnoremap Zfu fu
xmap vfu Zfuv
xnoremap Zfi fi
xmap vfi Zfiv
xnoremap Zfo fo
xmap vfo Zfov
xnoremap Zfp fp
xmap vfp Zfpv
xnoremap Zf[ f[
xmap vf[ Zf[v
xnoremap Zf] f]
xmap vf] Zf]v
xnoremap Zf\ f\
xmap vf\ Zf\v
xnoremap Zfa fa
xmap vfa Zfav
xnoremap Zfs fs
xmap vfs Zfsv
xnoremap Zfd fd
xmap vfd Zfdv
xnoremap Zff ff
xmap vff Zffv
xnoremap Zfg fg
xmap vfg Zfgv
xnoremap Zfh fh
xmap vfh Zfhv
xnoremap Zfj fj
xmap vfj Zfjv
xnoremap Zfk fk
xmap vfk Zfkv
xnoremap Zfl fl
xmap vfl Zflv
xnoremap Zf; f;
xmap vf; Zf;v
xnoremap Zf' f'
xmap vf' Zf'v
xnoremap Zfz fz
xmap vfz Zfzv
xnoremap Zfx fx
xmap vfx Zfxv
xnoremap Zfc fc
xmap vfc Zfcv
xnoremap Zfv fv
xmap vfv Zfvv
xnoremap Zfb fb
xmap vfb Zfbv
xnoremap Zfn fn
xmap vfn Zfnv
xnoremap Zfm fm
xmap vfm Zfmv
xnoremap Zf, f,
xmap vf, Zf,v
xnoremap Zf. f.
xmap vf. Zf.v
xnoremap Zf/ f/
xmap vf/ Zf/v
xnoremap Zf~ f~
xmap vf~ Zf~v
xnoremap Zf! f!
xmap vf! Zf!v
xnoremap Zf@ f@
xmap vf@ Zf@v
xnoremap Zf# f#
xmap vf# Zf#v
xnoremap Zf$ f$
xmap vf$ Zf$v
xnoremap Zf% f%
xmap vf% Zf%v
xnoremap Zf^ f^
xmap vf^ Zf^v
xnoremap Zf& f&
xmap vf& Zf&v
xnoremap Zf* f*
xmap vf* Zf*v
xnoremap Zf( f(
xmap vf( Zf(v
xnoremap Zf) f)
xmap vf) Zf)v
xnoremap Zf_ f_
xmap vf_ Zf_v
xnoremap Zf+ f+
xmap vf+ Zf+v
xnoremap ZfQ fQ
xmap vfQ ZfQv
xnoremap ZfW fW
xmap vfW ZfWv
xnoremap ZfE fE
xmap vfE ZfEv
xnoremap ZfR fR
xmap vfR ZfRv
xnoremap ZfT fT
xmap vfT ZfTv
xnoremap ZfY fY
xmap vfY ZfYv
xnoremap ZfU fU
xmap vfU ZfUv
xnoremap ZfI fI
xmap vfI ZfIv
xnoremap ZfO fO
xmap vfO ZfOv
xnoremap ZfP fP
xmap vfP ZfPv
xnoremap Zf{ f{
xmap vf{ Zf{v
xnoremap Zf} f}
xmap vf} Zf}v
xnoremap Zf<Bar> f<Bar>
xmap vf<Bar> Zf<Bar>v
xnoremap ZfA fA
xmap vfA ZfAv
xnoremap ZfS fS
xmap vfS ZfSv
xnoremap ZfD fD
xmap vfD ZfDv
xnoremap ZfF fF
xmap vfF ZfFv
xnoremap ZfG fG
xmap vfG ZfGv
xnoremap ZfH fH
xmap vfH ZfHv
xnoremap ZfJ fJ
xmap vfJ ZfJv
xnoremap ZfK fK
xmap vfK ZfKv
xnoremap ZfL fL
xmap vfL ZfLv
xnoremap Zf: f:
xmap vf: Zf:v
xnoremap Zf" f"
xmap vf" Zf"v
xnoremap ZfZ fZ
xmap vfZ ZfZv
xnoremap ZfX fX
xmap vfX ZfXv
xnoremap ZfC fC
xmap vfC ZfCv
xnoremap ZfV fV
xmap vfV ZfVv
xnoremap ZfB fB
xmap vfB ZfBv
xnoremap ZfN fN
xmap vfN ZfNv
xnoremap ZfM fM
xmap vfM ZfMv
xnoremap Zf< f<
xmap vf< Zf<v
xnoremap Zf> f>
xmap vf> Zf>v
xnoremap Zf? f?
xmap vf? Zf?v
xnoremap ZF1 F1
xmap vF1 ZF1v
xnoremap ZF2 F2
xmap vF2 ZF2v
xnoremap ZF3 F3
xmap vF3 ZF3v
xnoremap ZF4 F4
xmap vF4 ZF4v
xnoremap ZF5 F5
xmap vF5 ZF5v
xnoremap ZF6 F6
xmap vF6 ZF6v
xnoremap ZF7 F7
xmap vF7 ZF7v
xnoremap ZF8 F8
xmap vF8 ZF8v
xnoremap ZF9 F9
xmap vF9 ZF9v
xnoremap ZF0 F0
xmap vF0 ZF0v
xnoremap ZF- F-
xmap vF- ZF-v
xnoremap ZF= F=
xmap vF= ZF=v
xnoremap ZFq Fq
xmap vFq ZFqv
xnoremap ZFw Fw
xmap vFw ZFwv
xnoremap ZFe Fe
xmap vFe ZFev
xnoremap ZFr Fr
xmap vFr ZFrv
xnoremap ZFt Ft
xmap vFt ZFtv
xnoremap ZFy Fy
xmap vFy ZFyv
xnoremap ZFu Fu
xmap vFu ZFuv
xnoremap ZFi Fi
xmap vFi ZFiv
xnoremap ZFo Fo
xmap vFo ZFov
xnoremap ZFp Fp
xmap vFp ZFpv
xnoremap ZF[ F[
xmap vF[ ZF[v
xnoremap ZF] F]
xmap vF] ZF]v
xnoremap ZF\ F\
xmap vF\ ZF\v
xnoremap ZFa Fa
xmap vFa ZFav
xnoremap ZFs Fs
xmap vFs ZFsv
xnoremap ZFd Fd
xmap vFd ZFdv
xnoremap ZFf Ff
xmap vFf ZFfv
xnoremap ZFg Fg
xmap vFg ZFgv
xnoremap ZFh Fh
xmap vFh ZFhv
xnoremap ZFj Fj
xmap vFj ZFjv
xnoremap ZFk Fk
xmap vFk ZFkv
xnoremap ZFl Fl
xmap vFl ZFlv
xnoremap ZF; F;
xmap vF; ZF;v
xnoremap ZF' F'
xmap vF' ZF'v
xnoremap ZFz Fz
xmap vFz ZFzv
xnoremap ZFx Fx
xmap vFx ZFxv
xnoremap ZFc Fc
xmap vFc ZFcv
xnoremap ZFv Fv
xmap vFv ZFvv
xnoremap ZFb Fb
xmap vFb ZFbv
xnoremap ZFn Fn
xmap vFn ZFnv
xnoremap ZFm Fm
xmap vFm ZFmv
xnoremap ZF, F,
xmap vF, ZF,v
xnoremap ZF. F.
xmap vF. ZF.v
xnoremap ZF/ F/
xmap vF/ ZF/v
xnoremap ZF~ F~
xmap vF~ ZF~v
xnoremap ZF! F!
xmap vF! ZF!v
xnoremap ZF@ F@
xmap vF@ ZF@v
xnoremap ZF# F#
xmap vF# ZF#v
xnoremap ZF$ F$
xmap vF$ ZF$v
xnoremap ZF% F%
xmap vF% ZF%v
xnoremap ZF^ F^
xmap vF^ ZF^v
xnoremap ZF& F&
xmap vF& ZF&v
xnoremap ZF* F*
xmap vF* ZF*v
xnoremap ZF( F(
xmap vF( ZF(v
xnoremap ZF) F)
xmap vF) ZF)v
xnoremap ZF_ F_
xmap vF_ ZF_v
xnoremap ZF+ F+
xmap vF+ ZF+v
xnoremap ZFQ FQ
xmap vFQ ZFQv
xnoremap ZFW FW
xmap vFW ZFWv
xnoremap ZFE FE
xmap vFE ZFEv
xnoremap ZFR FR
xmap vFR ZFRv
xnoremap ZFT FT
xmap vFT ZFTv
xnoremap ZFY FY
xmap vFY ZFYv
xnoremap ZFU FU
xmap vFU ZFUv
xnoremap ZFI FI
xmap vFI ZFIv
xnoremap ZFO FO
xmap vFO ZFOv
xnoremap ZFP FP
xmap vFP ZFPv
xnoremap ZF{ F{
xmap vF{ ZF{v
xnoremap ZF} F}
xmap vF} ZF}v
xnoremap ZF<Bar> F<Bar>
xmap vF<Bar> ZF<Bar>v
xnoremap ZFA FA
xmap vFA ZFAv
xnoremap ZFS FS
xmap vFS ZFSv
xnoremap ZFD FD
xmap vFD ZFDv
xnoremap ZFF FF
xmap vFF ZFFv
xnoremap ZFG FG
xmap vFG ZFGv
xnoremap ZFH FH
xmap vFH ZFHv
xnoremap ZFJ FJ
xmap vFJ ZFJv
xnoremap ZFK FK
xmap vFK ZFKv
xnoremap ZFL FL
xmap vFL ZFLv
xnoremap ZF: F:
xmap vF: ZF:v
xnoremap ZF" F"
xmap vF" ZF"v
xnoremap ZFZ FZ
xmap vFZ ZfZv
xnoremap ZFX FX
xmap vFX ZFXv
xnoremap ZFC FC
xmap vFC ZFCv
xnoremap ZFV FV
xmap vFV ZFVv
xnoremap ZFB FB
xmap vFB ZFBv
xnoremap ZFN FN
xmap vFN ZFNv
xnoremap ZFM FM
xmap vFM ZFMv
xnoremap ZF< F<
xmap vF< ZF<v
xnoremap ZF> F>
xmap vF> ZF>v
xnoremap ZF? F?
xmap vF? ZF?v
xnoremap ZT1 T1
xmap vT1 ZT1v
xnoremap ZT2 T2
xmap vT2 ZT2v
xnoremap ZT3 T3
xmap vT3 ZT3v
xnoremap ZT4 T4
xmap vT4 ZT4v
xnoremap ZT5 T5
xmap vT5 ZT5v
xnoremap ZT6 T6
xmap vT6 ZT6v
xnoremap ZT7 T7
xmap vT7 ZT7v
xnoremap ZT8 T8
xmap vT8 ZT8v
xnoremap ZT9 T9
xmap vT9 ZT9v
xnoremap ZT0 T0
xmap vT0 ZT0v
xnoremap ZT- T-
xmap vT- ZT-v
xnoremap ZT= T=