-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
2196 lines (1706 loc) · 60.2 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
set encoding=utf-8
scriptencoding utf-8
" =============================================================================
" This Source Code Form is subject to the terms of the Mozilla Public
" License, v. 2.0. If a copy of the MPL was not distributed with this file,
" You can obtain one at http://mozilla.org/MPL/2.0/.
"
" Copyright (c) 2015-2018, MPL Steven Hall <[email protected]>
"
" =============================================================================
" IMPORTANT NOTE: Do NOT set "gdefault" or "nogdefault". This vimrc file takes
" advantage of substitute commands. Therefore, setting one of these settings
" could mess up what was meant to happen in those substitute commands. If you
" are going to set one of these settings, make sure you change the substitute
" commands as necessary
" keys that I don't use so are free for mappings"{{{
"""" Normal Mode
" ^
" &
" # -- this has been remapped to <nop>
" -
" =
"}}}
" vim-plug Settings"{{{
if has('gui_running')
" Use the specified location, and suppress the git error.
silent call plug#begin('~/vim/vimfiles/plugged')
else
call plug#begin()
endif
" For fzf to have syntax highlighting in the preview window, install batcat
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'airblade/vim-rooter'
Plug 'pangloss/vim-javascript', {'for': [ 'javascript' ]}
Plug 'rrethy/vim-hexokinase', { 'do': 'make hexokinase' }
" Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'jwalton512/vim-blade', {'for' : ['blade']}
Plug 'mattn/emmet-vim', {'for' : ['html', 'php', 'blade']}
" switch from source & headers
Plug 'vim-scripts/a.vim', {'for' : ['c', 'cpp']}
Plug 'leafgarland/typescript-vim', {'for' : [ 'typescript' ]}
" Linting Engine
Plug 'w0rp/ale'
" Automatically print out paired characters like []
Plug 'jiangmiao/auto-pairs'
" Colourschemes
Plug 'dkasak/gruvbox'
Plug 'neovimhaskell/haskell-vim', {'for' : 'haskell' }
" CScope in vim
Plug 'brookhong/cscope.vim', {'for' : ['c', 'cpp']}
" Tries to detect indent settings of a file
Plug 'ciaranm/detectindent'
" Gravity syntax highlighting
Plug 'hallzy/gravity.vim', {'for' : 'gravity'}
" Shows vertical lines to show the indentation level
Plug 'Yggdroot/indentLine'
" Lightline Related
Plug 'itchyny/lightline.vim'
" File tree for vim
Plug 'scrooloose/nerdtree'
" Automatically alternates from relative to absolute line numbers depending on
" the editing mode I am in
Plug 'myusuf3/numbers.vim'
" Align text from different lines (I have this mapped to <leader>tz)
Plug 'godlygeek/tabular'
" Similar but offers a vim-like motion which is better in some cases, but it
" doesn't support as many delimiters as tabular
" NOTE that I found out regex's can be used for vim-easy-align which means it is
" probably actually a better option that tabular now.
Plug 'junegunn/vim-easy-align'
" Adds a bunch of text objects including pairs of brackets or tags which also
" work over multiple lines, separators like commas, function arguments etc.
Plug 'wellle/targets.vim'
" Makes abbreviations easier by allowing multiple versions of a word and also
" matching cases. It also has a substitution command, and a search command.
" Instead of the normal substitution command, use ':Subvert' or ':S'. If subvert
" only has 1 argument it does a search.
" Also coercion to change text between snake_case, camelCase, MixedCase etc
Plug 'tpope/vim-abolish'
" If a file is already open in another terminal window, don't open it again,
" just focus that window for me.
Plug 'gioele/vim-autoswap'
" Toggle comments
Plug 'tpope/vim-commentary'
Plug 'hallzy/vim-context-commentstring'
" Dims inactive splits
Plug 'blueyed/vim-diminactive'
" Ends certain structures automatically, such as bash if statements, or vim
" functions etc.
Plug 'tpope/vim-endwise'
" A large list of common misspellings that will automatically be fixed.
Plug 'chip/vim-fat-finger'
" A git wrapper for vim, for example Gblame, Gstatus
Plug 'tpope/vim-fugitive'
" Support for encrypted files. If I try opening an encrypted file in vim it
" automatically runs GPG and prompts me to decrypt it for me.
Plug 'jamessan/vim-gnupg'
" Sublime style multiple cursors
Plug 'mg979/vim-visual-multi'
" Rename multiple files/folders using the power of vim
Plug 'qpkorr/vim-renamer'
" Used by many plugins to support being repeated with the '.' command
Plug 'tpope/vim-repeat'
" A better version of Damian Conway's DragVisuals
Plug 'zirrostig/vim-schlepp'
" Custom Motions
Plug 'christoomey/vim-sort-motion'
Plug 'chaoren/vim-wordmotion'
" Add, modify, or remove surround characters like quotes.
Plug 'tpope/vim-surround'
" Easy creation and modification of tables. Toggle with <leader>tm
Plug 'dhruvasagar/vim-table-mode'
"Custom text objects
Plug 'glts/vim-textobj-comment'
Plug 'kana/vim-textobj-fold'
Plug 'kana/vim-textobj-function'
Plug 'kana/vim-textobj-indent'
Plug 'kana/vim-textobj-line'
Plug 'kana/vim-textobj-user'
Plug 'kentaro/vim-textobj-function-php', {'for' : ['php', 'blade']}
" vim linter
Plug 'syngan/vim-vimlint', {'for' : 'vim'}
Plug 'vim-jp/vim-vimlparser', {'for' : 'vim'}
" Block sorting. Differs from the sort motion in that I can select a visual
" block to sort by even if it isn't the first character of the line
Plug 'yaroot/vissort'
" Use ++ to calculate a block of numbers using sums, averages etc
Plug 'gavinbeatty/vmath.vim'
" Damian Conway's yankmatches. It yanks or cuts all lines that contain a match
" for your search
Plug 'hallzy/yankmatches.vim'
" Delete duplicated lines without sorting
Plug 'hallzy/delete-duplicate-lines.vim'
" This is separated from the rest of the list because it has to be after
" vim-textobj-comment, otherwise the comment text-object doesn't take effect.
Plug 'airblade/vim-gitgutter'
Plug 'hallzy/expression-evaluator.vim'
Plug 'StanAngelOff/php.vim', {'for' : ['php', 'blade']}
Plug 'hallzy/vim-php-manual', {'for' : ['php', 'blade']}
Plug 'linuxmagic/vdebug', {'for' : ['php', 'blade']}
call plug#end()
"}}}
" Settings"{{{
filetype plugin indent on
set shell=/bin/bash
set title titlestring=
set clipboard=unnamedplus
" Disable mouse
set mouse=
set ttyfast
set lazyredraw
" Allow project specific vimrc files
" set exrc
" Prevents autocmd, shell, and write command from being run inside
" project-specific vimrc files.
" set secure
let $PATH='/usr/local/bin:' . $PATH
" Reduce timeout after <ESC> is received. This is only a good idea on fast links
set ttimeout
set ttimeoutlen=3
set timeoutlen=1
set notimeout
" Turn off column and cursor highlight when leaving a vim window, and turn them
" on when entering
augroup highlightCursorLine
autocmd!
autocmd WinLeave * set nocursorline nocursorcolumn
autocmd WinEnter * set cursorline cursorcolumn
augroup END
" Start with highlighted columns and lines
set cursorline
set cursorcolumn
" Leave paste mode on exit of insert mode
augroup pastegroup
autocmd!
autocmd InsertLeave * set nopaste
augroup END
set backspace=2 " Backspace deletes like most programs in insert mode
set nobackup
set nowritebackup
" When editing a file, always jump to the last known cursor position.
set history=500
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
set hlsearch " highlight matches
set laststatus=2 " Always display the status line
set autowrite " Automatically :write before running commands
set autoread " If the current file is updated elsewhere auto update it
set showmatch " Shows the matching bracket or brace
set tildeop " Tilde (~) changes case of letter. Setting this option
" lets the tilde have movement options
set pastetoggle=<f2> " The toggle for paste mode is F2
set spelllang=en_ca
set spell
set nostartofline " when using gg or G, stay in the same column
set virtualedit=block " Allow block selections to go past the last characters
set termguicolors " Enables 24-bit RGB colours
set nrformats=hex,bin
syntax on
" Only do syntax highlighting for the first 81 columns. This improves
" performance for files with massively long lines like for example, a json file.
" Normally vim would slow to a crawl, but this prevents that. Given that columns
" past 80 don't highlight for me anyways, this makes no visual difference for me
" anyways.
" set synmaxcol=81
set textwidth=80
set colorcolumn=81
" Softtabs, 4 spaces
set tabstop=4
set shiftwidth=4
set expandtab
" Display extra white space
set list listchars=tab:>-,trail:-
set t_Co=256
" Ignore case sensitivity, unless I specify an Uppercase character. Then the
" string is case sensitive
set smartcase
set ignorecase
" With both of these set, I get relative numbers, but the current line gets the
" line number - Hybrid Numbering
set number
set relativenumber
set numberwidth=5
set undolevels=1000
" Open new split panes to right and bottom, which feels more natural
set splitbelow
set splitright
" Use markers for folds
set foldmethod=marker
" Keep the cursor within 10 lines of the bottom and top
set scrolloff=10
"}}}
" Mappings"{{{
" Leader"{{{
" Leader Mappings
map <Space> <leader>
"}}}
" Tab Navigation"{{{
" Firefox like tab manipulations (except next and previous because <c-tab> does
" not work :(
nnoremap <leader>tp :tabprevious<cr>
nnoremap <leader>tn :tabnext<cr>
nnoremap <C-t> :tabnew<cr>
nnoremap <C-w>t :tabclose<cr>
"}}}
" Line Number Toggle"{{{
" Toggle for line numbers for easy copy/paste
nnoremap <leader>N :setlocal number!<cr>:setlocal relativenumber!<cr>
"}}}
" Resize Split Windows"{{{
"Arrow keys expand and shrink vim split
nnoremap <Left> <C-w><
nnoremap <Right> <C-w>>
nnoremap <Up> <C-w>+
nnoremap <Down> <C-w>-
"}}}
" Better Split Window Movement"{{{
" Use ctrl+j to move to the window below, ctrl+k to move to the window above,
" etc.
nnoremap UJ <C-W>j
nnoremap UK <C-W>k
nnoremap UL <C-W>l
nnoremap UH <C-W>h
if has ('nvim')
tnoremap <esc> <C-\><C-n>
tnoremap UJ <C-\><C-n><C-w>j
tnoremap UK <C-\><C-n><C-w>k
tnoremap UL <C-\><C-n><C-w>l
tnoremap UH <C-\><C-n><C-w>h
endif
" Move splits with U<movement>
nnoremap Uj <C-W>J
nnoremap Uk <C-W>K
nnoremap Ul <C-W>L
nnoremap Uh <C-W>H
"}}}
" Change what "*" does"{{{
" Make * search the currently selected word, without going to the next result
nnoremap * *N
"}}}
" Shortcut for opening vimrc"{{{
" Open .vimrc in a vsplit with <space>ev
" If $MYVIMRC does not work as a path, either add it, or replace it with the
" path of your vimrc file.
nnoremap <leader>ev :vsplit $MYVIMRC<cr>
"}}}
" Shortcut for sourcing vimrc"{{{
" If $MYVIMRC does not work as a path, either add it, or replace it with the
" path of your vimrc file.
nnoremap <leader>sev :source $MYVIMRC<cr>
"}}}
"German Chars"{{{
" ä
inoremap a'' <c-k>:a
" Ä
inoremap A'' <c-k>:A
" ö
inoremap o'' <c-k>:o
" Ö
inoremap O'' <c-k>:O
" ü
inoremap u'' <c-k>:u
" Ü
inoremap U'' <c-k>:U
" ß
inoremap ss' <c-k>ss
"}}}
" Remove search highlighting"{{{
" In normal mode, press leader s and search result highlighting will go off.
nnoremap <leader>hl :nohlsearch<cr>
"}}}
" Move a Line, or selected lines up or down"{{{
"Both methods work but do slightly different things
" The first one moves the lines inside of folds when you hit a fold
" The second one moves the lines over the fold, as if the fold was a single line
" Other than these differences, they function exactly the same
" First Method"{{{
" As of about vim 7.4 patch 700 these :m mappings cause all my folds to collapse
" As a result, these mappings needed to become more complex, by setting the
" foldmethod to manual, and then to marker afterwards
" With a J move the current line up, with K move the current line down.
" nnoremap J :set foldmethod=manual<cr>:m .+1<CR>==:set foldmethod=marker<cr>
" nnoremap K :set foldmethod=manual<cr>:m .-2<CR>==:set foldmethod=marker<cr>
" With a J move the current Selected lines up, with K move the current selected lines down.
" vnoremap J :set foldmethod=manual<cr>'<V'>:m '>+1<CR>gv=:set foldmethod=marker<cr>gv
" vnoremap K :set foldmethod=manual<cr>'<V'>:m '<-2<CR>gv=:set foldmethod=marker<cr>gv
"}}}
" Second Method"{{{
" With a J move the current line up, with K move the current line down.
nnoremap K :call MoveLineUp()<cr>
nnoremap J ddp==
" With a J move the current Selected lines up, with K move the current selected lines down.
vnoremap K <esc>:call MoveSelectionUp()<cr>
vnoremap J <esc>'<V'>dp`[V`]=gv
"}}}
"}}}
" H and L move to the beginning and end of the line"{{{
" If I am on the first character of a line, and press H, take me to the
" first column. Otherwise take me to the first non white space character of the
" line.
nnoremap <silent> H :call HMapping()<cr>
onoremap <silent> H :call HMapping()<cr>
vnoremap <silent> H <esc>:call HMappingVisual()<cr>
nnoremap <silent> L :call LMapping()<cr>
onoremap <silent> L g_
vnoremap <silent> L <esc>:call LMappingVisual()<cr>
"}}}
" Escape removes trailing white space from eol"{{{
nnoremap <leader>tws :%s/\s\+$//g<cr>
"}}}
" > and <"{{{
" Now when I try to move several lines at once sideways, the visual selection
" stays selected so that I can move it multiple times easily.
vnoremap > >gv
vnoremap < <gv
"}}}
" Visually select the last pasted item"{{{
nnoremap gV `[v`]
"}}}
" Remap the Default usage of J"{{{
" I like using J to move the current line down. But the default function of J is
" very useful, so I am mapping it to Q because I don't use Q (Does anyone
" actually use Q?)
" Before I had this mapping, I remapped Q to nop to avoid accidentally pressing
" it. I am leaving it here commented so that If I change the below mapping, I
" won't forget to nop it again
" nnoremap Q <nop>
nnoremap Q J
vnoremap Q J
"}}}
" Extra mappings for saving and closing vim"{{{
nnoremap ZX :qa!<cr>
nnoremap ZA :wqa<cr>
nnoremap ZS :w<cr>
" When using q: or q/ or q? for some reason ZQ doesn't seem to work. Creating an
" explicit mapping makes it work.
nnoremap ZQ :q!<cr>
"}}}
" _ is now K - but special"{{{
" _ behaves like the default K, except for files of the "vim" or "help"
" file types, where it opens help
nnoremap <expr> _ OpenHelp()
vnoremap <expr> _ OpenHelp()
"}}}
" Use apostrophe instead of a back tick for going to marks"{{{
nnoremap ' `
"}}}
" ctrl+m, ctrl+h, ctrl+l"{{{
" ctrl+h moves cursor to the top of the screen
noremap <c-h> H
" ctrl+l moves cursor to the bottom of the screen
noremap <c-l> L
" zh moves the current line to the top of the screen
noremap zh zt
" zm moves the current line to the middle of the screen
noremap zm zz
" zh moves the current line to the top of the screen
noremap zl zb
" Move down and put the cursor and line at the top of the file. Also treat
" wrapped lines as new lines when moving up and down
noremap j gjzt
" Move up and put the cursor and line at the bottom of the file. Also treat
" wrapped lines as new lines when moving up and down
noremap k gkzb
" easier combinations. Consider the scenario where I use j to move down to a
" line, but I go past the line. Then I press k to go back up to the line, but
" now my cursor is towards the bottom of the screen when I would prefer it to be
" at the top, as if I was pressing j to go down, but without moving to the line
" below. Basically, these mappings shift the screen just as j and k do, but
" without moving my cursor up or down a line.
noremap <c-k> zb
noremap <c-j> zt
"}}}
" Fix previous and next spelling mistakes"{{{
nnoremap <silent> <leader>sp :normal! mzw[s1z=`z<cr>:delmarks z<cr>
nnoremap <silent> <leader>sn :normal! mz]s1z=`z<cr>:delmarks z<cr>
"}}}
" Command line mode"{{{
" Custom mappings for command line mode so that the default / ? and : keys open
" command line mode
nnoremap / q/i
vnoremap / q/i
nnoremap ? q?i
vnoremap ? q?i
nnoremap : q:i
vnoremap : q:i
" Also, preserve a way to get the original functionality back. For instance, if
" I want the default behaviour, or if I am recording a macro. As you can see
" with the above commands, it first performs a "q" command, which closes a
" macro. So doing either of those in a macro stops the macro and I need these 4
" following mappings to get around that.
nnoremap <leader>/ /
vnoremap <leader>/ /
nnoremap <leader>? ?
vnoremap <leader>? ?
nnoremap <leader>: :
vnoremap <leader>: :
"}}}
" Vim Easy-Mode"{{{
" This is a mode for others to use. Because my vimrc is so customized, I imagine
" it being difficult for others to use. This will load the open file with a
" minimalistic vimrc file.
nnoremap <silent> <leader>em :!vim -u $dotfiles/.vimrc-others %<cr>
"}}}
" Units"{{{
" Convert units using the external units command
nnoremap <silent> <leader>u :call Units()<cr>
"}}}
" Bold a words using markdown syntax"{{{
nnoremap <c-b> viw<esc>a**<esc>`<i**<esc>
vnoremap <c-b> <esc>`>a**<esc>`<i**<esc>
"}}}
" Insert the current date"{{{
nnoremap <leader>icd i<C-R>=strftime('%Y/%m/%d')<cr><esc>
"}}}
"}}}
" abbrevs"{{{
" spelling"{{{
" These are all in ~/.vim/after/plugin/abolish.vim
"}}}
" Greek Alphabet"{{{
inoremap alpha'' α
inoremap Alpha'' Α
inoremap beta'' β
inoremap Beta'' Β
inoremap gamma'' γ
inoremap Gamma'' Γ
inoremap delta'' δ
inoremap Delta'' Δ
inoremap epsilon'' ε
inoremap Epsilon'' Ε
inoremap zeta'' ζ
inoremap Zeta'' Ζ
inoremap eta'' η
inoremap Eta'' Η
inoremap theta'' θ
inoremap Theta'' Θ
inoremap iota'' ι
inoremap Iota'' Ι
inoremap kappa'' κ
inoremap Kappa'' Κ
inoremap lambda'' λ
inoremap Lambda'' Λ
inoremap mu'' μ
inoremap Mu'' Μ
inoremap nu'' ν
inoremap Nu'' Ν
inoremap xi'' ξ
inoremap Xi'' Ξ
inoremap omicron'' ο
inoremap Omicron'' Ο
inoremap pi'' π
inoremap Pi'' Π
inoremap rho'' ρ
inoremap Rho'' Ρ
inoremap sigma'' σ
inoremap Sigma'' Σ
inoremap tau'' τ
inoremap Tau'' Τ
inoremap upsilon'' υ
inoremap Upsilon'' Υ
inoremap phi'' φ
inoremap Phi'' Φ
inoremap chi'' χ
inoremap Chi'' Χ
inoremap psi'' ψ
inoremap Psi'' Ψ
inoremap omega'' ω
inoremap Omega'' Ω
"}}}
" Math"{{{
inoremap forall'' ∀
inoremap thereexists'' ∃
inoremap therefore'' ∴
inoremap because'' ∵
inoremap in'' ∈
inoremap notin'' ∉
inoremap intersect'' ∩
inoremap union'' ∪
inoremap subset'' ⊂
inoremap subset_eq'' ⊆
inoremap integral'' ∫
inoremap double_integral'' ∬
inoremap natural'' ℕ
inoremap integer'' ℤ
inoremap rational'' ℚ
inoremap real'' ℝ
inoremap complex'' ℂ
inoremap prime'' ℙ
inoremap join'' ⋈
"}}}
" Other"{{{
inoremap degrees'' °
"}}}
"}}}
" Plugins"{{{
" NERDTree"{{{
function! OpenNerdTreeStartup()
NERDTree
exec "normal! \<c-w>l"
endfun
augroup NerdTreeStartup
autocmd!
" Start nerdtree automatically if I give vim a file name
autocmd VimEnter * call OpenNerdTreeStartup()
" New tabs, open nerdtree too
autocmd BufWinEnter * silent! NERDTreeMirror
augroup END
" Toggle nerdtree
noremap <F8> :NERDTreeToggle<CR>
" Current file in nerdtree
noremap <F9> :NERDTreeFind<CR>
"}}}
" vmath"{{{
"For using vmath.vim
vnoremap ++ y:call VMATH_Analyse()<CR>
nnoremap ++ vipy:call VMATH_Analyse()<CR>
"}}}
" vim-schlepp "{{{
" Improved form of dragvisuals
" Move
vmap <up> <Plug>SchleppUp
vmap <down> <Plug>SchleppDown
vmap <left> <Plug>SchleppLeft
vmap <right> <Plug>SchleppRight
" Duplicate
vmap Dk <Plug>SchleppDupUp
vmap Dj <Plug>SchleppDupDown
vmap Dh <Plug>SchleppDupLeft
vmap Dl <Plug>SchleppDupRight
let g:Schlepp#allowSquishingLines = 1
let g:Schlepp#allowSquishingBlocks = 1
" " Remove any introduced trailing white space after moving...
let g:Schlepp#dupTrimWS = 1
"}}}
" vim-gitgutter"{{{
" This makes the diff updates happen more frequently. The default is 4000. This
" value is measured in ms.
set updatetime=1000
nmap ]h <Plug>(GitGutterNextHunk)
nmap [h <Plug>(GitGutterPrevHunk)
" Now the sign column will always be open
set signcolumn=yes
"}}}
" Lightline - Status Bar"{{{
" Use the powerline theme
let g:lightline = {
\ 'colorscheme': 'gruvbox',
\ 'component': {
\ 'fugitive': '%{exists("*fugitive#head")?"BR: " . fugitive#head():""}',
\ 'lineinfo': "LN %l/%{line('$')}",
\ 'colinfo': 'COL %-2v',
\ 'charvaluehex' : 'char: 0x%B',
\ },
\ 'component_visible_condition': {
\ 'fugitive': '(exists("*fugitive#head") && ""!=fugitive#head())',
\ },
\ }
" This is where I define a variable to a function
" I used to use this but I left it here as an example in case I want to use this
" in the future. The total number of lines is done above in lineinfo
" TotalNumberOfLines will contain the number of lines in a file.
" let g:lightline.component_function = {
" \ 'totalNumberOfLines': 'NumberOfLinesFunction',
" \ }
" The layout of lightline when it is the active window
" Left Side
" Mode | Paste Mode || Branch | Read Only | Relative Path | Modified ||
"Right Side
" Format | Encoding | Filetype || Percent || line info | column ||
let g:lightline.active = {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'fugitive', 'readonly', 'relativepath', 'modified' ]],
\ 'right': [ [ 'lineinfo', 'colinfo', 'charvaluehex' ],
\ [ 'percent' ],
\ [ 'fileformat', 'fileencoding', 'filetype' ] ] }
" The layout of lightline when it is not the active window
" Left Side
" Read Only | Relative Path | Modified ||
"Right Side
" Percent || line info | column ||
let g:lightline.inactive = {
\ 'left': [ [ 'readonly', 'relativepath', 'modified' ] ],
\ 'right': [ [ 'lineinfo', 'colinfo', 'charvaluehex' ],
\ [ 'percent' ] ] }
" The layout of lightline for the tab line when tabs exist.
let g:lightline.tabline = {
\ 'left': [ [ 'tabs' ] ] }
"}}}
" ALE"{{{
nnoremap <silent> ]e :ALENextWrap<cr>
nnoremap <silent> [e :ALEPreviousWrap<cr>
"}}}
" Cscope"{{{
set cscopetag
nnoremap <leader>fa :call CscopeFindInteractive(expand('<cword>'))<CR>
nnoremap <leader>ll :call ToggleLocationList()<CR>
"}}}
" Tabularize Mapping"{{{
noremap <leader>tz :Tabularize /
"}}}
" EasyAlign"{{{
xmap ga <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)
vnoremap <silent> <Enter> :EasyAlign<cr>
"}}}
" Vissort"{{{
" Make vissort case insensitive
let g:vissort_option= 'i'
"}}}
" Vim table mode"{{{
" Make the tables markdown compatible
let g:table_mode_corner='|'
"}}}
" vim-surround"{{{
let b:surround_indent = 1
"}}}
" DetectIndent"{{{
" NOTE: Specific filetype settings can be set in ~/.vim/after/ftplugin
" When the correct value of expandtab cannot be determined, treat it as though
" expandtab is set, meaning that pressing tab gives x number of spaces
let g:detectindent_preferred_expandtab = 1
" When indent size cannot be determined use 4
let g:detectindent_preferred_indent = 4
" Automatically run detectIndent
augroup detectIndentGroup
autocmd!
autocmd BufReadPost * :DetectIndent
augroup END
function! CheckExpandTab()
" If expandtab is off, then set the tabs to be 4 columns long
if (&expandtab == 0)
set tabstop=4
endif
endfunction
augroup checkExpandTabGroup
autocmd!
autocmd BufReadPost * :call CheckExpandTab()
augroup END
"}}}
" Indentline"{{{
let g:indentLine_char = '│'
let g:indentLine_first_char='│'
let g:indentLine_showFirstIndentLevel=1
" Use the colour of gruvbox comments. Looks descent for my colourschemes
let g:indentLine_color_term = 245
let g:indentLine_color_gui = '#928374'
"}}}
" vim-gnupg"{{{
" Source an external file that contains recipients. I keep it external so I don't
" push identities of people I know. Identities can be found using the
" \"gpg--list-keys" Command. The gpg_recipients.vim file looks like this:
" let g:GPGPossibleRecipients=[
" \"Steven Hall <[email protected]>",
" \"Someone Else <[email protected]>"
" \]
if filereadable($dotfiles . '/gpg_recipients.vim')
source $dotfiles/gpg_recipients.vim
endif
"}}}
" Renamer"{{{
nmap <leader>rr <Plug>RenamerStart
nnoremap <leader>rs :Ren<cr>
nnoremap <leader>rd :call renamer#DeleteEntry()<CR>
"}}}
" vim-diminactive"{{{
" Dim inactive splits
let g:diminactive_enable_focus = 1
"}}}
" yankmatches"{{{
" YankMatches is used to yank complete lines that have a search term on them
" into one register for easy pasting.
" Delete all lines that match the search
" Saves the deleted lines in a register
nnoremap <silent> dm : call ForAllMatches('delete', {})<CR>
" Delete all lines that DON'T match the search
" Saves the deleted lines in a register
nnoremap <silent> dM : call ForAllMatches('delete', {'inverse':1})<CR>
" Copies all lines that match the search
" Saves those copied lines into a register
nnoremap <silent> ym : call ForAllMatches('yank', {})<CR>
" Copies all lines that DON'T match the search
" Saves those copied lines into a register
nnoremap <silent> yM : call ForAllMatches('yank', {'inverse':1})<CR>
" Deletes all lines that match the search that are inside your visual selection
" Saves those deleted lines into a register
vnoremap <silent> Dm :<C-U>call ForAllMatches('delete', {'visual':1})<CR>
" Deletes all lines that DON'T match the search that are inside your visual
" selection
" Saves those deleted lines into a register
vnoremap <silent> DM :<C-U>call ForAllMatches('delete', {'visual':1, 'inverse':1})<CR>
" Copies all lines that match the search that are inside your visual selection
" Saves those copied lines into a register
vnoremap <silent> Ym :<C-U>call ForAllMatches('yank', {'visual':1})<CR>
" Copies all lines that DON'T match the search that are inside your visual
" selection
" Saves those copied lines into a register
vnoremap <silent> YM :<C-U>call ForAllMatches('yank', {'visual':1, 'inverse':1})<CR>
"}}}
" vim-wordmotion"{{{
" Set this to the characters you want to treat the same as a space. This means
" that the w, e, b, and ge movements won't stop on these characters.
" The default is set to '_'.
" Example of multiple characters is '_.-'
" I am setting it to nothing so that i can use them as stopping points for a
" motion
let g:wordmotion_spaces = ''
"}}}
" vim-commentary"{{{
" Custom vim-commentary filetype specific comments
augroup vimCommentary
autocmd!
" VBScript uses a single quote to denote comments
autocmd FileType vb setlocal commentstring='\ %s