-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.vimrc
1237 lines (1083 loc) · 39 KB
/
.vimrc
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
" Base configuration {{{
" Encoding. Required for powerline fonts (at least with gVim: https://vi.stackexchange.com/q/20136/21251)
" Might be dependent on window-specific overrides.
set encoding=utf-8
set fileencoding=utf-8
set termencoding=utf-8
set nocompatible " be iMproved, required
filetype off " required
if has("win32unix")
finish
endif
let g:python3_host_prog = 'python3'
" }}}
" Folding {{{
set foldmethod=marker
" set nofoldenable
nnoremap <leader>ft :set foldenable!
nnoremap <leader>fe :set foldenable
nnoremap <leader>fd :set nofoldenable
augroup folding
autocmd FileType vim setlocal foldenable
autocmd FileType markdown setlocal nofoldenable
augroup END
augroup config
autocmd FileType markdown setlocal conceallevel=0
augroup END
" }}}
" System compatibility {{{
" Root code location
let g:ODevDir = 0
" Root
let g:OVimDevDir = 0
if isdirectory("/mnt/LinuxData")
let g:ODevDir = "/mnt/LinuxData/"
elseif isdirectory($HOME .. "/programming/vim")
let g:ODevDir = $HOME .. "/"
elseif $SSH_TTY != ""
let g:ODevDir = $HOME .. "/"
let g:OVimDevDir = g:ODevDir .. "programming/"
endif
if type(g:OVimDevDir) == v:t_number && type(g:ODevDir) == v:t_string
" Assuming the general directory scheme is maintained anyway
" Can be customized separately though.
let g:OVimDevDir = g:ODevDir .. 'programming/vim/'
endif
let g:Print = "Vimrc messages:\n"
fun! s:SilentPrint(message)
let g:Print ..= "\n" .. a:message
endfun
command! Messages echo g:Print
fun! s:LocalOption(localPath, remotePath)
if (type(g:OVimDevDir) == v:t_number || !isdirectory(g:OVimDevDir .. a:localPath))
exec "Plug '" .. a:remotePath .. "'"
call s:SilentPrint("Using remote path: " .. a:remotePath)
else
exec "Plug '" .. g:OVimDevDir .. a:localPath .. "'"
call s:SilentPrint("Using local path: " .. g:OVimDevDir .. a:localPath)
endif
endfun
" }}}
" Plugins {{{
call plug#begin('~/.vim/plugged')
" Local debug {{{
if isdirectory(g:OVimDevDir .. "PluginScience")
exec "Plug '" .. g:OVimDevDir .. "PluginScience" .. "'"
endif
" }}}
" Navigation {{{
"call s:LocalOption("fern.vim", "LunarWatcher/fern.vim")
Plug 'lambdalisue/fern.vim'
Plug 'lambdalisue/fern-hijack.vim'
" Required for vim-fern-renderer-nerdfont to work
Plug 'lambdalisue/vim-nerdfont'
Plug 'lambdalisue/vim-fern-renderer-nerdfont'
if executable("git")
Plug 'lambdalisue/vim-fern-git-status'
endif
Plug 'zefei/vim-wintabs'
Plug 'zefei/vim-wintabs-powerline' " Powerline rendering
" }}}
" Fuzzy finder {{{
if has('win32')
" Windows note: Some Assembly Required:tm:
" Install FZF manually. This can be done with either
" `go get -u github.com/junegunn/fzf`, or by installing
" one of the pre-built binaries manually.
Plug 'junegunn/fzf'
else
Plug 'junegunn/fzf', { 'do': './install --all' }
endif
Plug 'junegunn/fzf.vim'
" }}}
" Themes and colors {{{
" Temporary until https://github.com/NLKNguyen/papercolor-theme/pull/203 is
" merged
call s:LocalOption("papercolor.vim", "LunarWatcher/papercolor.vim")
" Plug 'NLKNguyen/papercolor-theme'
Plug 'rhysd/conflict-marker.vim'
" }}}
" Language highlighting {{{
" Speed up load
let g:loaded_sensible = 1
Plug 'sheerun/vim-polyglot'
Plug 'bfrg/vim-c-cpp-modern', {'for': 'cpp'}
Plug 'preservim/vim-markdown', { 'for': 'markdown' }
Plug 'godlygeek/tabular'
Plug 'lervag/vimtex', {'for': 'tex'}
" }}}
" Various coding-related utils {{{
Plug 'preservim/nerdcommenter'
Plug 'liuchengxu/vista.vim'
Plug 'tpope/vim-surround'
Plug 'mg979/vim-visual-multi'
Plug 'skywind3000/asyncrun.vim'
"Plug 'skywind3000/asynctasks.vim'
" }}}
" Text extensions {{{
Plug 'junegunn/goyo.vim'
Plug 'junegunn/limelight.vim'
Plug 'junegunn/vim-easy-align'
Plug 'wellle/targets.vim'
" Bit of a weak argument to call this a text extension, but here we are
Plug 'junegunn/vim-peekaboo'
call s:LocalOption("img-paste.vim", "LunarWatcher/img-paste.vim")
" }}}
" Coding utilities {{{
" Extended % matching
Plug 'chrisbra/matchit'
Plug 'rhysd/vim-clang-format'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
if has("python3")
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
" I had to give this a double name because
" 1. I'm lazy
" 2. just vim-snippets results in vim-plug not being sure what to do with
" honza/vim-snippets, because BrOKeN InstALlAtion.
" Would be a lot easier if vim-plug preserved the username in the path.
" 3. Telling people to manually rename either repo with plugin manager
" config is stupid
call s:LocalOption("lunarwatcher-vim-snippets", 'LunarWatcher/lunarwatcher-vim-snippets')
endif
" }}}
" Lightline {{{
" Plug 'itchyny/lightline.vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" }}}
" Git integration {{{
Plug 'tpope/vim-fugitive'
Plug 'rbong/vim-flog'
" }}}
" Project management {{{
Plug 'embear/vim-localvimrc'
call s:LocalOption("LightSessions.vim", "LunarWatcher/LightSessions.vim")
" }}}
" General every-day use {{{
Plug 'tpope/vim-speeddating'
Plug 'scy/vim-mkdir-on-write'
call s:LocalOption('auto-pairs', 'LunarWatcher/auto-pairs')
call s:LocalOption('Dawn', 'LunarWatcher/Dawn')
Plug 'mbbill/undotree'
if !has("win32") && !has("win32unix")
Plug 'puremourning/vimspector'
endif
" }}}
" Search {{{
" This won't integrate with search preview
"Plug 'google/vim-searchindex'
Plug 'obcat/vim-hitspop'
Plug 'haya14busa/incsearch.vim'
Plug 'markonm/traces.vim'
Plug 'haya14busa/is.vim'
" }}}
" Start screen {{{
Plug 'mhinz/vim-startify'
" }}}
" Font-related stuff {{{
"set guifont=Source\ Code\ Pro\ for\ Powerline:h11:cANSI " Source Code Pro <3
"set guifontwide=Source\ Code\ Pro\ for\ Powerline:h11:cANSI " gvim
" Sauce Code Pro is Source Code Pro, but with added symbols (compared to the
" powerline variant as well)
"
try
if has("win32")
" The Nerd Fonts are broken on windows.
" https://github.com/ryanoasis/nerd-fonts/issues/269
" Up since 2018, "patched" in 2020
" As of 2022, it's still broken.
"set guifont=SauceCodePro\ NF:h11
" ... and to add insult to injury, as of 2022, the powerline variant
" does not display properly. No fucking clue what the problem is, but
" it looks like no anti-aliasing or something? Fuck if I know. All I
" know is that it's hideous to look at, and painfully hard to read
"set guifont=Source\ Code\ Pro\ for\ Powerline:h11
" The point in any case... default SCP
" Thanks for nothing, Windows
set guifont=Source\ Code\ Pro:h12
elseif has("unix")
set guifont=SauceCodePro\ Nerd\ Font\ 12
Plug 'ryanoasis/vim-devicons'
endif
catch
echom "Failed to find SauceCodePro - falling back to SourceCodePro, and disabling devicons"
if has("win32")
" We were supposed to fall back to powerline if we didn't have nerd
" fonts, but that likely being pointless aside (on linux installs, the
" font always exists), we have nothing to fall back on.
"
" We could fall back on plain SCP here, but we can't do that now that
" SCP is the only workin font on this godforesaken shitty OS. (Why am
" I even doing this to myself?)
echoerr "Options exhausted; install Source Code Pro directly"
elseif has("unix")
if !has("gui_running")
set guifont=Source\ Code\ Pro\ for\ Powerline\ 12
else
set guifont=Source\ Code\ Pro\ for\ Powerline:h12
endif
endif
endtry
" }}}
" Meta plugins {{{
"Plug 'tweekmonster/startuptime.vim'
Plug 'thinca/vim-themis'
Plug 'tpope/vim-repeat'
Plug 'Asheq/close-buffers.vim'
call s:LocalOption("helpwriter.vim", "LunarWatcher/helpwriter.vim")
call s:LocalOption("vim9cord", "LunarWatcher/vim9cord")
" }}}
call plug#end()
" }}}
" Plugin config {{{
" Vim9cord (testing) {{{
"let g:Vim9cordButtons = [
"{}
"]
let g:Vim9cordAltDetails = "I don't have a problem, I can quit any time I want :3"
" }}}
" Plug mapping {{{
nnoremap <leader>pi <esc>:PlugInstall<cr>
nnoremap <leader>pc <esc>:PlugClean<cr>
nnoremap <leader>pu :PlugUpdate<cr>
nnoremap <F8> :Vista!!<cr>
" }}}
" vim-visual-multi config {{{
nmap <C-LeftMouse> <Plug>(VM-Mouse-Cursor)
nmap <C-RightMouse> <Plug>(VM-Mouse-Word)
nmap <M-C-RightMouse> <Plug>(VM-Mouse-Column)
" }}}
" Start screen config {{{
function! s:center(lines)
let longest_line = max(map(copy(a:lines), 'strwidth(v:val)'))
let centered_lines = map(copy(a:lines),
\ 'repeat(" ", (&columns / 2) - (longest_line / 2)) .. v:val')
return centered_lines
endfunction
let g:startify_custom_header = s:center([
\ '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
\ '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⠟⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
\ '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣶⢤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⡿⠏⣿⠀⢸⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
\ '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠉⢿⡻⠙⠦⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⡞⠛⠃⢠⣷⡀⠈⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
\ '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠘⣷⡄⠀⠈⠙⢦⡴⣶⠖⠋⠑⠋⠉⠛⢷⣄⡀⣾⠋⣹⡷⠆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
\ '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⡄⢀⡿⢷⡄⢠⣾⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠻⣄⣹⡇⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
\ '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢳⡛⣶⠄⡿⠋⠁⠀⠀⠀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⠙⢮⡿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
\ '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⢷⢻⣺⠇⠀⠀⠀⠀⣶⣦⠀⠀⠀⢻⠿⢀⣤⣤⣄⠀⠀⠙⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
\ '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣽⡯⠀⠀⣤⣤⣤⡙⠋⠀⠀⠀⠀⠀⣾⠛⣿⣿⣿⠃⠀⣩⣷⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
\ '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⠀⠠⣾⣿⣿⠛⢿⡄⠀⣀⣀⣀⠀⢿⣿⣿⣿⣟⡴⠟⢙⣪⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
\ '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⣭⣀⠀⠈⢿⣿⣿⣿⣧⠞⠛⣿⢉⠙⠛⠛⣿⡍⠁⠀⠀⣠⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ',
\ '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣮⡎⠙⠓⠲⠛⣿⡍⠀⠀⠀⠙⠏⠀⠀⠀⠉⠁⠀⣀⡴⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
\ '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠓⢶⣄⠀⠀⠈⠁⢀⠀⣠⣀⣤⢶⠀⠀⣶⠒⠻⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
\ '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⣹⡟⢿⡿⠀⡾⠀⠷⢀⠙⢀⡛⣦⠀⠸⣗⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
\ '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⠅⣿⠼⠀⠠⡧⠀⠘⠂⠀⠹⣾⠆⠀⣸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
\ '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣇⣸⣏⣰⢧⡄⠀⠀⠀⠀⠀⠀⣿⡄⠀⠸⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
\ '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡼⠁⣸⡏⠉⠉⠀⠀⠀⠀⠀⠀⠰⣿⠁⠀⢀⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
\ '⠀⠀⠀⠀⠀⠀⠀⠀⣀⡤⠤⠤⠤⢤⣄⣀⠀⢰⣇⠀⠻⣶⠀⠀⠀⠀⠀⠀⠀⠀⢰⠟⠀⠀⢸⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
\ '⠀⠀⠀⠀⠀⠀⣴⠞⠛⠀⠀⠀⠀⠀⣆⡏⢹⠏⣟⠀⠀⠈⠳⣶⣆⠀⠀⠀⣦⣠⠟⠀⠀⠀⢀⡟⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
\ '⠀⠀⠀⠀⢀⡞⠁⠀⢰⣟⡻⠿⠷⠤⢤⣴⣏⣸⢽⣶⠀⠀⠀⠈⠛⢦⣠⡴⠋⠁⠀⠀⠀⢰⠿⣿⣽⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
\ '⠀⠀⠀⢠⡿⠀⠀⠀⠀⠉⠀⠀⠀⣰⠞⣉⠀⠉⠳⢿⣦⡄⠀⢀⣠⣿⡇⣷⡀⠈⠀⠀⢀⡏⠀⠀⠀⠈⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
\ '⠀⠀⠀⣼⠓⠄⠀⠀⠀⠀⢀⣤⠾⢃⣀⠠⠤⠀⠀⠀⠙⢿⣶⣿⣿⣿⡇⣿⣿⣿⣄⣴⣾⠃⣀⣤⡉⠀⠈⢳⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
\ '⠀⠀⠀⢻⠃⠀⠀⠀⠀⢠⡟⠁⣠⡀⢠⡄⠲⠆⠀⠀⠀⠀⢹⣿⣿⣿⡇⣿⣷⣿⣟⢍⡏⠀⠳⡿⠃⠀⠀⢸⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
\ '⠀⠀⠀⠸⣆⠀⠀⠀⠀⠘⢧⡀⠀⢠⣄⠶⠆⠀⠀⠀⠀⠀⠀⢻⣿⣿⡇⣿⣿⣿⣿⣿⣇⣀⣀⠀⠀⣠⢠⡾⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
\ '⠀⠀⠀⠀⠘⢷⡀⠀⠀⠀⣼⠋⠓⠀⢠⣤⠀⠀⠀⠀⠀⠀⠀⠈⣿⣿⡧⣿⣿⣿⣾⢷⣿⣿⣿⣷⣾⠾⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
\ '⠀⠀⠀⠀⠀⠀⠉⠓⠦⣄⣹⣼⠆⠹⠀⠀⠀⠀⠀⠀⠀⠀⠀⢤⣿⣿⣧⣿⣿⣿⠏⠀⠉⠛⠛⠛⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
\ '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠉⠙⠛⠛⠛⠓⠒⠒⠲⠤⢬⡏⠉⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀'
\ ])
let g:startify_lists = [
\ { 'type': function('lightsessions#StartifyList'), 'header': [' Sessions'] },
\ { 'type': 'bookmarks', 'header': [' Bookmarks'] },
\ { 'type': 'commands', 'header': [' Commands'] },
\ ]
let g:startify_files_number = 10
let g:startify_bookmarks = [
\ {'c': '~/.vimrc'},
\ {'z': '~/.zshrc'},
\ {'a': '~/.shell_aliases'},
\ ]
" }}}
" Autocomplete {{{
set shortmess+=c
set signcolumn=number
set updatetime=100
nmap <leader>qa <Plug>(coc-codeaction-cursor)
nmap <leader>qs <Plug>(coc-codeaction-source)
nmap <leader>qf <Plug>(coc-fix-current)
inoremap <silent><expr> <c-space> coc#refresh()
nmap <leader>rn <Plug>(coc-rename)
nmap <silent> gd <Plug>(coc-definition)
" Fix scrolling in popups
nnoremap <silent><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
nnoremap <silent><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
inoremap <silent><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
inoremap <silent><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
vnoremap <silent><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
vnoremap <silent><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
" This isn't optimal, but mapping <C-p> is not an option, because auto-pairs
" takes priority
" TODO: borked, fucks with a cr map
"inoremap <silent><expr> <C-m> coc#pum#visible() ? coc#pum#prev(1) : "\<C-m>"
" Show docs
" I also like that this doesn't show up automatically. YCM was wayyyyyyyy too
" aggressive in showing documentation.
nnoremap <silent> K :call CocActionAsync('doHover')<cr>
" Restarting is the only way to fix an issue with some popups not
" disappearing. Focusing and quitting the popup could also be an option, but
" fuuuuuuuck that
nnoremap <silent> <leader>rc :call CocRestart<cr>
nnoremap <silent> <leader>hp :call coc#float#close_all()<cr>
" }}}
" asyncrun and asynctask {{{
let g:asyncrun_open = 6
let g:asyncrun_bell = 0 " Fuck bells
let g:asynctasks_extra_config = [ $HOME .. "/.vim/asynctasks.ini" ]
nnoremap <F9> :AsyncStop<cr>:2sleep<cr>:AsyncTask build<cr>
nnoremap <F10> :AsyncStop<cr>:2sleep<cr>:AsyncTask run-build<cr>
nnoremap <F11> :AsyncStop<cr>:2sleep<cr>:AsyncTask test<cr>
nnoremap <leader>oar :AsyncTask run<cr>
" TODO: standardise your shit
" Note: <leader>o is a prefix
nnoremap <leader>oas :AsyncStop<cr>
" }}}
" Vimspector {{{
if !has("win32") && !has("win32unix")
let g:vimspector_enable_mappings = ''
nmap <M-d>c <Plug>VimspectorContinue
nmap <M-d>s <Plug>VimspectorStop
nmap <M-d>r <Plug>VimspectorRestart
nmap <M-d>e :VimspectorReset<cr>
nmap <M-d>p <Plug>VimspectorPause
nmap <leader>b <Plug>VimspectorToggleBreakpoint
endif
" }}}
" Autopair config {{{
let g:AutoPairsShortcutFastWrap = "<C-f>"
let g:AutoPairsMapBS = 0
let g:AutoPairsMapCR = 1
let g:AutoPairsMultilineFastWrap = 1
let g:AutoPairsMultilineClose = 0
let g:AutoPairsCompatibleMaps = 0
let g:AutoPairsStringHandlingMode = 2
let g:AutoPairsPreferClose = 0
call autopairs#Variables#InitVariables()
let g:AutoPairs = autopairs#AutoPairsDefine([
\ {"open": '\w\zs<', "close": '>', "filetype": ["cpp", "java"]},
\ {"open": "$", "close": "$", "filetype": "tex"},
\ {"open": '\left(', 'close': '\right)', "filetype": "tex"},
\ {"open": '\vclass .{-} (: (.{-}[ ,])+)? ?\{', 'close': '};', 'mapopen': '{', 'filetype': 'cpp', 'regex': 1},
\ {"open": "*", "close": "*", "filetype": ["help"]},
\ {"open": "|", "close": "|", "filetype": "help"},
\ ])
"let g:AutoPairs = autopairs#AutoPairsDefine([{'open': '\\(', 'close': '\)', 'filetype': 'tex'}])
if has_key(g:AutoPairsLanguagePairs["html"], "<")
unlet g:AutoPairsLanguagePairs["html"]["<"]
endif
let g:AutoPairsExperimentalAutocmd = 1
" }}}
" Undotree {{{
nnoremap <leader>ou :UndotreeToggle<cr>
" }}}
" Incsearch {{{
" Auto-disables highlighting
let g:incsearch#auto_nohlsearch=1
" Search remapping
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
" Highlight remapping
map n <Plug>(incsearch-nohl-n)
map N <Plug>(incsearch-nohl-N)
map * <Plug>(incsearch-nohl-*)
map # <Plug>(incsearch-nohl-#)
map g* <Plug>(incsearch-nohl-g*)
map g# <Plug>(incsearch-nohl-g#)
" }}}
" Local vimrc {{{
let g:localvimrc_ask = 0
let g:localvimrc_sandbox = 0
set exrc
" }}}
" Lightline {{{
"let g:lightline = {
" \ 'colorscheme': 'one'
" \ }
" }}}
" Airline {{{
let g:airline_theme = "bubblegum"
let g:airline_powerline_fonts = 1
" }}}
" Ultisnips {{{
let g:UltiSnipsSnippetDirectories = ["UltiSnips", "CustomSnippets"]
let g:UltiSnipsExpandTrigger="<C-t>"
let g:UltiSnipsJumpForwardTrigger="<C-j>"
let g:UltiSnipsJumpBackwardTrigger="<C-k>"
let g:UltiSnipsListSnippets="<C-u>"
" }}}
" Junegunn plugins {{{
nnoremap <leader>go :Goyo 65%x95%<cr>
nnoremap <leader>ll :Limelight!! 0.6<cr>
" }}}
" Vim clang-format {{{
nnoremap <leader>cf :ClangFormat<cr>
" }}}
" Vista {{{ "
let g:vista_fzf_preview = ['right:50%']
let g:vista#renderer#enable_icon = 1
let g:vista#renderer#icons = {
\ "function": "\uf794",
\ "variable": "\uf71b",
\ }
" }}} Vista "
" Vim illuminate {{{ "
" Disable highlighting in some files
let g:Illuminate_ftblacklist = ['nerdtree', 'md', 'json', 'markdown', 'text', 'txt']
" }}} Vim illuminate "
" Rainbows {{{
" The autocmd enabling this for some files failed.
let g:rainbow_active = 1
let g:rainbow_list = ['vim', 'javascript', 'java', 'python', 'cpp']
" }}}
" FZF {{{
fun! s:Fzf2Quickfix(lines)
call setqflist(map(copy(a:lines), '{"filename": v:val}'), "r")
copen
call setqflist([], 'a', {"title": "FZF search results"})
endfun
let g:fzf_layout = {
\ 'window':
\ {
\ 'width': 0.7,
\ 'height': 0.7,
\ 'highlight': 'Type',
\ 'border': 'rounded'
\ }
\ }
let g:CopyPastaTemplate = g:fzf_layout["window"]
let $FZF_DEFAULT_OPTS="--bind ctrl-a:select-all"
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-s': 'split',
\ 'ctrl-v': 'vsplit',
\ 'ctrl-o': 'tabe',
\ 'ctrl-f': function('s:Fzf2Quickfix')
\ }
command! -bang -nargs=? -complete=dir HFiles call fzf#run(fzf#wrap({
\ 'source': 'ag --hidden --ignore .git -g ""',
\ 'options': ['--layout=reverse'],
\ 'window': g:CopyPastaTemplate
\ }))
command! -bang -nargs=? -complete=dir HNGFiles call fzf#run(fzf#wrap({
\ 'source': 'ag --hidden --skip-vcs-ignores --ignore .git -g ""',
\ 'options': ['--layout=reverse'],
\ 'window': g:CopyPastaTemplate
\ }))
command! -bang -nargs=? -complete=dir CMakeFiles call fzf#run(fzf#wrap({
\ 'source': 'ag --hidden --ignore .git -g "CMakeLists.txt"',
\ 'options': ['--layout=reverse'],
\ 'down': '30%'
\ }))
command! -nargs=0 TODO grep! '(TODO\|FIXME)(\(.*\))?:?'
command! -nargs=? Search call fzf#run(fzf#wrap({
\ 'source': 'rg . --smart-case --',
\ 'options': ['--layout=reverse'],
\ 'down': '30%'
\ }))
command! -bang -nargs=* Search call fzf#vim#grep2(
\ "rg --column --line-number --no-heading --color=always --smart-case -- ",
\ <q-args>,
\ fzf#wrap({
\ 'options': ['--layout=reverse', '--bind=enter:select-all+accept'],
\ 'down': '30%',
\ 'sinklist': function('s:Fzf2Quickfix')
\ }),
\ <bang>0
\ )
nnoremap <leader>zx :HFiles<cr>
nnoremap <leader>zX :HNGFiles<cr>
nnoremap <leader>zc :Rg<cr>
nnoremap <leader>zC :RG<cr>
nnoremap <leader>zb :TODO<cr>
nnoremap <leader>zs :Search<cr>
nnoremap <leader>ocm :CMakeFiles<cr>
" Remap some of the defaults {{{
nnoremap <leader>zh :Helptags<cr>
" }}}
" }}} FZF
" fern.vim {{{
" Global settings
let g:fern#disable_default_mappings = 1
let g:fern#default_hidden = 1
let g:fern#disable_drawer_smart_quit = 1
let g:fern#drawer_width = 32
let g:fern#default_hidden = 1
let g:fern#renderer = "nerdfont"
" Global control mappings
nnoremap <F2> :Fern . -drawer -stay -toggle<cr>
"let g:fern#loglevel = g:fern#DEBUG
fun FernMaps()
nmap <buffer><expr> <Plug>(fern-cr)
\ fern#smart#leaf(
\ "<Plug>(fern-action-open)",
\ "<Plug>(fern-action-expand:stay)",
\ "<Plug>(fern-action-collapse)",
\ )
" This is common sense, why isn't this default?
nmap <buffer> <CR> <Plug>(fern-cr)
nmap <buffer> <2-LeftMouse> <Plug>(fern-cr)
" Nerd-tree compatible mappings
nmap <buffer> s <Plug>(fern-action-open:vsplit)
nmap <buffer> i <Plug>(fern-action-open:split)
nmap <buffer> o <Plug>(fern-cr)
nmap <buffer> O <Plug>(fern-action-expand-tree:stay)
nmap <buffer> L <Plug>(fern-action-expand-tree:in)
" Filesystem maps
nmap <buffer> M <Plug>(fern-action-move)
nmap <buffer> C <Plug>(fern-action-copy)
nmap <buffer> N <Plug>(fern-action-new-path)
nmap <buffer> T <Plug>(fern-action-new-file)
nmap <buffer> D <Plug>(fern-action-new-dir)
nmap <buffer> dd <Plug>(fern-action-remove)
nmap <buffer> cd <Plug>(fern-action-enter)
" Fern-specific maps
nmap <buffer> <leader> <Plug>(fern-action-mark)
" Meta maps
nmap <buffer> <F5> <Plug>(fern-action-reload)
endfun
" }}}
" Wintabs {{{
nnoremap <M-1> :WintabsGo 1<cr>
nnoremap <M-2> :WintabsGo 2<cr>
nnoremap <M-3> :WintabsGo 3<cr>
nnoremap <M-4> :WintabsGo 4<cr>
nnoremap <M-5> :WintabsGo 5<cr>
nnoremap <M-6> :WintabsGo 6<cr>
nnoremap <M-7> :WintabsGo 7<cr>
nnoremap <M-8> :WintabsGo 8<cr>
nnoremap <M-9> :WintabsGo 9<cr>
nnoremap <M-0> :WintabsLast<cr>
nnoremap <C-PageUp> :WintabsPrevious<cr>
nnoremap <C-PageDown> :WintabsNext<cr>
" Remaps <leader>q to closing a single tab. Using :q closes the entire buffer,
" including all other tabs nested within it. :WintabsClose closes one. All the
" buffers live on if :q is used instead of <leader>q, but they're not nested
" in the same way.
nnoremap <leader>qt :WintabsClose<cr>
let g:wintabs_ui_vimtab_name_format = ' %n %t '
" }}}
" Plasticboy markdown {{{
let g:vim_markdown_conceal = 0
let g:vim_markdown_conceal_code_blocks = 0
let g:vim_markdown_folding_disabled = 1
" }}}
" Vimtex {{{
let g:tex_flavor = "latex"
let g:vimtex_compiler_clean_paths = ['_minted*']
let g:vimtex_compiler_latexmk = {
\ 'options' : [
\ '-shell-escape',
\ '-verbose',
\ '-file-line-error',
\ '-synctex=1',
\ '-interaction=nonstopmode',
\ ],
\}
" }}}
" Easy align {{{
nmap ga <Plug>(EasyAlign)
vmap ga <Plug>(EasyAlign)
" }}}
" }}}
" Formatter config {{{
let g:html_indent_style1 = "inc"
" }}}
" Config {{{
" Basic enabling {{{
set nowrap " Soft wrapping is annoying
set smartcase " Search enhancements
filetype plugin indent on
filetype plugin on
syntax enable
set incsearch " Along withsearch highlighting, it shows search results while typing
set hlsearch " Search highlighting
set splitright
set wildmenu " GUI popup for command autocomplete options
if has("patch-8.2.4325")
set wildoptions=pum
end
set number " Line numbers
set laststatus=2
set cursorline " Active line highlighting - because it's nice
set hidden
set autoindent
set showcmd " Helps managing leader timeout
set scrolloff=5 " Lines over and under the cursor when scrolling
set list
set listchars=tab:→\ ,nbsp:•
" Deals with annoying editing conceal
set concealcursor=
set conceallevel=0
" Enable the mouse
set mouse=a
" Show a search count
set shortmess-=S
" Look at all the pretty colors
if has("termguicolors")
" I still find it funny that I haven't touched this part of my vimrc
" since I wrote it, and I have yet to use a single terminal where
" termguicolors has been unavailable.
set termguicolors " Required for true color terminals. If statement for compat
else
set t_Co=256
endif
" Fix backspace issues
set backspace=indent,eol,start " backspace over everything in insert mode"
" Fix that horrid arrow nav issue
set whichwrap+=<,>,h,l,[,]
" Welcome to 2024
set smoothscroll
" }}}
" Configure wrapping {{{
" Wrapping is disabled by default, but it's still used in a few places because
" it does have practical uses.
" Of course, though, there's config to make it less crap :D
augroup CustomWrap
au!
autocmd FileType text,markdown,tex setlocal wrap
augroup END
" I don't remember what this is for
set linebreak
" Indent broken lines
set breakindent
" Highlight broken lines
set showbreak=>>
" Remove @ on wrapped lines
set display=lastline
" Wrap maps
inoremap <C-up> <C-o>g<up>
inoremap <C-down> <C-o>g<down>
nnoremap <Up> gk
nnoremap <Down> gj
vnoremap <Up> gk
vnoremap <Down> gj
" }}}
" Configure indents {{{
set cindent
set cino=N-s
set cino+=g0,l1
set cino+=(0
set cino+=k4,m1,W4,j1
" }}}
" Add non-standard filetypes {{{
augroup ZoeFiletypes
au!
autocmd BufRead,BufNewfile conanfile.txt set filetype=dosini
autocmd Bufread,BufNewFile *.trconf set ft=json
autocmd BufRead,BufNewFile *.vert,*.frag set ft=glsl
augroup END
" }}}
" Themes and visual configurations {{{
set background=light " Color scheme variant
let g:PaperColor_Theme_Options = {
\ 'language': {
\ 'cpp': { 'highlight_standard_library': 1 }
\ }
\ }
" Colorschemes + alternate variants
" =================================
colorscheme PaperColor " Color scheme
"colorscheme one
" colorscheme onedark
" colorscheme onehalfdark
" colorscheme onehalflight
"colorscheme seoul256-light
"colorscheme two-firewatch
"colorscheme Aurora
" =================================
" General light, not paper {{{
"let g:terminal_ansi_colors = ['#eeeeee', '#af0000', '#008700', '#5f8700',
"\ '#0087af', '#878787', '#005f87',
"\ '#444444', '#bcbcbc', '#d70000', '#d70087', '#8700af',
"\ '#d75f00', '#d75f00', '#005faf', '#005f87']
" }}}
"}}}
" Anti-tab squad {{{
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set smartindent
augroup TabConf
au!
" Make is specific about using tabs
autocmd FileType make setlocal noexpandtab
autocmd FileType yaml setlocal tabstop=2 shiftwidth=2 softtabstop=2
autocmd FileType typescript,typescriptreact,javascriptreact setlocal sw=2 tabstop=2 softtabstop=2
augroup END
" }}}
" Cursor config {{{
if has("gui_running")
hi iCursor guibg=#e00d93
hi Cursor guibg=purple
hi Visual guibg=#b19cd9
set guicursor=n-v-c:block-Cursor-blinkon530-blinkwait530-blinkoff530
set guicursor+=i:ver20-iCursor-blinkon530-blinkwait530-blinkoff530
endif
" This is meant to be terminal-compatible
" Doesn't work, though
"let &t_SI="\e[5 q"
"let &t_SR="\e[4 q"
"let &t_EI="\e[5 q"
" }}}
" Visual {{{
set fillchars+=eob:\ ,vert:\│
" }}}
" Session management {{{
" Storing options is a shit idea: https://github.com/LunarWatcher/auto-pairs/issues/33
set ssop-=options,globals,localoptions
set vop-=options
" Storing blank buffers is pointless
set ssop-=blank
" }}}
" Filetype overrides {{{
if has("linux") && (has("gui_running") || $SSH_TTY == "")
augroup ZoeGUIFiletypes
au!
autocmd BufRead *.png,*.jpg,*.jpeg call system('xdg-open ' .. expand('%:p'))
augroup END
endif
" }}}
" Title management {{{
set title titlelen=50
set titlestring=%{getcwd()->fnamemodify(':t')}:\ %{expand(\"%:t\")}
" }}}
" netrw stuff {{{
if has("linux")
" The linux default for gx is gnome-open, which doesn't seem to exist on
" my distro. xdg-open is fairly portable, but it's borked in gVim. setsid
" (whatever that is, didn't bother checking) seems to work around this.
"
" Thank you Christian Brandt: https://vi.stackexchange.com/a/5034/21251
let g:netrw_browsex_viewer = "setsid xdg-open"
endif
" }}}
" Colorcolumn {{{
" Sets a cursorcolumn to appear at &textwidth. Most files don't have this
" configured, but the ones that do get a visible alignment thing
set colorcolumn=+0
augroup TWOverride
au!
" Disable the cursorcolumn in all
autocmd BufEnter * if &ro == 1 | exec 'setlocal colorcolumn=' | endif
" Per convention -- though 79 and 78 are more common here, I prefer 80 for
" helpfiles. Helpfiles are much more sensitive to alignment, so even numbers
" are arguably better
autocmd FileType help if &ro == 0 | exec 'setlocal textwidth=80' | endif
" Per pep8
autocmd FileType python setlocal textwidth=79
" Per personal preference
autocmd FileType cpp setlocal textwidth=120
augroup END
" }}}
" Grepping, search, and fun with quickfix {{{
if executable("rg")
set grepprg=rg\ --vimgrep\ --smart-case
endif
nnoremap <F7> :copen<cr>
" }}}
" }}}
" Mappings {{{
" Fix copy-pasta {{{
noremap <leader>pp "0p
noremap <leader>P "0P
" }}}
" Multi-window nav {{{
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
" }}}
" Autosave {{{
" Adapted from https://github.com/towc/dotfiles/blob/master/.vimrc#L462-L475
let g:autoSave = 0
function! ToggleAutoSave()
if g:autoSave == 0
let g:autoSave = 1
augroup AutoSaveAu
au!
au CursorHoldI,CursorHold <buffer> silent update
augroup END
else
let g:autoSave = 0
au! AutoSaveAu
endif
endfunction
nnoremap <leader>as :call ToggleAutoSave()<cr>
" }}}
" Terminal {{{
tnoremap <C-n> <C-w>N
if has("gui_running")
" Forward basic keys
"https://old.reddit.com/r/vim/comments/cxhi7p/ctrlw_to_delete_word_in_terminal_window/
tnoremap <C-BS> <C-w>.
tnoremap <S-Space> <Space>
inoremap <C-Tab> <C-v><Tab>
endif
"}}}
" Vimrc {{{
if empty($MYVIMRC)
let $MYVIMRC = "~/.vimrc"
endif
nnoremap <leader>ve :split $MYVIMRC<cr>
nnoremap <leader>vE :e $MYVIMRC<cr>
nnoremap <leader>vt :tabe $MYVIMRC<cr>
nnoremap <leader>va :split ~/.shell_aliases<cr>
nnoremap <leader>vz :split ~/.zshrc<cr>
nnoremap <leader>rel :source $MYVIMRC<cr>
" }}}
" Uncategorized mapping {{{
" Clears search highlighting without disabling it in general
nnoremap <leader>chl :noh<cr>
" Clears trailing spaces from the current file
nnoremap <leader>ts :%s/ \+$//g<cr>
" This needs to be remapped on keyboards without a bracket button (i.e. on
" scandinavian or german keyboards)
autocmd FileType help nnoremap <C-t> <C-]>
" Get tab maps on the mouse in normal mode
nmap <X2Mouse> <C-PageDown>
nmap <X1Mouse> <C-PageUp>
" Buftab navigation
" TODO: tmap equivalents
nmap <S-F5> gt
nmap <S-F6> gT
" }}}
" LaTeX {{{
fun! TexMaps()
nmap <buffer> <F10> :VimtexCompile<cr>
imap <buffer> <C-l><C-i> \textit{
vmap <buffer> <C-l><C-i> xi\textit{<esc>p
imap <buffer> <C-l><C-b> \textbf{
vmap <buffer> <C-l><C-b> xi\textbf{<esc>p
if !has("gui_running")
return
endif
" Matrix helpers
" .<bs> is a trick for forcing <cr> to work at the end of a map with no
" delay (might be a consequence of a <cr> map, but iDunno
imap <buffer> <C-CR> <space>\\<cr>.<bs>
imap <buffer> <S-CR> <C-o>$<space>\\<CR>.<bs>
imap <buffer> <C-Tab> <space>&<space>
imap <buffer> <S-Tab> <C-o>$<space>&<space>
imap <buffer> <C-e><C-e> <space>\\<space>
" Icon helpers