-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.vimrc
More file actions
1685 lines (1529 loc) · 54.1 KB
/
.vimrc
File metadata and controls
1685 lines (1529 loc) · 54.1 KB
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
" Enable modern Vim features not compatible with Vi spec.
set nocompatible
syntax on
filetype plugin indent on
" Plugins {{{
call plug#begin('~/.vim/plugged')
" Quality of life plugins {{{
" Don't have to do anything to use, repeats plugin commands.
Plug 'tpope/vim-repeat'
" A set of nice defaults for vim; don't need to do anything to use.
Plug 'tpope/vim-sensible'
" Makes the 'f' and 't' mappings work better (multiline)
Plug 'chrisbra/improvedft'
" Automatically closes delimiters like quotes, braces, and parenthesis
" You can use <s-tab> to jump out of one level of delimiters
" and <c-g>g to jump out of all
" Plug 'Raimondi/delimitMate'
" Auto-closes pairs of strings (e.g. ()). Can also do multicharacter pairs
" unlike delimitMate.
Plug 'tmsvg/pear-tree'
" Shows the diff between a 'recovered' file and what's on disk
Plug 'chrisbra/Recover.vim'
" Automatically restore file cursor position and folding information
Plug 'vim-scripts/restore_view.vim'
" Slow down 'hjkl' commands if used too often (to encourage better behavior).
Plug 'takac/vim-hardtime'
" }}}
" Operators {{{
" Useful mapping for changing options: '{c,y}o{s,l,n,w,x}':
" c/y -> change (y is the new one for some reason?)
" s -> spell
" l -> list (show whitespace)
" n -> line numbers
" r -> relative line numbers
" w -> text wrap
" x -> cursorline cursorcolumn (highlight both)
" h -> highlight search (shows all matches highlighted)
" i -> ignore case (for search)
"
" Also includes {[,]}{x,u,y,<space>,e,f>:
" [,] -> encode or above, decode or below
" x -> XML/HTML encode
" u -> URL encode
" y -> C string-escape encode
" e -> Exchange current line with lines above/below
" <space> -> Empty line above/below
" f -> Switch files
Plug 'tpope/vim-unimpaired'
" Handle mistypings, substitutions and transformations more smartly.
" :Abolish does iabbrevs, more or less (that is, it can fix misspellings but
" with lots of varieties)
" :Subvert does :%s///, more or less (replace s with Subvert).
" cr{s,m,c,u} does coercion to {snake_case, MixedCase, camelCase, UPPER_CASE}
" Pretty much this is only here for the cr mappings.
Plug 'tpope/vim-abolish'
" Smartly increment/decrement (C-A, C-X) with different numeric/date types.
Plug 'tpope/vim-speeddating'
" Similar to vim-surround, but slightly more functionality. Has variants for
" auto-selecting the closest brackets (css, dss). Allows counts (must type the
" surrounding each time though, so "2ysiw))") on the outside for multiple
" surroundings and on the inside for multiple textobjects (e.g. "ys2w)"). Has
" text objects for surroundings (ibb for auto selected block and im for
" manually selected literal surroundings).
Plug 'machakann/vim-sandwich'
" Comment stuff with 'gcc' or 'gc{motion}'. tlib_vim is a dependency of
" tcomment_vim.
Plug 'tomtom/tlib_vim' | Plug 'atomictom/tcomment_vim'
" Make alignment easier with 'ga' command.
" gaip -> start alignment in this paragraph
" vipga -> visually select paragraph and start alignment
" [0-9*] -> align around Nth occurence of char or all (*). Can be used any
" time in EasyAlign mode.
" <enter> -> Change justification (l, c, r)
" <c-p> -> Go to live mode (show changes live). Press space to exit?
" <c-[rl]> -> change right/left margin (spaces).
" <c-x> or <c-/> -> regular expression
" <c-f> -> filter
" <c-ilrdua> -> other options (just play with them in live mode, <c-p>)
Plug 'junegunn/vim-easy-align'
" Allow for moving arguments inside lists/parents left/right. Also adds aa and
" ia as text objects.
Plug 'AndrewRadev/sideways.vim'
" }}}
" Text Objects {{{
" Note that some of the verb plugins above also define text objects,
" including:
"
" * vim-sandwich: vib, vim_ -- select surrounded text
" * sideways: vaa, via -- select arguments
" Makes it easy to define custom text objects. This is a prerequisite for many
" other text object plugins.
Plug 'kana/vim-textobj-user'
" Adds a text object for selecting functions with af and if. Only works with a
" few languages (C, Java, Vimscript), sadly.
Plug 'kana/vim-textobj-function'
" Adds text objects ic, ac, and aC for selecting comments, and in the latter
" case, surrounding whitespace.
Plug 'glts/vim-textobj-comment'
" Select a portion of a "word" delimited by _ or UpperCase letters (e.g.
" a portion of a snake_case or camelCase variable). Use vav or viv; the former
" handles capitalization and underscores while the latter does not.
Plug 'Julian/vim-textobj-variable-segment'
" Text object for a vertical column of *something* separated by whitespace.
Plug 'coderifous/textobj-word-column.vim'
" Add text object mappings for all sorts of punctuation pairs like "vi_" or
" "vi," for selecting things in between underscores or commas.
Plug 'kurkale6ka/vim-pairs'
" gives 'ai', 'ii', 'iI', and 'aI' text objects for indent blocks
Plug 'michaeljsmith/vim-indent-object'
" }}}
" Movement {{{
" Use with g + motion (usually). Like 'gl' for goto-line or 'gw' for goto-word.
Plug 'Lokaltog/vim-easymotion'
" Adds mappings for indent-aware movement: {[,]}{-+=%_}:
" [,] -> Above or below
" - -> less indent
" + -> more indent
" = -> same indent
Plug 'jeetsukumaran/vim-indentwise'
" Gives emacs/readline-like keybindings in insert and command mode. I mostly
" want it for command-mode, though.
" Plug 'tpope/vim-rsi'
"
" Alternative to vim-rsi that I want to try if vim-rsi doesn't work. Only
" affects command mode rather than also affecting insert-mode.
"
" After trying both, this one seems to work better. I don't want emacs
" bindings outside of command mode anyway.
Plug 'ryvnf/readline.vim'
" }}}
" Theme and Visuals {{{
" Molokai is the color theme I use with vim
Plug 'tomasr/molokai'
" Nice alternative themes.
Plug 'morhetz/gruvbox'
" Makes Vim look nice
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" Change the colorscheme depending on the actual sunrise/sunset for a given
" lat/long.
" Plug 'cadadr/vim-sunflower'
" Smooth scrolling
Plug 'psliwka/vim-smoothie'
" Make indentation levels when using spaces more obvious
Plug 'Yggdroot/indentLine'
" }}}
" Highlights {{{
" Highlight the word under the cursor (after a small delay) by default
Plug 'RRethy/vim-illuminate'
" Highlight css (and other?) colors as the color they are. Automatic for CSS
" and HTML (see settings below), but can be enabled via {y,c}ok (k for kolor).
Plug 'chrisbra/Colorizer'
" Use with :DoRainbowToggle (or "co)")
Plug 'kien/rainbow_parentheses.vim'
" Press - to give the current identifier a random highlight and _ to clear it
Plug 'akesling/ondemandhighlight'
" Highlights search patterns and ranges for Ex commands and shows live
" previews for :substitute :smagic and :snomagic
Plug 'markonm/traces.vim'
" Make yanks more obvious by briefly highlighting them
Plug 'machakann/vim-highlightedyank'
" Clears search highlight if cursor is moved and improves star-search. I've
" forked it to remove a mapping (gd) which messes with my ALEGoToDefinition
" mapping.
Plug 'atomictom/vim-slash'
" Use with :MRU; combines with vim-startify below.
" Plug 'yegappan/mru'
" Access through plain 'vim' in bash, provides a fancy start screen
" Plug 'mhinz/vim-startify'
" }}}
" Sign column {{{
" Shows changes with many VCS's including git, mercurial, and perforce
Plug 'mhinz/vim-signify'
" Show marks (e.g. 'mx') in the sign column. Unfortunately it conflicts with
" anything else using the sign column like vim-gitgutter.
" mx -> toggle mark 'x'
" dmx -> remove mark 'x' (from anywhere)
" m, -> place next available mark
" m. -> place next available mark or remove first exist one
" m<space> -> remove all marks
" [`'[]][`'[]] -> Jump to next/previous mark/start-of-line (` first means
" alphabetical order, [ first means file-order).
" m/ -> location list of marks.
" m[0-9] -> Toggle a special marker (visual only); shift removes them.
" [[]][-=] -> Jump to next/prev line with marker of same/any type.
" m? -> location list of special markers.
" m<BS> -> Remove all special markers.
" :SignatureRefresh -> Redraw
Plug 'kshenoy/vim-signature'
" }}}
" Sidebars and Windows {{{
" A fork of Gundo with extra features. Use with <F2>
Plug 'simnalamburt/vim-mundo'
" Opens a window showing vim's undo tree, use with <F3>
" Plug 'mbbill/undotree'
" Uses ctags and shows various tags in a 'tagbar' window, use <F8> to activate
Plug 'majutsushi/tagbar'
" Toggle the Vista outline with <F7>
Plug 'liuchengxu/vista.vim'
" A nice filesystem browser, use <F4> to open
Plug 'scrooloose/nerdtree'
" Use :YRShow (<F9>) to show the yankring for previous yanks/deletes. Press \p
" and \P to move through previous entries after pasting something.
" Disabled because it doesn't play nice with other plugins. It remaps a ton of
" keys causing issues for plugins like repeat.vim.
" Plug 'vim-scripts/YankRing.vim'
" Use :Yanks (<F9>) to show previous yanks and/or (shift+)\p to cycle through
" previous ones when pasting.
Plug 'maxbrunsfeld/vim-yankstack'
" Shows and outline of the current file based on different arguments to the
" initial 'Voom' call (ex. ':Voom vimwiki')
Plug 'vim-voom/VOoM'
" Use <c-w>m to "zoom" in on a given split (window)
Plug 'dhruvasagar/vim-zoom'
" }}}
" Syntax and AutoComplete {{{
" Automatically does a syntax check on various filetypes when saving
" Plug 'scrooloose/syntastic'
" Same as syntastic, but async. The plan is to move entirely to Ale.
Plug 'dense-analysis/ale'
" Semantic autocompletion.
Plug 'neoclide/coc.nvim', {'branch': 'release'}
" Plug 'Valloric/YouCompleteMe', { 'do': './install.py --clangd-completer --clang-completer --cs-completer --go-completer --ts-completer --rust-completer --java-completer' }
" }}}
" Vim Applications {{{
Plug 'vimwiki/vimwiki'
" Use with <Leader>di to draw stuff (with arrow keys and more).
Plug 'vim-scripts/DrawIt'
" Use "g=" on a selection/movement or "g==" on a line to evaluate some
" mathematical calculation. Can use variables and works with math inside
" comments.
Plug 'arecarn/crunch'
" Easy alignment use with :Tab /{pat}/[{r,l,c}{num}]+
" Where {pat} is what to match, r, l, and c are alignment,
" and num is number of spaces. Disabled in favor of vim-easy-align.
" Plug 'godlygeek/tabular'
" A calendar plugin that supposedly works with Google Calendar / Task
" Plug 'itchyny/calendar.vim'
" A calendar plugin that supposedly works with vimwiki
" Plug 'mattn/calendar-vim'
" }}}
" VCS {{{
" Some commands to make it easier to interact with git. :Gblame for blame,
" :Gmove to git mv. Lots of other commands as well, but I don't really plan to
" learn them not. Also used by airline to disable branch info.
Plug 'tpope/vim-fugitive'
" View commits with :GV (GV! for current file only).
Plug 'junegunn/gv.vim'
" }}}
" Session management {{{
" General functions for other plugins by 'xolox'
Plug 'xolox/vim-misc'
" OpenSession and SaveSession with \s[s] (session save) \so (session open)
Plug 'xolox/vim-session'
" }}}
" Fuzzy search {{{
" In-buffer fuzzy searching. Use g/ to activate.
Plug 'ggvgc/vim-fuzzysearch'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
" }}}
" Snippets {{{
" A set of common snippets for UltiSnip.
Plug 'honza/vim-snippets'
" Use YCM to list snips, then <c-l> to activate them and <c-j/k> to navigate
" the snippets. Disabled because it appears broken (Unknown function:
" "UltiSnips#TrackChange").
" Plug 'SirVer/ultisnips'
" }}}
" Gist commands {{{
" Needed for gist-vim (library for webapi functions)
Plug 'mattn/webapi-vim'
" Provides ":Gist" commands to post buffers to Github's gist
Plug 'mattn/gist-vim'
" }}}
" Remote Execution {{{
" Allows executing another process outside vim I think?
" It's a prerequisite for vimshell.vim and ghcmod-vim
Plug 'Shougo/vimproc.vim', { 'do': 'make' }
" }}}
" Exotic file types {{{
" Open .pdf file with :Pdf
Plug 'vim-scripts/open-pdf.vim'
Plug 'jamessan/vim-gnupg'
" }}}
" Language Plugins {{{
" General plugin for auto-formatting on save or when a command is run
Plug 'Chiel92/vim-autoformat'
" Syntax and commands for go
Plug 'fatih/vim-go'
" Syntax for Rust
Plug 'rust-lang/rust.vim'
" Syntax file for EBNF
Plug 'killphi/vim-ebnf'
" Syntax file for .tmux.conf
Plug 'tmux-plugins/vim-tmux'
" Haskell {{{
" Automatically indents after newlines to align things like data declarations.
Plug 'itchyny/vim-haskell-indent'
" Expanded syntax for Haskell.
Plug 'neovimhaskell/haskell-vim'
" Add some helpful haskell stuff like unicode 'covers' (\ -> lambda), better syntax highlighting (similar to haskell-vim but not as intense)
" Plug 'dag/vim2hs'
" Automatically runs hindent on save
" Plug 'alx741/vim-hindent'
"
" It's worth noting that if stylish-haskell is installed (via Stack), I've
" configured ALE to use it as a fixer on save.
" }}}
" Lisp {{{
" 'Sane' handling of Common Lisp
"Plug 'SaneCL'
" Indent Lisp-y code
Plug 'ds26gte/scmindent'
" Racket syntax
Plug 'wlangstroth/vim-racket'
" Syntax file for hy
Plug 'hylang/vim-hy'
" }}}
" Python {{{
" Python syntax
Plug 'hdima/python-syntax'
" Gives Python reference for a given identifier using either <F1> or :PyRef
Plug 'xolox/vim-pyref'
" Provides some Python-specific text objects and movements.
Plug 'jeetsukumaran/vim-pythonsense'
" }}}
" C/C++ {{{
" Switch to alternate file (.h, for .c) with :A or :AT (<Leader>alt), file under cursor with
" <Leader>ih or <Leader>is
" Plug 'vim-scripts/a.vim'
" Includes a C language reference. <Leader>cr searches selected word/text, <Leader>cw prompts for what to search, <Leader>cc opens the reference
Plug 'vim-scripts/CRefVim'
" C-Call-Tree...view the help to see how to use
Plug 'hari-rangarajan/CCTree'
" }}}
" JavaScript and Friends {{{
" Syntax highlighting, and the like, w/ a few options that can customize it
Plug 'pangloss/vim-javascript'
" Provides Tern for vim. Tern provides code analysis for javascript (might
" need to bind some keys to leverage this)
Plug 'marijnh/tern_for_vim'
" Syntax and highlighting for purescript
Plug 'purescript-contrib/purescript-vim'
" Adds coffeescript syntax and a few convenience functions for compiling,
" running, and viewing the JS output of a coffeescript file
Plug 'kchmck/vim-coffee-script'
" }}}
" HTML and HTML templating languages {{{
" Automatically highlight matching tags
Plug 'Valloric/MatchTagAlways'
" Zen Coding for HTML
Plug 'mattn/emmet-vim'
" HTML5 syntax and omnicomplete
Plug 'othree/xml.vim'
Plug 'othree/html5.vim'
Plug 'othree/html5-syntax.vim'
" Automatically close html tags
Plug 'ypid/HTML-AutoCloseTag'
" Liquid syntax highlighting for jekyll
Plug 'tpope/vim-liquid'
Plug 'mitsuhiko/vim-jinja'
" Some commands for working with tags like HTML, XML, PHP, etc.
" All start with <C-X>
" <C-X><space> turn word into inline tag
" <C-X><CR> turn word into tag then indent
" <C-X>:
" / -- Last tag closed
" ! -- Doctype
" # -- Meta content-type
" @ -- Stylesheet
" $ -- Script
" + Others
Plug 'tpope/vim-ragtag'
" }}}
" CSS {{{
" CSS3 highlighting
Plug 'hail2u/vim-css3-syntax'
" This plugin maybe messes with undotree
" Plug 'gorodinskiy/vim-coloresque'
" Plug 'ap/vim-css-color'
" }}}
" }}}
call plug#end()
" }}}
" Looks {{{
if has("termguicolors") && match($TERM, "screen") == -1
set termguicolors
endif
set term=xterm-256color
set t_Co=256
set title
" Make the contrast more contrast-y if using the gruvbox theme
let g:gruvbox_contrast_dark = 'hard'
" Make the "monokai" theme match the original "molokai" one.
let g:molokai_original = 0
" Use alternative monokai colors.
let g:rehash256 = 0
colorscheme molokai
" Make matching brackets look a little less like the cursor jumped
" See https://github.com/tomasr/molokai/pull/44
highlight MatchParen ctermfg=208 ctermbg=233 cterm=bold
" Make vim-illuminate underline the word under the cursor
highlight illuminatedWord cterm=underline gui=underline
" }}}
" Vim Settings {{{
filetype plugin indent on
setl expandtab
setl softtabstop=4
setl tabstop=8
setl shiftwidth=4
setl ttyfast
setl ttymouse=xterm2
setl cryptmethod=blowfish
setl foldmethod=marker
setl virtualedit=block
setl scrolloff=3
setl wildmode=full
setl backspace=indent,eol,start
setl wildmenu
setl cursorline
setl gdefault
setl incsearch
setl autoindent
setl ruler
setl showmode
setl linebreak
setl showcmd
setl ignorecase
setl smartcase
setl laststatus=2
setl hidden
setl undofile
setl undolevels=10000
setl undoreload=10000
setl backup
setl formatoptions=cqrjtl
setl undodir=~/.vim/undo/
setl backupdir=~/.vim/backup
setl directory=~/.vim/tmp
setl viminfo='1000,n$HOME/.vim/files/info/viminfo
setl sessionoptions-=options
setl viewoptions-=options
setl pastetoggle=<F10>
" More aggressive updating for with async updates in vim8
setl updatetime=100
" Show the index of the search (i.e. X/Total).
setl shortmess-=S
" }}}
" Plugin Settings {{{
" Don't add meta-key bindings because they mess with hitting escape and then
" normal mode keys.
let g:rsi_no_meta = 1
" [Buffers] Jump to the existing window if possible
let g:fzf_buffers_jump = 1
" [Tags] Command to generate tags file
let g:fzf_tags_command = 'ctags -R'
let g:sneak#label = 1
" I create my own mappings.
let g:skip_default_textobj_word_column_mappings = 1
" Don't try to set a mapping for tcomment textobjects
let g:tcomment_textobject_inlinecomment = ''
let g:signify_sign_change = '~'
" Show increased indentation levels with more broken up lines.
let g:indentLine_char_list = ['|', '¦', '┆', '┊']
" let g:hardtime_default_on = 1
" How many times I can use hjkl before being slowed down.
let g:hardtime_maxcount = 10
" Only slow down if it's the same key consecutively.
let g:hardtime_allow_different_key = 1
let g:hardtime_showmsg = 1
let g:hardtime_ignore_buffer_patterns = [ "Mundo.*", "NERD.*", "undotree.*" ]
let g:hardtime_timeout = 1000
let g:list_of_normal_keys = ["h", "j", "k", "l", "gj", "gk", "<UP>", "<DOWN>", "<LEFT>", "<RIGHT>"]
let g:list_of_visual_keys = ["h", "j", "k", "l", "gj", "gk", "<UP>", "<DOWN>", "<LEFT>", "<RIGHT>"]
let g:list_of_insert_keys = ["<UP>", "<DOWN>", "<LEFT>", "<RIGHT>"]
" Don't hide closing brackets after pressing <CR>, but make it so dot-repeat
" is broken.
let g:pear_tree_repeatable_expand = 0
let g:pear_tree_pairs = {
\ '<!--': {'closer': ' -->'},
\ '/\*': {'closer': '\*/'},
\ '(': {'closer': ')'},
\ '[': {'closer': ']'},
\ '{': {'closer': '}'},
\ "'": {'closer': "'"},
\ '"""': {'closer': '"""'},
\ '"': {'closer': '"'},
\ '`': {'closer': '`'},
\ '<': {'closer': '>'},
\ }
let g:pear_tree_smart_openers = 1
" This does not appear to be as smart as I thought. It seems that typing "()"
" gets you "())" which sucks.
" let g:pear_tree_smart_closers = 1
let g:pear_tree_smart_backspace = 1
let g:Illuminate_delay = 100
let g:Illuminate_ftblacklist = ['nerdtree']
let g:colorizer_auto_filetype='css,html'
let g:colorizer_skip_comments = 1
" Highlight e.g. 'red'
let g:colorizer_colornames = 1
let g:ctrlp_command = 'CtrlPMixed'
let g:ctrlp_custom_ignore = {
\ 'dir': '\.(git|svn|hg)$\|_site\|\.jsexe$\|node_modules$',
\ 'file': '\v\.(o|hi|js_o|js_hi|dyn_hi|dyn_o)',
\ }
let g:ctrlp_working_path_mode = 0
let g:ctrlp_root_markers = ['.ctrlp_root']
let g:ctrlp_max_files = 30000
let g:ctrlp_follow_symlinks = 1
let g:ctrlp_switch_buffer = 2
let g:ctrlp_user_command = '/usr/bin/ag %s -i --nocolor --nogroup --hidden
\ --ignore .git
\ --ignore .svn
\ --ignore .hg
\ --ignore .DS_Store
\ --ignore "**/*.pyc"
\ --ignore review
\ -g ""'
let g:ctrlp_match_func = {'match': 'pymatcher#PyMatch'}
let g:delimitMate_expand_cr = 1
let g:delimitMate_expand_space = 1
let g:delimitMate_jump_expansion = 1
let g:delimitMate_balance_matchpairs = 1
let g:purescript_indent_if = 3
let g:purescript_indent_case = 5
let g:purescript_indent_let = 4
let g:purescript_indent_do = 3
let g:purescript_indent_where = 6
let g:htmljinja_disable_html_upgrade = 1
let g:session_autosave = 'no'
let g:session_autoload = 'no'
let g:vimwiki_list = [{'path': '~/.vimwiki'}]
let g:vimwiki_conceallevel = 0
let g:haskell_conceal = 0
let g:calendar_google_calendar = 1
let g:calendar_google_task = 1
let g:airline_powerline_fonts = 1
let g:airline_theme='badwolf'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#show_buffers = 0
let g:airline#extensions#tabline#tab_min_count = 2
let g:airline#extensions#tabline#show_close_button = 0
let g:airline#extensions#tabline#show_tab_type = 0
let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline#extensions#ale#enabled = 1
let g:yankring_history_dir = '~/.vim'
let g:yankring_min_element_length = 2
let g:yankring_replace_n_nkey = '<leader>P'
let g:yankring_replace_n_pkey = '<leader>p'
let g:yankstack_map_keys = 0
let g:yankstack_yank_keys = ['y', 'd', 'c']
let g:gist_clip_command = 'xclip -selection clipboard'
let g:gist_update_on_write = 2
let g:gist_open_browser_after_post = 1
let g:syntastic_check_on_open=1
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_ignore_files = ['\v.*\.rs$']
let g:syntastic_mode_map = {
\ 'mode': 'active',
\ 'active_filetypes': [],
\ 'passive_filetypes': ['rust'],
\ }
let g:ragtag_global_maps = 1
let g:niji_matching_filetypes = ['lisp', 'scheme', 'racket', 'clojure', 'hy', 'haskell']
" Disable haskell-vim omnifunc
let g:haskellmode_completion_ghc = 0
let g:ghcmod_stack_exec = 1
let g:UltiSnipsExpandTrigger = "<c-l>"
let g:UltiSnipsJumpForwardTrigger = "<c-j>"
let g:UltiSnipsJumpBackwardTrigger = "<c-k>"
let g:ycm_auto_hover = ''
let g:ycm_server_keep_logfiles = 1
let g:ycm_server_log_level = 'debug'
let g:ycm_autoclose_preview_window_after_insertion = 1
let g:ycm_min_num_of_chars_for_completion = 1
let g:ycm_complete_in_comments = 1
" ----------------------------------------
" These variables are set to their defaults, but I'm listing them here because
" at some point, I may wish to change them.
let g:ycm_collect_identifiers_from_comments_and_strings = 0
let g:ycm_seed_identifiers_with_syntax = 0
" ----------------------------------------
if ! exists('g:ycm_global_ycm_extra_conf')
let g:ycm_global_ycm_extra_conf = '~/.vim/.ycm_extra_conf.py'
endif
let g:ycm_key_list_previous_completion = ['<Up>', '<c-k>']
let g:ycm_key_list_select_completion = ['<TAB>', '<Down>', '<c-j>']
let g:ycm_cache_omnifunc = 1
let g:ycm_semantic_triggers = {
\ 'haskell': ['.', ':: ', '-> '],
\ 'css': [' ', 're!\s{4}', 're!^\t', 're!: (\S+ )*'],
\}
let g:ycm_language_server = [
\ {
\ 'name': 'haskell',
\ 'filetypes': ['haskell', 'hs', 'lhs'],
\ 'cmdline': ['hie-wrapper', '--lsp'],
\ 'project_root_files': ['.stack.yaml', 'cabal.config', 'package.yaml'],
\ },
\ ]
let g:ycm_filetype_blacklist = {
\ 'purescript': 1,
\ 'haskell': 1,
\}
let g:startify_session_dir = '~/.vim/sessions'
let g:startify_enable_special = 0
let g:startify_files_number = 10
let g:startify_relative_path = 1
let g:startify_custom_header =
\ map(split(system('cat ~/.vim/startify_header.txt'), '\n'), '" ". v:val') + ['','']
let g:startify_skiplist = [
\ 'COMMIT_EDITMSG',
\ $VIMRUNTIME .'/doc',
\ 'bundle/.*/doc',
\ '\.DS_Store'
\ ]
let g:startify_list_order = [
\ [' MRU in this directory:'],
\ 'dir',
\ [' Bookmarks:'],
\ 'bookmarks',
\ [' Sessions:'],
\ 'sessions',
\ [' MRU:'],
\ 'files'
\ ]
let g:startify_custom_footer = [
\ '',
\ '-----------------------------------------------',
\ '',
\ "Vim is charityware. Please read ':help uganda'."
\ ]
let g:vista_default_executive = 'ale'
" let g:vista#renderer#enable_icon = 1
" Open a preview window when the cursor is on a line with an error.
" let g:ale_cursor_detail = 1
let g:ale_set_loclist = 1
let g:ale_sign_error = "✗"
let g:ycm_error_symbol = "✗"
let g:ale_sign_warning = "⚠"
let g:ycm_warning_symbol = "⚠"
let g:ale_sign_style_error = "😡"
let g:ale_sign_style_warning = "😠"
let g:ale_linters = {
\ 'rust': [
\ 'rust-analyzer',
\ ],
\ 'sh': [
\ 'shellcheck',
\ ],
\}
let g:ale_fixers = {
\ 'haskell': [
\ 'stylish-haskell',
\ ],
\ 'purescript': [
\ 'purty',
\ ],
\ 'python': [
\ 'yapf',
\ 'isort',
\ ],
\ 'rust': [
\ 'rustfmt',
\ 'remove_trailing_lines',
\ 'trim_whitespace',
\ ],
\ 'sh': [
\ 'shfmt',
\ ],
\}
" let g:ale_rust_rls_executable = '/home/thomas/.cargo/bin/rls'
let g:ale_fix_on_save = 1
" Doesn't appear to work with nightly
" let g:ale_rust_rls_toolchain = 'stable'
let g:ale_rust_cargo_use_clippy = executable('cargo-clippy')
let g:ale_rust_cargo_check_tests = 1
let g:ale_rust_cargo_check_examples = 1
let g:rustfmt_autosave = 1
let g:rustfmt_command = "rustfmt +nightly"
let g:rustfmt_emit_files = 1
let g:is_pythonsense_suppress_object_keymaps = 1
let g:is_pythonsense_suppress_location_keymaps = 1
let g:is_pythonsense_alternate_motion_keymaps = 1
" Remap vim-sandwich to use surround-like mappings (i.e. ys, cs, ds).
runtime macros/sandwich/keymap/surround.vim
" }}}
" Functions {{{
" A function to customize YankRing
function! YRRunAfterMaps()
nnoremap Y :<C-U>YRYankCount 'y$'<CR>
endfunction
function! ExecuteMacroOverVisualRange()
echo "@".getcmdline()
execute ":'<,'>normal @".nr2char(getchar())
endfunction
function s:DoRainbowParenthesis()
RainbowParenthesesLoadRound
RainbowParenthesesLoadSquare
RainbowParenthesesToggleAll
endfunction
function s:ReloadFiles()
let l:prev = &autoread
set autoread
checktime
let &autoread = l:prev
endfunction
function s:ReloadBuffer()
let l:prev = &autoread
set autoread
execute "checktime " . bufnr('%')
let &autoread = l:prev
endfunction
function s:ToggleColorColumn()
if &colorcolumn
let &colorcolumn=""
else
let &colorcolumn="80,".join(range(120,999),",")
endif
endfunction
function s:GatherTests()
" Record cursor position
let cursor_info = RecordCursor()
" Search for 'CMUnitTest tests'
keepjumps execute "normal /CMUnitTest tests\<cr>"
" Delete everything inside the CMUnitTest array
keepjumps normal $di}k
" Process/generate the test functions to put into the CMUnitTest array
keepjumps read !./gen_tests.sh %
" Indent all generated test functions twice
keepjumps normal Vi}2>
" Restore cursor position
call FixCursor(cursor_info)
endfunction
function s:TrimTrailingWhitespace()
" Record cursor position
let cursor_info = RecordCursor()
keepjumps %s/\s*$//g
" Restore cursor position
call FixCursor(cursor_info)
endfunction
function RecordCursor()
return {
\ 'lstart': line("w0"),
\ 'pos': getpos("."),
\ }
endfunction
function FixCursor(cursor_info)
let lstart = a:cursor_info['lstart']
let pos = a:cursor_info['pos']
keepjumps execute "normal " . lstart . "G"
if lstart != 1
execute "normal " . Min(lstart - 1, 3) . "\<c-e>"
endif
keepjumps call setpos('.', pos)
endfunction
function Min(a, b)
return a:a < a:b ? a:a : a:b
endfunction
function Max(a, b)
return a:a > a:b ? a:a : a:b
endfunction
" }}}
" Commands {{{
command -bang Q q<bang>
command -bang W w<bang>
command -bang Qa qa<bang>
command -bang QA qa<bang>
command -bang Wa wa<bang>
command -bang WA wa<bang>
command -bang E e<bang>
command NoAutosave let g:web_autosave = 0
command Autosave let g:web_autosave = 1
command DoRainbowToggle call s:DoRainbowParenthesis()
command ReloadFiles call s:ReloadFiles()
command ToggleColorColumn call s:ToggleColorColumn()
command GatherTests call s:GatherTests()
command TrimTrailingWhitespace call s:TrimTrailingWhitespace()
command -nargs=1 CopyRegister execute "let @" . <q-args> . "=@\""
command Fork execute ":tabnew %"
" }}}
" Autocommands {{{
augroup vimrc
" Delete all autocommands in this group (so we don't set them twice...)
autocmd!
" Call appropriate functions for each filetype to do multiple things
autocmd BufNewFile,BufRead *.html,*.css,*.js call s:WebAutoCommands()
autocmd BufNewFile,BufRead *.hy call s:HyAutocommands()
autocmd FileType bash,sh call s:BashAutoCommands()
autocmd FileType bzl call s:BazelAutoCommands()
autocmd Filetype c call s:CAutoCommands()
autocmd FileType coffee call s:CoffeeScriptAutocommands()
autocmd FileType cpp call s:CppAutoCommands()
autocmd FileType css,scss call s:CssAutoCommands()
autocmd FileType go call s:GoAutocommands()
autocmd FileType haskell call s:HaskellAutocommands()
autocmd FileType htmldjango call s:HtmlDjangoAutoCommands()
autocmd FileType java call s:JavaAutocommands()
autocmd FileType js,javascript call s:JsAutoCommands()
autocmd FileType liquid setf liquid.html
autocmd FileType markdown call s:MarkdownAutoCommands()
autocmd FileType prolog call s:PrologAutocommands()
autocmd FileType purescript call s:PurescriptAutocommands()
autocmd FileType python call s:PythonAutocommands()
autocmd FileType racket call s:RacketAutocommands()
autocmd FileType rust call s:RustAutoCommands()
autocmd FileType scheme call s:SchemeAutocommands()
" autocmd FileType htmljinja setf htmljinja.html
autocmd FileType svg,html,htmljinja,liquid call s:HtmlAutoCommands()
autocmd FileType vim call s:VimAutoCommands()
autocmd FileType vimwiki call s:VimwikiAutocommands()
autocmd FileType yaml call s:YamlAutoCommands()
augroup END
function s:BashAutoCommands()
setl expandtab
setl tabstop=8
setl shiftwidth=4
setl softtabstop=-1 " Make it the same as shiftwidth
let g:ale_fix_on_save = 1
endfunction
function s:BazelAutoCommands()
setl expandtab
setl tabstop=8
setl shiftwidth=2 " 2 not 4 because Python double indents for some reason
setl softtabstop=-1 " Make it the same as shiftwidth
setl indentexpr=ftpython#GetIndent(v:lnum)
" setl indentexpr=clib#GetIndent()
endfunction
function s:CAutoCommands()
setl noexpandtab
setl tabstop=4
setl shiftwidth=4
Gcc
endfunction
function s:CoffeeScriptAutocommands()
function! Build()
write
silent !cake build
silent redraw!
endfunction
let coffee_cake_options='build'
let coffee_make_options='build'
compiler cake
"autocmd CursorHold *.coffee call Build()
noremap <F5> :call Build()<CR>
endfunction
function s:CppAutoCommands()
setl expandtab
setl softtabstop=2
setl tabstop=8
setl shiftwidth=2
setl cc=80
endfunction
function s:CssAutoCommands()
setl expandtab
setl tabstop=8
setl shiftwidth=4
setl softtabstop=-1 " Make it the same as shiftwidth
endfunction
function s:GoAutocommands()
setl noexpandtab
setl tabstop=2
setl shiftwidth=2
endfunction
function s:HaskellAutocommands()
setl expandtab
setl softtabstop=2
setl tabstop=8
setl shiftwidth=2
" augroup haskell_redraw
" autocmd!
" autocmd CursorMoved,CursorHold * redraw
" augroup END
highlight clear Conceal
setl nofoldenable
noremap gt :GhcModType<CR>
noremap gT :GhcModTypeClear<CR>
" setl omnifunc=necoghc#omnifunc
let g:necoghc_enable_detailed_browse = 1
let g:personal_prefer_coc = 1
" let g:ycm_filetype_blacklist = {
" \ 'haskell': 1
" \}
GhcRun
DoRainbowToggle
endfunction
function s:HtmlAutoCommands()
setl expandtab
setl tabstop=8
setl shiftwidth=2
setl softtabstop=-1 " Make it the same as shiftwidth
endfunction
function s:HtmlDjangoAutoCommands()
setl cc=80
endfunction
function s:HyAutocommands()
HyRun
endfunction
function s:JavaAutocommands()
abbreviate print System.out.println(
JavaRun
let g:syntastic_mode_map = {
\ 'mode': 'active',
\ 'active_filetypes': ['java'],
\}
endfunction
function s:JsAutoCommands()
setl expandtab
setl tabstop=8
setl shiftwidth=4
setl softtabstop=-1 " Make it the same as shiftwidth
endfunction
function s:MarkdownAutoCommands()
setl ft=markdown
setl linebreak
setl textwidth=80
endfunction
function s:PrologAutocommands()
NoWait
PrologRun
endfunction
function s:PurescriptAutocommands()
let g:personal_prefer_coc = 1