-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.vimrc
More file actions
829 lines (676 loc) · 22.8 KB
/
.vimrc
File metadata and controls
829 lines (676 loc) · 22.8 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
set nocompatible
if (has('termguicolors'))
set termguicolors
endif
syntax on
let mapleader = ','
cabbrev help tab help
""""""""""""""""" Vim Tweaking
" Quickly edit/reload the vimrc file
nmap <silent> <leader>ev :e $MYVIMRC<CR>
nmap <silent> <leader>sv :so $MYVIMRC <BAR> :so $MYGVIMRC<CR>
" Highlight matching parens
set showmatch
" Disable Ex mode (who/what still uses this?)
nnoremap Q <nop>
""""""""""""""""" Encoding
set encoding=utf-8
""""""""""""""""" Clipboard
if !has('nvim')
set clipboard=autoselectplus
endif
if has('nvim')
set clipboard+=unnamedplus
endif
""""""""""""""""" Whitespace
set shiftround
set tabstop=2 shiftwidth=2 softtabstop=2
set expandtab
set smarttab
set smartindent
" set list listchars=tab:»·,trail:·,precedes:<,extends:>
if has('multi_byte') && &encoding ==# 'utf-8'
" set list listchars=tab:\|·,trail:·,precedes:<,extends:>
set list
let &listchars = 'tab:⌐·,extends:»,precedes:«,nbsp:±,trail:·'
let &fillchars = 'diff:▚'
" let &showbreak = '↪ '
highlight VertSplit ctermfg=242
endif
set backspace=start,indent,eol
""""""""""""""""" Search
set hlsearch
set incsearch
set ignorecase
set smartcase
""""""""""""""""" Status Bar
set laststatus=2
set report=0
set noshowcmd
set noshowmode
set statusline= " clear the statusline when vimrc is reloaded
set statusline+=%1*\ %-3.3n\ " buffer number
set statusline+=%2*\ %t " file basename
set statusline+=%h%m%r%w\ " flags
set statusline+=[%{strlen(&ft)?&ft:'none'}, " filetype
set statusline+=%{strlen(&fenc)?&fenc:&enc}, " encoding
set statusline+=%{&fileformat}]\ " file format
set statusline+=%= " right align
set statusline+=%3*%{synIDattr(synID(line('.'),col('.'),1),'name')!=''?synIDattr(synID(line('.'),col('.'),1),'name'):'none'} " highlight
set statusline+=%4*\ %3b,0x%-8B " current char
set statusline+=%-14.(%l/%L,%c%)\ %<%P " offset
""""""""""""""""" Terminal
set ttyfast
set mouse=a
set paste
if !has('nvim')
set ttymouse=xterm2
endif
""""""""""""""""" Visual Junk
set ruler
set visualbell
set noerrorbells
set cursorline
""""""""""""""""" Completion
set wildmenu
set wildmode=list:longest,full
set wildignore+=*.o,.git,*.class,*.gif,*.png,*.jpg,*.pyc
set wildignore+=*/tmp/*,*.so,*.swp,*.zip
""""""""""""""""" Folding
set foldmethod=syntax
set foldnestmax=3
set nofoldenable
" Enable folding with the spacebar
" nnoremap <space> za
""""""""""""""""" Line Numbering
set number
set relativenumber
autocmd VimEnter * nmap <silent> <leader>n :set nonumber! norelativenumber!<CR>
""""""""""""""""" Window Title
set title
if !has("gui_macvim")
set t_ts=k
set t_fs=\
autocmd BufEnter * let &titlestring = 'Vim - ' . expand("%:t")
endif
""""""""""""""""" viminfo and history
if !has('nvim')
set history=1000
set viminfo='10,\"100,:20,%,n~/.viminfo
endif
""""""""""""""""" modeline config
set modeline
set modelines=10
""""""""""""""""" default directories
set backupdir=~/.vim/backup
set directory=~/.vim/backup
""""""""""""""""" redraw and clear search
nnoremap <C-L> :nohls<CR><C-L>
inoremap <C-L> <C-O>:nohls<CR>
""""""""""""""""" vimgrep result navigation
map <A-o> :copen<CR>
map <A-w> :cclose<CR>
map <A-j> :cnext<CR>
map <A-k> :cprevious<CR>
""""""""""""""""" Visual search
function! s:VSetSearch()
let temp = @@
norm! gvy
let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g')
let @@ = temp
endfunction
vnoremap * :<C-u>call <SID>VSetSearch()<CR>//<CR>
vnoremap # :<C-u>call <SID>VSetSearch()<CR>??<CR>
""""""""""""""""" Initial cursor position
"jump to last cursor position when opening a file
"dont do it when writing a commit log entry
autocmd BufReadPost * call SetCursorPosition()
function! SetCursorPosition()
if &filetype !~ 'commit\c'
if line("'\"") > 0 && line("'\"") <= line("$")
exe "normal! g`\""
normal! zz
endif
end
endfunction
""""""""""""""""" Textmate-like indent/outdent
nmap <D-[> <<
nmap <D-]> >>
imap <D-[> <<
imap <D-]> >>
vmap <D-[> <gv
vmap <D-]> >gv
""""""""""""""""" MacVIM shift+arrow-keys
let macvim_hig_shift_movement = 1
""""""""""""""""" diff mode
if &diff
set diffopt+=iwhite
endif
""""""""""""""""" disable annoying keybinds
map K <nop>
""""""""""""""""" format options
set formatoptions=crql
" set formatoptions=crqn
""""""""""""""""" ctags
map <leader>rt :!ctags --extra=+f -R *<CR><CR>
map <C-\> :tnext<CR>
set tags+=tags;$HOME
""""""""""""""""" text wrapping
if !exists("*s:setupWrapping")
function s:setupWrapping()
set wrap
set wrapmargin=2
set textwidth=72
endfunction
endif
" Format text files
au BufRead,BufNewFile *.txt,*.md call s:setupWrapping()
""""""""""""""""" file formatting
" These files are Ruby
autocmd BufRead,BufNewFile config.ru,{Brew,Gem,Guard,Rake,Thor}file set filetype=ruby
" PostgreSQL config
autocmd BufRead,BufNewFile .psqlrc set filetype=sql
" cson (coffeescript)
au BufNewFile,BufRead *.cson set filetype=coffee
" various rc files (json)
au BufNewFile,BufRead .{babel,eslint,stylelint}rc set filetype=json
au BufNewFile,BufRead .{direnv,env}rc set filetype=sh
" make javascript prettier
" au FileType javascript set formatprg=prettier\ --stdin
" au BufWritePre *.js :normal gggqG
" au BufWritePre *.js exe 'normal! gggqG\<C-o>\<C-o>'
" md, markdown, and mk are markdown and define buffer-local preview
au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn} call s:setupMarkup()
if !exists("*s:setupMarkup")
function s:setupMarkup()
call s:setupWrapping()
map <buffer> <leader>p :Hammer<CR>
endfunction
endif
" crontab stuff
au filetype crontab setlocal nobackup nowritebackup
" python
" au FileType python setl tabstop=4 shiftwidth=4 softtabstop=4 textwidth=99 colorcolumn=101
au FileType python setl tabstop=4 shiftwidth=4 softtabstop=4
highlight BadWhitespace ctermbg=red guibg=red
autocmd BufRead,BufNewFile *.py,*.pyw match BadWhitespace /^\t\+/
let g:pyindent_open_paren = 'shiftwidth()'
let python_highlight_all = 1
" -- virtualenv support
" python << EOF
" import os
" if 'VIRTUAL_ENV' in os.environ:
" project_base_dir = os.environ['VIRTUAL_ENV']
" activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
" exec(compile(open(activate_this).read(), activate_this, 'exec'), dict(__file__=activate_this))
" EOF
""""""""""""""""" cscope
if has('cscope')
set csprg=/opt/homebrew/bin/cscope
set csto=0
set cscopetag
set nocscopeverbose
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add database pointed to by environment
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set cscopeverbose
if has('quickfix')
set cscopequickfix=s-,c-,d-,i-,t-,e-
endif
" Using 'CTRL-spacebar' then a search type makes the vim window
" split horizontally, with search result displayed in
" the new window.
nmap <C-Space>s :scs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>g :scs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>c :scs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>t :scs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>e :scs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>f :scs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-Space>i :scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-Space>d :scs find d <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>a :scs find a <C-R>=expand("<cword>")<CR><CR>
" Hitting CTRL-space *twice* before the search type does a vertical
" split instead of a horizontal one
nmap <C-Space><C-Space>s
\:vert scs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>g
\:vert scs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>c
\:vert scs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>t
\:vert scs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>e
\:vert scs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>i
\:vert scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-Space><C-Space>d
\:vert scs find d <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>a
\:vert scs find a <C-R>=expand("<cword>")<CR><CR>
" cnoreabbrev cfa cs add
" cnoreabbrev cff cs find
" cnoreabbrev cfk cs kill
" cnoreabbrev cfr cs reset
" cnoreabbrev cfs cs show
" cnoreabbrev cfh cs help
command! -nargs=0 Cscope cs add $VIMSRC/src/cscope.out $VIMSRC/src
endif
""""""""""""""""" session management
set sessionoptions-=folds " don't track folds
set sessionoptions-=options " don't track global and local values
" " Creates a session
" function! MakeSession()
" let b:sessiondir = $HOME . '/.vim/sessions' . getcwd()
" if (filewritable(b:sessiondir) != 2)
" exe 'silent !mkdir -p ' b:sessiondir
" redraw!
" endif
" let b:sessionfile = b:sessiondir . '/session.vim'
" exe 'mksession! ' . b:sessionfile
" endfunction
"
" " Updates a session, but only if it already exists
" function! UpdateSession()
" let b:sessiondir = $HOME . '/.vim/sessions' . getcwd()
" let b:sessionfile = b:sessiondir . '/session.vim'
" if (filereadable(b:sessionfile))
" exe 'mksession! ' . b:sessionfile
" echo 'updating session'
" endif
" endfunction
"
" " Loads a session if it exists
" function! LoadSession()
" if argc() == 0
" let b:sessiondir = $HOME . '/.vim/sessions' . getcwd()
" let b:sessionfile = b:sessiondir . '/session.vim'
" if (filereadable(b:sessionfile))
" exe 'source ' b:sessionfile
" else
" echo 'No session loaded.'
" endif
" else
" let b:sessionfile = ''
" let b:sessiondir = ''
" endif
" endfunction
"
" au VimEnter * nested :call LoadSession()
" au VimLeave * :call UpdateSession()
" map <leader>m :call MakeSession()<CR>
""""""""""""""""" ultisnips
let g:UltiSnipsExpandTrigger = "<c-enter>"
let g:UltiSnipsJumpForwardTrigger = "<c-k>"
let g:UltiSnipsJumpBackwardTrigger = "<c-j>"
""""""""""""""""" vim-gitgutter
" let g:gitgutter_highlight_lines = 1
let g:gitgutter_diff_args = '-w'
" not exactly a vim-gitgutter setting, but related
set updatetime=250
""""""""""""""""" CtrlP
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_use_caching = 0
" let g:ctrlp_clear_cache_on_exit = 0
" let g:ctrlp_cache_dir = $HOME.'/.vim/cache/ctrlp'
let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' }
let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:25,results:25'
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_user_command = ['.git', 'git --git-dir=%s/.git ls-files -co --exclude-standard']
" let g:ctrlp_reuse_window = 'netrw'
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|bower_components\|node_modules\|log$\|tmp$\|vendor$',
\ 'file': '\.so$\|\.dat$\|\.DS_Store$\|\.log$|\.ico$'
\ }
""""""""""""""""" Tagbar
map <leader>c :TagbarToggle<CR>
let g:tagbar_autoclose = 1
let g:tagbar_autofocus = 1
let g:tagbar_autoshowtag = 1
let g:tagbar_compact = 1
let g:tagbar_ctags_bin = '/opt/homebrew/bin/ctags'
let g:tagbar_left = 1
let g:tagbar_singleclick = 1
let g:tagbar_width = 40
let g:tagbar_type_coffee = {
\ 'ctagstype' : 'coffee',
\ 'kinds' : [
\ 'c:classes',
\ 'm:methods',
\ 'f:functions',
\ 'v:variables',
\ 'f:fields',
\ ]
\ }
""""""""""""""""" Dispatch
map <leader>t :Dispatch nosetests %<CR>
""""""""""""""""" The Silver Searcher
" if executable('ag')
" " use ag instead of grep
" set grepprg=ag\ --nogroup\ --nocolor
" set grepformat=%f:%l:%m
"
" " bind K to grep word under cursor
" " nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
"
" " bind \ (backward slash) to grep shortcut
" " command -nargs=+ -complete=file -bar Ag silent! grep! <args>|cwindow|redraw!
" nnoremap \ :Ag<SPACE>-i<SPACE>
" endif
""""""""""""""""" The Platinum Searcher
command! -nargs=+ -complete=file -bar Pt silent! grep! <args>|cwindow|redraw!
nnoremap <silent> <leader>f :<C-u>Unite grep:. -buffer-name=search-buffer<CR>
if executable('pt')
let g:unite_source_grep_command = 'pt'
let g:unite_source_grep_default_opts = '--nogroup --nocolor'
let g:unite_source_grep_recursive_opt = ''
let g:unite_source_grep_encoding = 'utf-8'
endif
""""""""""""""""" Unimpaired
" Bubble single lines
nmap <C-Up> [e
nmap <C-Down> ]e
" Bubble multiple lines
vmap <C-Up> [egv
vmap <C-Down> ]egv
""""""""""""""""" CSS
augroup VimCSS3Syntax
autocmd!
autocmd FileType css setlocal iskeyword+=-
highlight VendorPrefix guifg=#00ffff gui=bold
match VendorPrefix /-\(moz\|webkit\|o\|ms\)-[a-zA-Z-]\+/
augroup END
""""""""""""""""" Tabularize
nmap <leader>a= :Tabularize/=<CR>
vmap <leader>a= :Tabularize/=<CR>
nmap <leader>a: :Tabularize/:<CR>
vmap <leader>a: :Tabularize/:<CR>
nmap <leader>a:: :Tabularize/:\zs<CR>
vmap <leader>a:: :Tabularize/:\zs<CR>
nmap <leader>a, :Tabularize/,<CR>
vmap <leader>a, :Tabularize/,<CR>
nmap <leader>a<bar> :Tabularize/<bar><CR>
vmap <leader>a<bar> :Tabularize/<bar><CR>
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
" automatically align tables delimited by pipe characters
function! s:align()
let p = '^\s*|\s.*\s|\s*$'
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
Tabularize/|/l1
normal! 0
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
endif
endfunction
""""""""""""""""" YouCompleteMe
let g:ycm_python_binary_path = '/opt/homebrew/bin/python3'
let g:ycm_collect_identifiers_from_comments_and_strings = 1
let g:ycm_collect_identifiers_from_tags_files = 1
function! BuildYCM(info)
" info is a dictionary with 3 fields
" - name: name of the plugin
" - status: 'installed', 'updated', or 'unchanged'
" - force: set on PlugInstall! or PlugUpdate!
if a:info.status == 'installed' || a:info.force
!./install.py
endif
endfunction
""""""""""""""""" tern_for_vim
" let g:tern_show_argument_hints = 'on_hold'
let g:tern_map_keys = 1
let g:tern_map_prefix = '<leader>'
""""""""""""""""" vim-airline
" variable names default contents
" ----------------------------------------------------------------------------
" let g:airline_section_a (mode, crypt, paste, spell, iminsert)
" let g:airline_section_b (hunks, branch)
" let g:airline_section_c (bufferline or filename)
" let g:airline_section_gutter (readonly, csv)
" let g:airline_section_x (tagbar, filetype, virtualenv)
" let g:airline_section_y (fileencoding, fileformat)
" let g:airline_section_z (percentage, line number, column number)
" let g:airline_section_error (ycm_error_count, syntastic, eclim)
" let g:airline_section_warning (ycm_warning_count, whitespace)
"
" " here is an example of how you could replace the branch indicator with
" " the current working directory, followed by the filename.
" let g:airline_section_b = '%{getcwd()}'
" let g:airline_section_c = '%t'
" call airline#init#bootstrap()
function! AirlineInit()
" let g:airline_section_a = airline#section#create_left(['mode', 'iminsert'])
" let g:airline_section_b = airline#section#create_left(['branch'])
" let g:airline_section_c = '%4b,0x%-6B'
" let g:airline_section_c = airline#section#create([])
let g:airline_section_c = '%{synIDattr(synID(line("."),col("."),1),"name")!=""?synIDattr(synID(line("."),col("."),1),"name"):""}'
" let g:airline_section_x = '%{synIDattr(synID(line("."),col("."),1),"name")!=""?synIDattr(synID(line("."),col("."),1),"name"):""}'
" let g:airline_section_x = '%{fugitive#statusline()}'
" let g:airline_section_y = '%{strlen(&ft)?&ft:"none"},%{&fileformat},%{strlen(&fenc)?&fenc:&enc}'
" let g:airline_section_y = '%{strlen(&fenc)?&fenc:&enc}'
let g:airline_section_z = airline#section#create(['%-14.( %l:%c/%L%)', ' ', '%<%P'])
let g:airline#extensions#ale#enabled = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_symbols.crypt = '🔒'
let g:airline_symbols.maxlinenr = '☰'
let g:airline_symbols.spell = 'Ꞩ'
let g:airline_symbols.notexists = '∄'
let g:airline_symbols.whitespace = 'Ξ'
endfunction
autocmd User AirlineAfterInit call AirlineInit()
let g:airline_powerline_fonts = 1
let g:airline_theme = 'base16_isotope'
let g:airline_detect_paste = 1
let g:airline_inactive_collapse = 1
" let g:airline_skip_empty_sections = 1
" extensions
let g:airline_extensions = ['ale', 'branch', 'ctrlp', 'obsession', 'tagbar', 'virtualenv']
let g:airline#extensions#branch#displayed_head_limit = 10
let g:airline#extensions#obsession#indicator_text = '$'
let g:airline#parts#ffenc#skip_expected_string='utf-8[unix]'
let g:airline_mode_map = {
\ '__' : '-',
\ 'n' : 'N',
\ 'i' : 'I',
\ 'R' : 'R',
\ 'c' : 'C',
\ 'v' : 'V',
\ 'V' : 'V',
\ '' : 'V',
\ 's' : 'S',
\ 'S' : 'S',
\ '' : 'S',
\ }
set t_Co=256
""""""""""""""""" vim-easy-align
" xmap <CR> <plug>(LiveEasyAlign)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign in visual mode (e.g. vip<Enter>)
vmap <CR> <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
""""""""""""""""" matchit
" use % to move between opening/closing block markers
packadd! matchit
""""""""""""""""" netrw
" disable netrw
let g:loaded_netrwPlugin = 1
let g:netrw_altv = 1
let g:netrw_banner = 0
let g:netrw_browse_split = 4
let g:netrw_liststyle = 3
let g:netrw_preview = 1
let g:netrw_sort_options = 'i'
let g:netrw_winsize = -30
" augroup ProjectDrawer
" autocmd!
" autocmd VimEnter * :Vexplore
" augroup END
""""""""""""""""" dirvish
let g:dirvish_mode = ':sort ,^.*[\/],'
augroup dirvish_events
autocmd!
" Map `t` to open in new tab.
autocmd FileType dirvish
\ nnoremap <silent><buffer> t :call dirvish#open('tabedit', 0)<CR>
\ |xnoremap <silent><buffer> t :call dirvish#open('tabedit', 0)<CR>
" Enable fugitive.vim in Dirvish buffers.
autocmd FileType dirvish call fugitive#detect(@%)
" Map `gr` to reload.
autocmd FileType dirvish nnoremap <silent><buffer>
\ gr :<C-U>Dirvish %<CR>
" Map `gh` to hide dot-prefixed files. Press `R` to 'toggle' (reload).
autocmd FileType dirvish nnoremap <silent><buffer>
\ gh :silent keeppatterns g@\v/\.[^\/]+/?$@d _<cr>
augroup END
""""""""""""""""" delimitMate
let g:delimitMate_expand_cr = 1
let g:delimitMate_expand_space = 1
au FileType html,javascript let b:delimitMate_insert_eol_marker = 2
au FileType html,javascript let g:delimitMate_eol_marker = ';'
""""""""""""""""" vim-javascript
let g:javascript_plugin_jsdoc = 1
""""""""""""""""" nginx
au BufRead,BufNewFile *.nginx,{nginx,default}.conf set filetype=nginx
""""""""""""""""" vim-indent-guides
let g:indent_guides_guide_size = 1
let g:indent_guides_start_level = 2
""""""""""""""""" ale
let g:ale_linters = {
\ 'javascript': [
\ 'standard'
\ ],
\ 'jsx': [
\ 'standard',
\ 'stylelint'
\ ],
\ 'python': [
\ 'pylint'
\ ],
\ 'rust': [
\ 'cargo',
\ 'rustc'
\ ],
\ 'scss': [
\ 'stylelint'
\ ]
\}
let g:ale_linter_aliases = {
\ 'jsx': 'css'
\}
let g:ale_fixers = {
\ 'javascript': [
\ 'prettier',
\ 'standard'
\ ],
\ 'json': [
\ 'prettier'
\ ],
\ 'jsx': [
\ 'prettier',
\ 'standard',
\ 'stylelint'
\ ],
\ 'python': [
\ 'black',
\ 'isort',
\ 'remove_trailing_lines'
\ ],
\ 'scss': [
\ 'prettier',
\ 'stylelint'
\ ]
\}
" Bind F8 to fixing problems with ALE
nmap <F8> <Plug>(ale_fix)
let g:ale_sign_error = '❌'
let g:ale_sign_warning = '💩'
let g:ale_statusline_format = ['❌ %d', '💩 %d', '👍']
let g:ale_echo_msg_format = '[%linter%] %s'
" javascript
let g:ale_javascript_eslint_executable = 'babel-eslint'
let g:ale_javascript_standard_options = '--parser babel-eslint'
" python
let g:ale_python_auto_pipenv = 1
let g:ale_python_pylint_auto_pipenv = 1
let g:ale_python_pylint_options = '--extension-pkg-whitelist=cv2 --generated-members=cv2'
nmap <silent> <C-k> <Plug>(ale_previous_wrap)
nmap <silent> <C-j> <Plug>(ale_next_wrap)
""""""""""""""""" vim-plug
let g:plug_window = 'tab new'
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" VIM-PLUG CONFIG
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" auto-install vim-plug and plugins
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
Plug 'airblade/vim-gitgutter'
Plug 'bogado/file-line'
Plug 'cakebaker/scss-syntax.vim', { 'for': 'scss' }
Plug 'ctrlpvim/ctrlp.vim' | Plug 'FelikZ/ctrlp-py-matcher'
Plug 'ekalinin/Dockerfile.vim', { 'for': [ 'docker-compose', 'Dockerfile' ] }
Plug 'elzr/vim-json', { 'for': 'json' }
Plug 'ervandew/supertab'
Plug 'fatih/vim-go', { 'for': 'go' }
Plug 'godlygeek/tabular'
Plug 'hail2u/vim-css3-syntax', { 'for': [ 'css', 'html' ] }
Plug 'jelera/vim-javascript-syntax', { 'for': [ 'html', 'javascript', 'javascript.jsx' ] }
Plug 'jmcantrell/vim-virtualenv'
Plug 'JulesWang/css.vim', { 'for': [ 'css', 'html' ] }
Plug 'junegunn/rainbow_parentheses.vim'
Plug 'junegunn/vim-easy-align'
Plug 'junegunn/vim-xmark', { 'do': 'make' }
Plug 'justinmk/vim-dirvish'
Plug 'kshenoy/vim-signature'
Plug 'lilydjwg/colorizer', { 'for': [ 'css', 'html', 'scss', 'vim' ]}
Plug 'ludovicchabant/vim-gutentags'
Plug 'majutsushi/tagbar'
Plug 'mxw/vim-jsx', { 'for': 'javascript.jsx' }
Plug 'nathanaelkane/vim-indent-guides'
Plug 'nazo/pt.vim'
Plug 'othree/html5.vim', { 'for': 'html' }
Plug 'othree/nginx-contrib-vim', { 'for': 'nginx' }
" Plug 'othree/yajs.vim', { 'for': [ 'html', 'javascript' ] } | Plug 'othree/es.next.syntax.vim'
Plug 'Raimondi/delimitMate'
Plug 'rust-lang/rust.vim', { 'for': 'rust' }
Plug 'sheerun/vim-polyglot'
Plug 'Shougo/unite.vim'
Plug 'Shougo/vimproc.vim', {'do' : 'make'}
"Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
Plug 'syngan/vim-vimlint', { 'for': 'vim' }
Plug 'ternjs/tern_for_vim', { 'do': 'yarn', 'for': [ 'html', 'javascript', 'javascript.jsx' ] }
Plug 'terryma/vim-expand-region'
Plug 'terryma/vim-multiple-cursors'
Plug 'tomtom/tcomment_vim'
Plug 'tpope/vim-characterize'
Plug 'tpope/vim-dispatch'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-obsession'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-vinegar'
Plug 'vim-airline/vim-airline' | Plug 'vim-airline/vim-airline-themes'
Plug 'vim-ruby/vim-ruby', { 'for': [ 'eruby', 'ruby' ] }
Plug 'vim-scripts/indentpython.vim', { 'for': 'python' }
Plug 'dense-analysis/ale'
" colorschemes
Plug 'arcticicestudio/nord-vim'
Plug 'zanglg/nova.vim'
Plug 'bluz71/vim-moonfly-colors'
Plug 'rakr/vim-one'
call plug#end()
colorscheme one
" source a local vim configuration (if present)
silent! so .vimlocal