forked from odedniv/.vim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mappings.vim
2165 lines (1757 loc) · 65.3 KB
/
mappings.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
let i = 1
while i <= 9
execute 'nnoremap <Leader>' . i . ' <CMD>' . i . 'tabn<CR>'
let i = i + 1
endwhile
nmap <S-Space> <CMD>CtrlSpace<CR>w
"mouse
":redraw<CR>
"nmap <MiddleMouse> i
"imap <MiddleMouse> <ESCi>
"
"
"speical insert
nmap <RightMouse> <F12>
imap <RightMouse> <ESC>
inoremap <S-TAB> <esc><<^i
nmap <Home> ^
nmap <c-CR> <CMD>noh<CR><CMD>silent! Noice dismiss<CR>
nmap L: :lua
map __ <Plug>NERDCommenterComment
map <leader>Cu <Plug>NERDCommenterUncomment
"replace vanila
nnoremap <leader>& &
"get start of (next) string
"nmap <expr> & (getline('.')[col('.')-1]=='"a' <bar><bar> getline('.')[col('.')-1]== "'") ? "%" : "viqo\<ESC>h"
"nmap <expr> z& (getline('.')[col('.')-1]=='"' <bar><bar> getline('.')[col('.')-1]== "'") ? "%" : "vilq\<ESC>l"
nmap <expr> <Plug>NextQ (getline('.')[col('.')-1]=='"' <bar><bar> getline('.')[col('.')-1]== "'") ? "viq\<ESC>llviqo\<ESC>h" : "viqo\<ESC>h"
nmap <expr> <Plug>PrevQ (getline('.')[col('.')-1]=='"' <bar><bar> getline('.')[col('.')-1]== "'") ? "viqo\<ESC>hhvilq\<ESC>l" : "vilq\<ESC>l"
nmap & <Plug>NextQ
nmap <c-7> <Plug>PrevQ
"next block
nmap <c-5> z%
"nmap <c-7> <Plug>PrevQ
"nnoremap ! `
"nnoremap !! ``
"the most command marks are in
nnoremap <leader>. `.
nnoremap <leader>' ``
"recall command
nmap m/ <CMD>set noignorecase<CR><CMD>set noincsearch<CR>/
noremap m? <CMD>set incsearch<CR><CMD>set hlsearch<CR>?
function! ToggleSearch()
if &incsearch
set noincsearch
set nohlsearch
else
set incsearch
set hlsearch
endif
endfunction
nnoremap mS <CMD>call ToggleSearch()<CR>
":nmap q :exec "normal i".nr2char(getchar())."\e"<CR>
:nmap ( <CMD>exec "normal i".nr2char(getchar())."\e"<CR>
:nmap ) <CMD>exec "normal a".nr2char(getchar())."\e"<CR>
:nnoremap [( (<CR>
:nnoremap [9 (<CR>
:nnoremap [) (<CR>
:nnoremap [0 )<CR>
"qw inserts char after
nmap <Plug>(arpeggio-default:s) <CMD>call InsertBefore(v:count1)<CR>
nmap s :<C-U>call InsertBefore(v:count1)<CR>
"nnoremap F f
nmap S <CMD>call InsertAfter(v:count1)<CR>
"nnoremap q t
"The <M-t> provides omni tl-search
nmap <M-f> <Plug>(easymotion-s2)
"replaacing default
"nnoremap zq q
"Alt - q is the new macro recording ....
"nnoremap <M-q> q
"nmap s <Plug>(easymotion-s)
"nmap S <Plug>(easymotion-s2)
"endif
"meaning u would be like search everywhere
vmap s <Plug>(easymotion-sl)
"omap U <Plug>(easymotion-bd-tl)
vmap u <Plug>(easymotion-bd-fl)
"vmap U <Plug>(easymotion-bd-tl)
vmap U <Plug>(easymotion-bd-tl)
vnoremap <leader>U U
"vnoremap <leader>U U
"we use t for saving
nmap <nowait> t <CMD>let g:init=1<CR><CMD>w<CR>
" insert a single char
nnoremap <leader>` `
nnoremap m` `
"nnoremap <leader>t t
"we use m for multiple things as seconds leader
noremap <leader>Z m
nnoremap <leader>F F
"
"end only until the end and not one more
vnoremap <end> $h
nmap <nowait> , <CMD>Leaderf line --popup<CR>
nmap <m-,> <CMD>Telescope lsp_document_symbols<CR>
"nmap <nowait> , <CMD>Telescope current_buffer_fuzzy_find<CR>
"nmap <nowait> , <CMD>call Lff()<CR>
"function! Lff()
"py3 << EOF
"import cProfile
"import pstats
"profiler = cProfile.Profile()
"profiler.enable()
"anyHub.start('line')
"profiler.disable()
"stats = pstats.Stats(profiler).sort_stats('cumulative')
"stats.dump_stats('output.pstats')
"EOF
"endfunction
nmap m, <CMD>LeaderfEnablePreview<CR><CMD>Leaderf line --popup<CR>
"nnoremap <leader><c-t> <c-t>
"wroks with all letters but N
"nmap T <Plug>(easymotion-sl)
"
" _ mappings
noremap _g <CMD>diffget<CR>
noremap _p <CMD>diffput<CR>
nmap _u <CMD>LastWindow<CR>
if g:on_ek_computer
nmap _U <CMD>Telescope my_last_windows<CR>
endif
nmap _. <CMD>cd ..<CR>
nmap _- <CMD>cd -<CR>
"previous window
nmap _P <CMD>wprevious<CR>
nmap _N <CMD>wnext<CR>
nmap _wo <CMD>WorkspacesOpen<CR>
nmap _f <CMD>lua vim.lsp.buf.format({ timeout_ms = 2000 })<CR>
"do comment out
map __ <leader>Cc
"uncomment
map _+ <leader>Cu
"Alternative buffer
map _# <CMD>e #<CR>
"Previous and next visited buffer <c-o> of course
"nmap <c-[> <bar><DOWN><CR>
"nmap <M-[> <bar><UP><CR>
nmap _t <CMD>exe "tabn ".g:lasttab<CR>
noremap _b <CMD>bnext<CR>
noremap _B <CMD>bprev<CR>
"Grammerous M- mappings
"imap <M-Down> <esc>
"imap <M-Up> <esc>
"imap <M-Left> <esc>
"imap <M-Right> <esc>
"nmap <M-Down> <Plug>(grammarous-move-to-next-error)
"nmap <M-Up> <Plug>(grammarous-move-to-previous-error)
"nmap <M-Left> <Plug>(grammarous-open-info-window)
"nmap <M-Right> <Plug>(grammarous-fixit)
"F keys
noremap <F1> <CMD>execute ":help " . expand('<cword>')<CR>
"execut under cursor
nnoremap <F2> <CMD>exe getline(".")<CR>
nmap <S-F2> <CMD>exec "lua ". getline(".")<CR>
vmap <S-F2> "xy<CMD>exec "lua ".@x<CR>
vmap <F6> "xy<CMD>exec "lua " . "print(" . @x . ")"<CR>
vnoremap <F2> "xy<CMD>@x<CR>
"nmap <leader><F5> q:i<esc>
noremap <S-F3> <CMD>call Goprev()<CR>
noremap <S-F4> <CMD>call Gonext()<CR>
nnoremap <S-F6> "xddkk"xp
nnoremap <S-F7> "xyy"xp
nnoremap <S-F8> "xdd"xp
vmap <F3> "xygv:TREPLSendSelection<CR>
nmap <F3> <CMD>call AddInsert(getline('.'))<CR><CMD>TREPLSendLine<CR>
nmap <F4> <CMD>exec("Texec clear\r\n")<CR><CMD>exec("Texec &" .expand("%:p") . "\r\n")<CR>
nmap <F8> <CMD>exec("Texec clear\r\n")<CR>
"nmap <F3> <Plug>VimspectorStepOut
"nmap <F4> :call vimspector#Launch()<CR>
"nmap <F6> <Plug>VimspectorContinue
"nmap <F7> <Plug>VimspectorStepInto
"nmap _<F9> <Plug>VimspectorAddFunctionBreakpoint
"nmap _<F9> <Plug>VimspectorAddFunctionBreakpoint
"nmap _<F9> <Plug>VimspectorAddFunctionBreakpoint
"nmap <F8> <Plug>VimspectorStepOver
"nmap <F9> <Plug>VimspectorToggleBreakpoint
"nmap <leader><F9> <Plug>VimspectorToggleConditionalBreakpoint
"nmap _<F9> <Plug>VimspectorAddFunctionBreakpoint
"nmap _<F9> <Plug>VimspectorAddFunctionBreakpoint
"nmap _<F9> <Plug>VimspectorAddFunctionBreakpoint
"nmap _<F9> <Plug>VimspectorAddFunctionBreakpoint
"nmap _<F9> <Plug>VimspectorAddFunctionBreakpoint
"nmap _<F9> <Plug>VimspectorAddFunctionBreakpoint
map <silent> <F5> <Plug>(IPy-Run)
nmap <S-F5> <leader>rf
" or \rf
nmap <F13> <CMD>call StartSpecialInsert()<CR>i
nmap <F12> <CMD>call StartSpecialInsert()<CR>i
imap <F12> <c-o>
imap <F13> <ESC>
"call DisableKeys()
"ctrl commands
"
"faster
nnoremap <c-,> <CMD>Leaderf line --recall<CR>
"nmap <C--> <Plug>Sneak_,
"nmap <C-=> <Plug>Sneak_;
nmap <C-=> <Plug>(easymotion-next)
nmap <C--> <Plug>(easymotion-prev)
nmap <c-_> <CMD>let g:EasyMotion_add_search_history=1<CR><Plug>(easymotion-sn)
"Ctrlspace
"let g:CtrlSpaceDefaultMappingKey = ''
"nmap <C-b> :CtrlSpace w<CR>
"windows on tab
"nmap <c-U> <c-b>w
"if ($TERM=="xterm-256color")
""only on nvim
"nmap <C-/> :let g:EasyMotion_add_search_history=1<CR><Plug>(easymotion-sn)
"endif
"map <C-CR> <F13>
"imap <C-CR> <F13>
"imap <S-CR> <c-o>
function! Teasy()
if EasyMotion#SL(1,0,2)==0
normal l
endif
endfunction
"!!! insert mode Movements !!!
"
" in insert mode M is same line , and <c-.> . Use <c-.>
" in normal mode M is same line
"imap <M-f> <c-o><Plug>Lightspeed_s
"imap ` <c-o><Plug>Lightspeed_s
imap <silent><script><expr> <C-j> copilot#Accept("")
imap <silent><script><expr> <M-j> copilot#Next()
let g:copilot_no_tab_map = v:true
function! FF_Forward()
call quick_scope#Wallhacks('f')
return "\<c-o>\<Plug>Lightspeed_t"
endfunction
imap <expr> <c-'> FF_Forward()
function! FF_MF()
call quick_scope#Wallhacks('t')
return "\<c-o>\<Plug>Lightspeed_F"
endfunction
imap <expr> <m-'> FF_MF()
function! FF_f()
call quick_scope#Wallhacks('f')
return "\<c-o>\<Plug>Lightspeed_f"
endfunction
imap <expr> <c-/> FF_f()
function! FF_T()
call quick_scope#Wallhacks('t')
return "\<c-o>\<Plug>Lightspeed_T"
endfunction
imap <expr> <M-/> FF_T()
function! FF_TT3()
call quick_scope#Wallhacks('f')
return "\<Plug>Lightspeed_t"
endfunction
nmap <expr> <c-t> FF_TT3()
function! FF_MF2()
call quick_scope#Wallhacks('t')
return "\<Plug>Lightspeed_F"
endfunction
nmap <expr> <m-'> FF_MF2()
function! FF_f2()
call quick_scope#Wallhacks('f')
return "\<Plug>Lightspeed_f"
endfunction
nmap <expr> <c-/> FF_f2()
function! FF_T2()
call quick_scope#Wallhacks('t')
return "\<Plug>Lightspeed_T"
endfunction
nmap <expr> <m-/> FF_T2()
"imap <c-\> <c-o>f
"imap <c-p> <c-o>T
""imap <c-t> <c-o>t
"imap <c-,> <c-o>f
autocmd FileType * inoremap <expr> <c-]> IsRegular() ? "<c-o><Plug>Lightspeed_s" : "<c-]>"
autocmd FileType * nnoremap <expr> <c-]> IsRegular() ? "<Plug>Lightspeed_s" : "<c-]>"
autocmd FileType * nnoremap <expr> m<c-]> <c-]>
autocmd FileType * inoremap <expr> <c-[> IsRegular() ? "<c-o><Plug>Lightspeed_S" : "<c-[>"
autocmd FileType * nnoremap <expr> <c-[> IsRegular() ? "<Plug>Lightspeed_S" : "<c-[>"
autocmd FileType * inoremap <expr> <m-]> IsRegular() ? "<esc><Plug>Lightspeed_s" : "<m-]>"
autocmd FileType * inoremap <expr> <m-[> IsRegular() ? "<esc><Plug>Lightspeed_S" : "<m-[>"
"imap <tab> <c-o><Plug>Lightspeed_s
"imap <S-tab> <c-o><Plug>L`ightspeed_S
"nmap <M-/> <Plug>(easymotion-tl)
"imap <M-t> <c-o><CMD>call Teasy()<CR>
nmap <M-t> <Plug>(easymotion-bd-tl)
imap <M-t> <c-o><Plug>(QuickScopet)
nmap <M-t> <Plug>(QuickScopet)
xmap <M-t> <Plug>(QuickScopet)
omap <M-t> <Plug>(QuickScopet)
"this is untill"
"map <Plug>cusF <CMD>call quick_scope#Wallhacks()<CR><Plug>(easymotion-sl)
"map <Plug>cusnf <CMD>call quick_scope#Wallhacks()<CR><Plug>(Lightspeed_f)
"map <Plug>cusnF <CMD>call quick_scope#Wallhacks()<CR><Plug>(Lightspeed_F)
function! JJJ()
call feedkeys("mo\<C-B>")
endfunction
nmap <plug>ttt <CMD>call JJJ()<CR>
nmap <expr> <c-b> "<plug>ttt"
function! FFn()
call quick_scope#Wallhacks('t')
return "\<Plug>Lightspeed_F"
endfunction
nmap <expr> f Ffn()
nmap <expr> F FFn()
function! Ffn()
call quick_scope#Wallhacks('f')
return "\<Plug>Lightspeed_f"
endfunction
nmap <expr> <Plug>(arpeggio-default:f) Ffn()
"nmap F <Plug>cusF
"nmap s <Plug>Lightspeed_s
"nmap S <Plug>Lightspeed_S
"nmap s <plug>Sneak_s
"nmap S <plug>Sneak_S
"Logical, scall v:lua.cmp.utils.feedkeys.call.run(27)
"ince in normal we have s and S
"imap <c-d> <c-o><Plug>(easymotion-bd-W)
"nmap <c-d> <Plug>(easymotion-bd-W)
"
"beginning of words
"
imap <M-d> <c-o><Plug>(easymotion-bl)
nmap <M-d> <Plug>(easymotion-bl)
"end of word
imap <c-h> <c-o><Plug>(easymotion-bd-E)
nmap <c-h> <Plug>(easymotion-bd-E)
imap <M-h> <c-o><Plug>(easymotion-bd-el)
nmap <M-h> <Plug>(easymotion-bd-el)
nmap mL <Plug>(easymotion-bd-jk)
"imap <M-t> <c-o><Plug>(easymotion-tl)
nmap <M-s> <Plug>(easymotion-sl)
imap <M-s> <c-o><Plug>(easymotion-sl)
nmap ? <Plug>(easymotion-sl)
"nmap <A-s> <Plug>(easymotion-bd-sl)
"notice that q is easymotion bd everywhere
"<M-t>
"finds the best next item and complete up to it. in Vim!
":imap <c-,> <c-X><c-V>
"imap <c-,> <c-o><Plug>(easymotion-bd-t)
"imap <c-c> <c-o><Plug>(easymotion-dineanywhere)
"nmap <c-c> <Plug>(easymotion-sineanywhere)
"one aine down
"nnoremap <c-t> <c-e>
"nnoremap <c-y> <c-u>
"nmap <c-t> <Plug>(easymotion-sl)
nmap <c-s> <CMD>let g:EasyMotion_add_search_history=1<CR><Plug>(easymotion-sn)
nmap <m-s> <Plug>(easymotion-tn)
vmap <c-s> <Plug>(easymotion-s2)
"search help , lift saving
nmap <c-f> mH
"nmap <c-g> <CMD>call CocActionAsync("doHover")<cr>
nmap <C-e> mn-
nmap <M-E> -mn+
nmap <M-e> -mn+
"repeat the move
imap <c-;> <c-o>;
imap <c-\> <c-o><c-\>
"to map <c-;> in normal
imap <c-a> <c-o><c-a>
"inoremap ii
"complete just one char pumvisible()? "
"x
"
"Insert mode actions
imap <Insert> <ESC>
nmap <Insert> <CMD>call StartSpecialInsert()<CR>i
imap <c-w> <c-o>db
imap <M-Right> <c-o>W
imap <M-Left> <c-o>B
imap <M-Up> <c-h>
imap <M-Down> <c-o><Plug>(easymotion-bd-wl)
"inoremap <c-k> <Cmd>call feedkeys("\<c-L>",'n')<CR>
"completes one char or from dict
inoremap <expr> <C-K> pumvisible()? "<c-k>" : "<c-o><CMD>call RecallInserts(0)<CR>"
"inoremap <expr> <C-b> pumvisible()? "<c-b>" : "<c-o><CMD>call RecallInserts(0)<CR>"
"imap <c-b> <c-o><CMD>call RecallInserts(0)<CR>
inoremap <c-b> <c-o><CMD>call GetAllInserts()<CR>
inoremap <c-end> <c-v>
nmap <Leader>gm :lua GotoMap()<CR>
"does chars
inoremap <m-c-k> <c-x><c-k>
inoremap <c-f> <c-x><c-n>
"imap <c-z> <c-f><up><down>
"imap <c-z> <c-r>=SuperTab('n')<CR>
"Greatness , completes the text with one type
"Greatness
"function! DoCz()
"if pumvisible()
"if complete_info()['mode']=='keyword'
"return complete_info()['selected'] ==-1 ? feedkeys("\<c-r>SuperTab('n')") : feedkeys("\<tab>\<s-tab>\<c-f>\<tab>")
"else
"return 0
""return complete_info()['selected'] ==-1 ? feedkeys("\<c-f>\<tab>",'t') : feedkeys("\<c-f>")
"endif
"else
"return feedkeys("\<c-f>",'t')
"endif
"endfunction
"inoremap <c-f> <c-x><c-n>
""imap <c-z> <c-f><up><down>
""imap <c-z> <CMD>call feedkeys("\<c-f>\<c-r>=SuperTab('n')<c-m>",'')<CR>
""Greatness , completes the text with one typ
""Greatness , completes
"requests
"return comple
"Greatness , completes
function! DoCz()
if pumvisible()
if complete_info()['mode']=='keyword'
return complete_info()['selected'] ==-1 ? "\<tab>" : "\<c-f>\<Tab>\<S-Tab>"
"return complete_info()['selected'] ==-1 ? "\<tab>" : "\<c-f>\<tab>\<c-r>=SuperTab('p')\<CR>"
"return complete_info()['selected'] ==-1 ? "\<c-r>=SuperTab('n')\<CR>" : "\<c-f>\<c-r>=SuperTab('n')\<CR>\<c-r>=SuperTab('p')\<CR>"
else
return complete_info()['selected'] ==-1 ? "\<c-f>\<tab>" : "\<c-f>\<tab>"
"return complete_info()['selected'] ==-1 ? "\<c-f>\<c-r>=SuperTab('n')\<CR>" : "\<c-f>\<c-r>=SuperTab('n')\<CR>"
endif
else
return "\<c-f>"
endif
endfunction
imap <c-z> <CMD>call DoCz()<CR>
imap <expr> <c-z> DoCz()
imap <M-Space> <c-o>
imap <S-CR> <c-o>
" M-mappings
"nmap <silent> <M-J> <Plug>(ale_previous_wrap)
"nmap <silent> <M-j> <Plug>(ale_previous_wrap)
"nmap <silent> <M-K> <Plug>(ale_next_wrap)
"nmap <silent> <M-k> <Plug>(ale_next_wrap) a\n/
imap <M-g> <Plug>(IPy-Complete)
nmap <M-k> <Plug>(IPy-WordObjInfo)
nmap <M-r> <CMD>call IPyRun(input('enter python: ','','custom,IPyCompleteForInput'))<CR>
command PyRun -complete=custom,IPyCompleteForInput <CMD>call IPyRun(<f-args>)
"nmap <M-r> <CMD>call IPyRun(input('enter python: '))<CR>
"nmap <M-I> <CMD>let @z=input('enter text: ') <bar> norm "zp<CR>
"nmap <M-i> <CMD>let @z=input('enter text: ') <bar> norm "zp<CR>
nmap <M-i> <leader>of
let g:neoterm_automap_keys="<plug>(aaaa)"
"imappings!!
"c-t c-d c-h <Plug>(easymotion-hlsearch)<Plug>(easymotion-hlsearch)same as bef
"imap <c-.> <c-o>.
"loofor 2 chars already S
"imap <expr> <c-s> "<c-o><Plug>(easymotion-sn)"
" to <Plug>(easymotion-hlsearch)handle bug of sear
"needed to be in onload
"imap <M-a> <c-x><c-o>
"imap <M-A> <c-x><c-o>
"inoremap ^] ^X^]
"inoremap ^L ^X^L
"go forward and back
"imap jk <ESC>l" : "
"
"
"nmap § <CMD>call StartSpecialInsert()<CR>i
"imap § <c-o>
inoremap § <c-l>
"imap <c-z> <c-f><c-r>=SuperTab('n')<CR>
"
vmap <c-t> <CMD>Trans<CR>
"imap <c-i> <c-f><S-Tab>
function! CompleteInf()
let pre= '\(\\ref{\zs\k*$\|\\cite{\zs\k*$\|\k*$\)'
let nl=[]
let l=complete_info()
for k in l['items']
call add(nl, k['word']. ' <CMD> ' .k['info'] . ' '. k['menu'] )
endfor
call fzf#vim#complete(fzf#wrap({ 'source': nl,'prefix':pre, 'reducer': { lines -> split(lines[0], '\zs <CMD>')[0] },'sink':function('PInsert2')}))
endfunction
"get documention of current symbol
noremap <m-k> <CMD>let x=printf("Leaderf help --input %s", expand("<cword>"))<CR><CMD>exec x<CR>
vmap <m-k> "xy<CMD>let x=printf("Leaderf help --input \"%s\"", getreg("x"))<CR><CMD>exec x<CR>
"com
"completion by fuzzing of anything
imap <c-.> <CMD>call CompleteInf()<CR>
cmap <c-.> <CMD>call CompleteInf()<CR>
imap <M-K> <plug>(fzf-complete-word)
imap <M-k> <plug>(fzf-complete-word)
"imap <M-F> <plug>(fzf-complete-path)
"imap <M-f> <plug>(fzf-complete-path)
"imap <M-J> <plug>(fzf-complete-file-ag)
"imap <M-j> <plug>(fzf-complete-file-ag)
imap <M-L> <plug>(fzf-complete-line)
imap <M-l> <plug>(fzf-complete-line)
"let g:targets_pairs = '() {} [] <>'
"let g:textobj#anyblock#blocks = ['(', '{', '[', '<']
"this very dangerous and also quit diff<M-x>
" These `n` & `N` mappings are options. You do not have to map `n` & `N` to EasyMotion.
" Without these mappings, `n` & `N` works fine. (These mappings just provide
" different highlight method and have some other features )
"map <leader>l <Plug>(easymotion-bd-jk)
"nmap <leader>L <Plug>(easymotion-overwin-line)
"nmap <leader>w <Plug>(easymotion-overwin-w)
"nmap <leader>f <Plug>(easymotion-bd-fl)
"if has('nvim')
"let g:EasyMotion_use_upper = 1
" type `l` and match `l`&`L`
"cmd shortcuts
"m shokjknaaartcuts
"nnoremap <m-s> :w<CR>
"inoremap <m-s> <esc>:w<CR>
"nmap [a <CMD>ALEPrevious<CR>
"nmap ]a <CMD>ALENext<CR>
"nmap ]E <Plug>(coc-diagnostic-next)
"nmap [E <Plug>(coc-diagnostic-prev)
"nmap ]e <Plug>(coc-diagnostic-next-error)
"nmap [e <Plug>(coc-diagnostic-prev-error)
nmap [h <Plug>(GitGutterPrevHunk)
nmap ]h <Plug>(GitGutterNextHunk)
""" g mapping
"makesure we are powershell
nmap gp <CMD>exec ":e ". system("TranslatePath ".expand('<cfile>'))<CR>
""" m mappings
nnoremap <leader>mb iimport ipdb;ipdb.set_trace()<ESC>
nmap mb <leader><C-O>
nmap mB <leader><C-I>
nmap mv <leader><C-I>
" jump to current path
nmap mC <CMD>call CopyPath()<CR>
noremap mc <CMD>cd %:p:h<CR>
nnoremap md <CMD>diffupdate<CR>
nnoremap mf <CMD>!start %:p:h<CR>
nnoremap mF <CMD>exec '!open '.getcwd()<CR>
nmap mF vaf<F2>
"go to the current selection in rg"xy<CMD>call feedkeys("\<C-a>g" . @x)<CR>
"vmap mg <C-Y>
"exact
vnoremap mge "xy<CMD>exe ":FzfRg -e" . @x<CR>
"current folder lookup word
"nmap mg viWmg
"current file lookup word
nmap MG viWY
nnoremap MH <CMD>Help
nnoremap Mh <CMD>help
nnoremap mH <CMD>LeaderfHelp<CR>
noremap mm <CMD>LeaderfMru<CR>
"this is by order and not fuzzy
noremap mM <CMD>Mru<CR>
"newline
nnoremap mn o<ESC>D
noremap H ~
noremap \H H
noremap \L L
"nnoremap <leader>H H
"H is available
"great!
nnoremap <leader>M M
function! MPf()
let @+ =substitute(@+,"\\<NL>$","","")
let @+ =substitute(@+,"^[ \t]*","","")
exec "norm \"+]P"
endfunction
"paste new line
"remove indent
"
nnoremap mp o<esc><CMD>s/[^ \t]//ge<CR><CMD>call MPf()<CR>
imap <C-i> <c-o><cmd>norm mP<CR>
function! PasteFormat(x)
let l=@+
let l=len(split(l,"\n"))-1
return a:x."V".string(l).'j='
endfunction
nnoremap <expr> ]p @+ =~ ".*\n$" ? PasteFormat("p") : ((@+ =~ ".*\n.*$") ? PasteFormat("o<ESC>p"): "o<C-R>+<ESC>")
nnoremap <expr> ]P @+ =~ ".*\n$" ? PasteFormat("P") : ((@+ =~ ".*\n.*$") ? PasteFormat("O<ESC>p"): "O<C-R>+<ESC>")
"nnoremap <silent>]p <cmd>call Putline("]p")<CR>
function! Putline(how)
let l:type = getregtype(v:register)
call setreg(getreg(v:register), "V")
execute 'normal! "' . v:register . a:how
call setreg(getreg(v:register), l:type)
endfunction
"nnoremap <silent> mp <CMD>call Putline("]p")<CR>
function! Domp()
let @z=substitute(@+,"\<NL>","","g")
endfunction
vnoremap mP <CMD>call Domp()<CR>"zp
nnoremap mP <CMD>call Domp()<CR>"zp
nnoremap MP <CMD>call Domp()<CR>"zP
"convert from WINDOWS style <CR>
nmap mwin :s/\<lf>CR>//g<CR>
"remove empty spaces and lines
nnoremap msA :%s/^[\t ]*//<CR>:%s/\s\+$//e<CR>:%g/^[\t ]*$/d<CR>:%s/[ ]* / /g<CR>
nnoremap msa :s/^[\t ]*//<CR>:s/\s\+$//e<CR>:.g/^[\t ]*$/d<CR>:s/[ ]* / /g<CR>
nnoremap msb :%s/\s\+$//e<CR>:g/^$/d<CR>:%s/[ ]* / /g<CR>
"remove multi space in current line
nnoremap mss <CMD>s/\s\+/ /g<CR>
"remove empty lines
nnoremap msl <CMD>%s/\s\+$//e<CR>
nnoremap msl <CMD>g/^\s*$/norm dd<CR>
"remove trailing spaces
nnoremap msc <CMD>%s/^\(.\{-\}\)[ ]*$/\1<CR>
"open cur folder
"nmap mt <CMD>NvimTreeClose<CR>:<CMD>echom ":NvimTreeOpen ".getcwd() <CR>:<CMD>exec ":NvimTreeOpen ".escape(getcwd(),'\')<CR>
"noremap mt <CMD>call CloseAllNR()<CR>:<CMD>sleep 200m<CR>:<CMD>exec ":vert topleft split " . getcwd()<CR>
"noremap mT <CMD>call CloseAllNR()<CR>:<CMD>sleep 200m<CR>:<CMD>exe ":tabnew ".expand("%:p:h")<CR>
"open cur file's folder
"mt is defined in lua
noremap MT <CMD>exec "NvimTreeOpen ".expand("%:p:h")<CR>
"noremap mt <CMD>NERDTreeFind<CR>
nnoremap mu <CMD>UndotreeToggle<CR>
"nnoremap mu <CMD>MundoShow<CR>
nnoremap mws <CMD>CtrlSpaceSaveWorkspace<CR>
nnoremap mwd <CMD>let g:overrideCWD=0<CR>:<CMD>CtrlSpaceSaveWorkspace default<CR>let g:overrideCWD=1<CR>
nmap TT <CMD>LeaderfLineCword<CR>
vnoremap T "xy:<CMD>call feedkeys( ":LeaderfLine\<lt>CR>". @x ,'t')<CR>
function! SpecialFindLeader(type)
let &selection = "inclusive"
exec 'normal! `[v`]"xy'
:call feedkeys( ":LeaderfLine\<CR>". @x ,'t')
"call Matches(@x)
endfunction
function! SpecialFind(type)
let &selection = "inclusive"
exec 'normal! `[v`]"xy'
call Matches(@x)
endfunction
nnoremap M <CMD>set opfunc=SpecialFind<CR>g@
"vmap T
nmap Mm Miw
nmap MM MiW
function! SpecialFindRg(type)
let &selection = "inclusive"
exec 'normal! `[v`]"xy'
:call feedkeys( ":LeaderfRgInteractive\<CR>". @x . "\<CR>\<CR>")
endfunction
nnoremap L <CMD>set opfunc=SpecialFindRg<CR>g@
vmap L <C-Y>
nmap Ll Liw
nmap LL LiW
"make it seach the current zone
vnoremap RR "xy/=escape(@x,'\/')<CR><CR>
"look in the current file for all matches
vnoremap Y "xy:<CMD>call Matches(@x)<CR>
vmap M Y
"to find small word
"coc#config
"copy entire line no new line
nnoremap mY yy<CMD>let @+=@+[:len(@+)-2]<CR>
"nnoremap <C-P> <CMD>CtrlPCurWD<CR>
nmap m' ysiW'
nmap m{ ysiW{
nmap m[ ysiW[
nmap m( ysiW(
nnoremap M, <CMD>CtrlP<CR>
nnoremap m. <CMD>CtrlPClearCache<CR><CMD>CtrlP<CR>
nnoremap mj <CMD>set nohlsearch<CR>
nnoremap <leader>rn <CMD>if &relativenumber <bar> <CMD>set norelativenumber <bar> else <bar> <CMD>set relativenumber <bar> endif<CR>
" \y is copy to another register
"don't use it to cut
noremap x "_x
"open command and search
nmap m~ <c-a>c
"use <c-o> to edit cmd in place
nmap M~ <CMD>Leaderf cmdHistory<CR>
nnoremap mQ q:k
nnoremap <leader>~ ~
nnoremap <M-Space> q:i
"nmap m~ q:i<esc><c-s>
"just opens
nnoremap mq q:i<esc>
"nmap <leader>bh <CMD>split <bar> <CMD>e ~/.bash_history<CR>,
"nmap <leader>bh <CMD>call fzf#run({'source':"cat ~/.bash_history \<bar> sort \<bar> uniq",'sink': function('BH')})<CR>
function! CompleteCommand(arg)
call fzf#run({'source': GetCommands(),'sink': function('HandleCommand'),'options': '-m --query "'.a:arg.'"'} )
endfunction
nnoremap <leader>R R
"this function maps all registers so that we know what we have in each
"c-q for insert mode%. R for other modes.
func! MapR()
let lst=['+','*','.','=','%']
imap <M--> <CMD>:echo getreg("+")<CR>
imap <M--> <CMD>:echo getreg("+")<CR>
imap <M-=> <CMD>:echo getreg("=")<CR>
imap <M-=> <CMD>:echo getreg("=")<CR>
for i in range(10)
call add(lst,string(i))
exec 'map <M-'. string(i) .'> <CMD>:echo getreg("'.string(i) .'")<CR>'
exec 'imap <M-'. string(i) .'> <CMD>:echo getreg("'.string(i) .'")<CR>'
"exec 'vmap <M-'. string(i) .'> <CMD>:echo getreg("'.string(i) .'")<CR>'
endfor
let k=char2nr('a')
for j in range(26)
call add(lst,nr2char(k+j))
endfor
for i in lst
exec 'nmap R'. i .' <CMD>echo getreg("'.i .'")<CR>'
exec 'vmap R'. i .' <CMD>echo getreg("'.i .'")<CR>'
"exec 'imap <M-'. i .'> <CMD>echo getreg("'.(i) .'")<CR>'
endfor
endf
call MapR()
"complete the command using recent commands
:cmap <expr> <c-a> &cedit.'^"xy$'."<esc><esc><CMD>call CompleteCommand(@x)<CR>"
"edit command in command window
:cmap <expr> <c-b> &cedit."i"
nnoremap <silent> <C-a>c <CMD>call fzf#run({'source': GetCommands(),'sink': function('HandleCommand'),'options': '-m'} )<CR>
"search only for the mapping key
noremap <silent> <C-a>m <CMD>Maps<CR>
"search in mapping description as well
nnoremap <silent> <C-a>M <CMD>call fzf#run({'source': GetMappings(),'options': '-m'} )<CR>
nnoremap <leader><bar> <bar>
"nnoremap <silent> <bar> <CMD>call FZFOpen(':Buffers')<CR>
"<M-Bslash>
"<M-Bslash>
nmap <bar> <CMD>LeaderfDisablePreview<CR><CMD>Leaderf --popup buffer --all<CR>
nmap <M-Bslash> <CMD>let g:Lf_JumpToExistingWindow = 0<CR><CMD>Leaderf --popup buffer --all<CR>
"nnoremap <silent> <M-Bslash> <CMD>call FZFOpen(':Windows')<CR>
nnoremap <silent> m<bar> <CMD>LeaderfEnablePreview<CR><CMD>let g:Lf_JumpToExistingWindow = 1<CR><CMD>Leaderf --popup buffer<CR>
"nmap <bar> <CMD>Telescope buffers<CR>
"nnoremap <silent> <C-a>b <CMD>Leaderf buffers<CR>
"
"nnoremap <silent> <C-z> <CMD>call FZFOpen('Buffers')<CR>
nnoremap <silent> <C-a>g <CMD>LeaderfRgInteractive<CR>
nnoremap <silent> <C-a>G <CMD>FzfLua live_grep<CR>
"nnoremap <silent> <C-a>g <CMD>Telescope live_grep<CR>
"nnoremap <silent> <C-a>G <CMD>lua require('git_grep').live_grep( {additional_args = { "--","*.py"}} )<CR>
"nnoremap <silent> <C-a>g <CMD>call FZFOpen('FzfRg!')<CR>
"nnoremap <silent> <C-a>G <CMD>Leaderf rg -tpy<CR>
"for exact
"nnoremap <silent> <C-a>G <CMD>call FZFOpen('FzfRg! -e')<CR>
nnoremap <silent> <C-a>C <CMD>FzfLua commands<CR>
"nnoremap <silent> <C-a>l <CMD>call FZFOpen('BLines')<CR>
"c-l is lines in insert mode aaa
nnoremap <silent> <C-a>l <CMD>call GetAllInsertsForCurrentBufs()<CR>
nnoremap <silent> <C-a>L m'<CMD>LeaderfLineAll<CR>
nnoremap <silent> <C-a>r <CMD>Leaderf --recall<CR>
nmap <c-u> <c-a>r
nnoremap <silent> <C-a>R <CMD>LeaderfRgRecall<CR>
"files current dir
nnoremap <silent> <C-a>f <CMD>FzfLua files<CR>
"nnoremap <c-a>f <CMD>CtrlPCurWD<CR>
"nnoremap <silent> <C-a>f <CMD>exe ":LeaderfFile ".getcwd()<CR>
nnoremap <c-a>F <CMD>Telescope find_files<CR>
nnoremap <c-a>j <CMD>lua require('telescope.builtin').jumplist({fname_width=80 , layout_config = { preview_width = 0.6, width = 0.9 }})<CR>
"files current file
"66444
nnoremap <silent> <C-a>F <CMD>exe ":LeaderfFile " . expand('%:p:h')<CR>
nnoremap <silent> <C-a>h <CMD>call FZFOpen(':History')<CR>
nmap <silent> <C-a>H <CMD>call fzf#run({'source':"cat ~/.bash_history \<bar> sort \<bar> uniq",'sink': function('BH')})<CR>
nnoremap <silent> <C-a>a <CMD>call FZFOpen(':Ag')<CR>
nnoremap <silent> <C-a>d <CMD>call fzf#run({'source': uniq(sort(g:dirs)),'sink':function('CdDirPlug'),'options': '-m'})<CR>
nnoremap <silent> <C-a>D <CMD>call fzf#run({'source': uniq(sort(g:dirs)),'sink':function('CdDir'),'options': '-m'})<CR>
nnoremap <silent> <C-a>w <CMD>call FZFOpen(':Windows')<CR>
nnoremap <silent> <C-a>b <CMD>Leaderf window<CR>
nnoremap <silent> <C-a>s <CMD>call FZFOpen(':Snippets')<CR>
"use it to increase
nnoremap <silent> <C-a><C-a> <C-a>
" open FZF in
" current file's2 directory
"
nmap <leader>W <CMD>set wrap<CR>
function! GitDir()
let top = systemlist("git rev-parse --show-toplevel")[0]
return top . "/.git"
endfunction
"does diff of all files (could be vs version)
function! GCWDComplete(A, L, P) abort
return fugitive#Complete(a:A, a:L, a:P, {'git_dir': GitDir()})
endfunction
command! -bang -nargs=? -range=-1 -complete=customlist,GCWDComplete GCWD exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, { 'git_dir': GitDir() })
nmap mg <CMD>GCWD<CR>
nmap MG <CMD>unlet b:git_dir<CR><CMD>G<CR>
map <leader>g2 :diffget \\2<CR>
map <leader>g3 :diffget \\3<CR>
nnoremap <leader>Gs <CMD>Gdiff --staged<CR>
nnoremap <leader>Gc <CMD>Git commit -v -q<CR>
nnoremap <leader>GC <CMD>Git commit --amend --no-verify<CR>
nnoremap <leader>Ga <CMD>sil Git add %<CR>
nnoremap <leader>Gt <CMD>Git commit -v -q %<CR>
nnoremap <leader>Gd <CMD>Gvdiffsplit<CR>
nnoremap <leader>GD <CMD>Gvdiffsplit!<CR>
nmap <leader>GD Git! diff<CR>
nnoremap <leader>Ge <CMD>Gedit<CR>
nnoremap <leader>Gr <CMD>Gread<CR>
nnoremap <leader>Gmo Git merge --strategy-option ours origin/master<CR>
nnoremap <leader>Gmt Git merge --strategy-option theirs origin/master<CR>
"Git log all commits
nnoremap <leader>Gl <CMD>silent! Glog<CR>
"Git log current
nnoremap <leader>GL <CMD>0GcLog<CR>
nnoremap <leader>Gg <CMD>Git grep<Space>
nnoremap <leader>Gp <CMD>Git push<CR>
nnoremap <leader>Gu <CMD>Git push upstream<CR>
nnoremap <leader>GU <CMD>Git push -f upstream<CR>
nnoremap <leader>GP <CMD>Git push --force<CR>
nnoremap <leader>Gb <CMD>Git branch<Space>
nnoremap <leader>Go <CMD>Git checkout<Space>
"nnoremap <leader>Grc <CMD>Git rebase --continue<CR>
"nnoremap <leader>Gra <CMD>Git rebase --abort<CR>
map <silent> <leader>? <Plug>(IPy-WordObjInfo)
" opens terminal in new window
"
noremap <leader>od <CMD>exec ":vs " . getcwd()<CR>
"nnoremap <leader>em <CMD>call Exec("messages")<CR>
"nnoremap <leader>em <CMD>NoiceHistory<CR>
nnoremap <expr> <leader>em exists(":NoiceHistory") ? "<CMD>NoiceHistory<CR>" : "<CMD>call VspIfNeed()<CR><CMD>enew<CR><CMD>let @x=MinExec('messages')<CR><CMD>norm \"xp<CR>"
nnoremap <leader>EM <CMD>NoiceTelescope<CR>
nnoremap <leader>EM <CMD>call VspIfNeed()<CR><CMD>enew<CR><CMD>let @x=MinExec('messages')<CR><CMD>norm "xp<CR>
"enable save
nnoremap <leader>as :if exists('b:auto_save') <bar> :let b:auto_save = !b:auto_save <bar> else <bar> let b:auto_save=1 <bar> endif<CR>:echo "it is now locally". b:auto_save<CR>
nnoremap <leader>SI :let b:save_inserts= !b:save_inserts<CR>:echo "save inserts is now ". b:save_inserts<CR>
nmap <leader>AS <CMD>:AutoSaveToggle<CR>
nnoremap <leader>do <CMD>diffoff<CR>
nnoremap <leader>du <CMD>diffupdate<CR>
nnoremap <leader>dt <CMD>diffthis<CR>
function! DoRf()
let @+=expand("%:p")
norm \tt
call feedkeys("\<C-e>")
call feedkeys("\<C-v>\<CR>")
"exe "norm \<C-v>"
endfunction