-
Notifications
You must be signed in to change notification settings - Fork 2
/
vimrc
682 lines (556 loc) · 18.4 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
" Plugins {{{
if empty(glob('~/.vim/autoload/plug.vim'))
!curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall | source $MYVIMRC
endif
let g:plug_shallow = 0
call plug#begin('~/.vim/plugged')
Plug 'w0ng/vim-hybrid'
Plug 'jonathanfilip/vim-lucius'
Plug 'jnurmine/Zenburn'
Plug 'vim-scripts/jellybeans.vim'
Plug 'vim-scripts/wombat256.vim'
Plug 'junegunn/seoul256.vim'
Plug 'morhetz/gruvbox'
Plug 'reedes/vim-colors-pencil'
Plug 'owickstrom/vim-colors-paramount'
Plug 'robertmeta/nofrils'
Plug 'ewilazarus/preto'
Plug 'JarrodCTaylor/spartan'
Plug 'fxn/vim-monochrome'
Plug 'pbrisbin/vim-colors-off'
Plug 'zeis/vim-kolor'
Plug 'NLKNguyen/papercolor-theme'
Plug 'freeo/vim-kalisi'
Plug 'noahfrederick/vim-hemisu'
Plug 'whatyouhide/vim-gotham'
Plug 'KabbAmine/yowish.vim'
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-obsession', { 'on': 'Obsession' }
Plug 'tpope/vim-tbone', { 'on': [ 'Tyank', 'Tput', 'Twrite' ] }
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-git'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-abolish'
Plug 'tpope/vim-dispatch'
Plug 'tpope/vim-rsi'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-jdaddy'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-projectionist'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-haystack'
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
Plug 'tpope/vim-db'
Plug 'edkolev/promptline.vim', { 'on': 'PromptlineSnapshot' }
Plug 'vim-scripts/tracwiki', { 'for': 'tracwiki' }
Plug 'christoomey/vim-tmux-navigator'
Plug 'michaeljsmith/vim-indent-object'
Plug 'vim-scripts/ReplaceWithRegister'
Plug 'moll/vim-bbye'
Plug 'elzr/vim-json'
Plug 'edkolev/tmuxline.vim', { 'on': [ 'Tmuxline', 'TmuxlineSimpe' ] }
Plug 'mbbill/undotree', { 'on': 'UndotreeToggle' }
Plug 'junegunn/goyo.vim'
Plug 'junegunn/limelight.vim'
let g:lion_squeeze_spaces = 1
Plug 'tommcdo/vim-lion'
Plug 'tommcdo/vim-exchange'
Plug 'AndrewRadev/linediff.vim'
let g:linediff_buffer_type = 'scratch'
Plug 'pydave/renamer.vim'
" Plug 'tpope/vim-scriptease'
Plug 'thinca/vim-qfreplace'
Plug 'AndrewRadev/inline_edit.vim'
Plug 'vim-scripts/DirDiff.vim', { 'on': 'DirDiff' }
Plug 'Wolfy87/vim-expand'
Plug 'thinca/vim-ref'
Plug 'nicwest/QQ.vim', { 'on': 'QQ' }
Plug 'vim-scripts/LargeFile'
" Plug 'itchyny/vim-haskell-indent', { 'for': 'haskell' }
Plug 'ledger/vim-ledger', { 'for': 'ledger' }
Plug 'justinmk/vim-dirvish'
Plug 'junegunn/rainbow_parentheses.vim', { 'for': 'clojure' }
Plug 'vim-perl/vim-perl'
Plug '~/.vim/src/vim-curry', { 'for': 'haskell' }
Plug '~/.vim/src/vim-funs'
call plug#end()
let mapleader = ","
runtime macros/matchit.vim
" }}}
" Plugin Config {{{
" let g:promptline_preset = {
" \'a' : [ promptline#slices#host({'only_if_ssh': 1}), promptline#slices#vcs_branch(), promptline#slices#git_status() ],
" \'c' : [ promptline#slices#cwd() ],
" \'options': {
" \'left_sections' : [ 'a', 'c' ],
" \'left_only_sections' : [ 'a', 'c' ]}}
" let g:tmuxline_powerline_separators = 0
" let g:tmuxline_preset = {
" \ 'a': '#S',
" \ 'win': '#I #W',
" \ 'cwin': '#I #W',
" \ 'z': '%R',
" \ 'options': {
" \'status-justify': 'centre'}
" \}
let g:rsi_no_meta = 1
let g:vim_json_syntax_conceal = 0
let g:goyo_width = '40%'
let g:goyo_height = '100%'
" vim-fugitive
nnoremap Ucc :Gcommit<cr>
nnoremap Ucvc :Gcommit -v<cr>
nnoremap Ucf :Gcommit -v %<cr>
nnoremap Uca :Gcommit -v --ammend<cr>
nnoremap Ucva :Gcommit -v --ammend --reuse-message=HEAD<cr>
nnoremap UU :Gstatus<cr>
nnoremap Ud :Gdiff<cr>
nnoremap Uw :Gwrite<cr>
nnoremap Ur :Gread<cr>
" }}}
" UI {{{
if has('gui_running')
set guioptions=egm
set guitablabel=%m\ %t
set guifont=Source\ Code\ Pro:h13
set gcr=a:blinkon0
else
endif
set laststatus=2
set statusline=\
set statusline+=[%n%H%R%W]%*\
set statusline+=%f%m\
set statusline+=%{fugitive#head()}
set statusline+=%=
set statusline+=%l\ \/\ %L,\ %c\
" }}}
" Set's {{{
set report=0
set nojoinspaces
set formatoptions=
set showcmd
set noshowmode
set nocursorline
set encoding=utf-8
set smartindent
set noswapfile
set shiftwidth=2
set tabstop=2
set softtabstop=2
set expandtab
set scrolloff=0
set sidescroll=1
set scrolljump=1
set sidescrolloff=1
set history=2000
set nowrap
set linebreak
set ignorecase
set smartcase
set diffopt+=vertical
set diffopt+=iwhite
set hidden
set numberwidth=1
set splitbelow splitright
set showmatch
set autowrite
set synmaxcol=500
set completeopt=menu,preview
set complete=.,b
set wildmode=list:full,full
set shortmess=ao
if !isdirectory($HOME . '/.vim/undo')
call mkdir($HOME . '/.vim/undo')
endif
if isdirectory($HOME . '/.vim/undo')
set undodir=~/.vim/undo
set undofile
endif
set wildignore+=.hg,.git,.svn
set wildignore+=*.beam
set wildignore+=*.jpg,*.bmp,*.gif,*.png,*.jpeg
let &showbreak='⤷ '
set fillchars=""
if has('linebreak')
set breakindent
set breakindentopt=shift:2
endif
set exrc
set secure
set wrapscan
set lazyredraw
set foldopen-=block
set foldlevelstart=99
set foldminlines=0
set spellfile=~/.vim/en.utf-8.add
" change cursor in INSERT
let &t_SI = exists('$TMUX') ? "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\" : "\<Esc>]50;CursorShape=1\x7"
let &t_EI = exists('$TMUX') ? "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\" : "\<Esc>]50;CursorShape=0\x7"
let &t_SR = exists('$TMUX') ? "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=2\x7\<Esc>\\" : "\<Esc>]50;CursorShape=2\x7"
if executable('ag')
set grepprg=ag\ -s\ \ --vimgrep\ $*
set grepformat=%f:%l:%c:%m
endif
set sessionoptions-=options
" }}}
" Mappings & Commands {{{
fun! s:local_vimrc()
return expand(resolve($MYVIMRC) . ".local")
endfun
fun! s:jumpToPreviousEdit(go_forward) abort
let jump_command = "norm! " . (a:go_forward ? "g," : "g;")
let line = line('.')
try
execute jump_command
let line2 = line('.')
while (abs(line2 - line) < 5)
execute jump_command
let line2 = line('.')
endwhile
echo
catch /^Vim\%((\a\+)\)\=:E662/
echohl WarningMsg | echo "At start of changelist"| echohl None
catch /^Vim\%((\a\+)\)\=:E663/
echohl WarningMsg | echo "At end of changelist"| echohl None
catch /^Vim\%((\a\+)\)\=:E664/
echohl WarningMsg | echo "Changelist is empty"| echohl None
catch
echohl ErrorMsg | echo v:exception | echohl None
endtry
endfun
nnoremap <expr> [c &diff ? "[c" : ":call <sid>jumpToPreviousEdit(0)<cr>"
nnoremap <expr> ]c &diff ? "]c" : ":call <sid>jumpToPreviousEdit(1)<cr>"
vnoremap . :normal .<CR>
nnoremap !! :!!<cr>
cnoremap <C-p> <Up>
cnoremap <C-n> <Down>
" like <c-w>, but for the whole line
cnoremap <C-l> <C-r>=getline('.')<CR>
nmap # :%s///ng<bar>normal``<CR>
nmap <leader>D :%s///g<CR>
nnoremap <leader>w :vsplit<cr>
nnoremap <expr> <silent> <cr> &modifiable ? ":update<cr>" : "<cr>"
nmap <leader>v :e <c-r>=resolve($MYVIMRC)<CR><CR>
nmap <leader>V :e <c-r>=<sid>local_vimrc()<CR><CR>
" jump to tag if one, show list otherwise
nmap <C-]> g<C-]>
nmap <C-f> <Nop>
nnoremap j gj
nnoremap k gk
vnoremap j gj
vnoremap k gk
noremap 0 ^
inoremap <c-]> <c-x><c-]>
inoremap <c-l> <c-x><c-l>
inoremap <c-x><c-x> <c-x><c-p>
" <c-r>/ in insert and command mode should not insert encolsing <\...\> and \V
inoremap <silent> <c-r>/ <c-r>=substitute(substitute(@/, '\v^\\\<(.+)\\\>$', '\1', ''), '\\V', '', '')<cr>
cnoremap <c-r>/ <c-r>=substitute(substitute(@/, '\v^\\\<(.+)\\\>$', '\1', ''), '\\V', '', '')<cr>
" toggle iwhite diffopt
nnoremap co<space> :set <C-R>=(&diffopt =~# 'iwhite') ? 'diffopt-=iwhite' : 'diffopt+=iwhite'<CR><CR>
nmap Y y$
map Q gq
function! s:VSetSearch()
let temp = @@
norm! gvy
call s:SetSearch(@@, 0)
let @@ = temp
endfunction
function! s:SetSearch(pattern, match_whole_words)
if a:match_whole_words
let @/ = "\\<". a:pattern ."\\>"
else
let @/ = '\V' . substitute(escape(a:pattern, '\'), '\n', '\\n', 'g')
endif
endfunction
function! s:EchoMatchCount()
%s///gne
normal ``
endfunction
function! s:SetGrepSearch(pattern)
if &grepprg =~# '^ag'
execute "grep! -Q -- " . shellescape(a:pattern)
else
execute "grep! -R -F " . shellescape(a:pattern) . ' .'
endif
call s:SetSearch(a:pattern, 0)
endfunction
function! s:VSetGrepSearch()
let temp = @@
norm! gvy
call s:SetGrepSearch(@@)
let @@ = temp
endfunction
vnoremap <silent> * :<C-u>call <SID>VSetSearch()<CR>:set hlsearch<CR>:call <SID>EchoMatchCount()<CR>
vnoremap <silent> g* :<C-u>call <SID>VSetSearch()<CR>:set hlsearch<CR>:call <SID>EchoMatchCount()<CR>
vnoremap <silent> K :<C-u>call <SID>VSetGrepSearch()<CR>: set hlsearch<CR>
nnoremap <silent> * :call <SID>SetSearch(expand("<cword>"), 1)<CR>:set hlsearch<CR>:call <SID>EchoMatchCount()<CR>
nnoremap <silent> g* :call <SID>SetSearch(expand("<cword>"), 0)<CR>:set hlsearch<CR>:call <SID>EchoMatchCount()<CR>
nnoremap <silent> K :call <SID>SetGrepSearch(expand("<cword>"))<CR>: set hlsearch<CR>
nnoremap <silent> gK :lgrep! "<C-R><C-W>"<CR>:lw<CR>
command! -range=% -nargs=0 ChompWhitespace mark ` | execute <line1> . ',' . <line2> . 's/\s\+$//' | normal! ``
command! DiffOrig lefta vnew | setlocal bt=nofile bh=delete noswf | r ++edit # | 0d_ | setlocal noma | diffthis | nnoremap <buffer> q :q<cr>:diffoff<cr> | wincmd p | diffthis
command! -bang -range=% -nargs=1 JoinWith <line1>,<line2>-1s/$/<args>/|<line1>,<line2>join<bang>
function! QffilterFunction(pat)
let qf_lines = getqflist()
let title = getqflist({'title':1}).title
let pattern = len(a:pat) > 1 ? a:pat : getreg('/')
for qf_line in qf_lines
if qf_line['text'] !~ pattern
call remove(qf_lines, index(qf_lines, qf_line))
endif
endfor
call setqflist(qf_lines)
call setqflist([], 'r', {'title': title . ' *filtered ' . pattern . '*'})
endfunction
function! QfremoveFunction(pat)
let qf_lines = getqflist()
let title = getqflist({'title':1}).title
let pattern = len(a:pat) > 1 ? a:pat : getreg('/')
for qf_line in qf_lines
if qf_line['text'] =~ pattern
call remove(qf_lines, index(qf_lines, qf_line))
endif
endfor
call setqflist(qf_lines)
call setqflist([], 'r', {'title': title . ' *removed ' . pattern . '*'})
endfunction
command! -nargs=* Qffilter call QffilterFunction(<q-args>)
command! -nargs=* Qfremove call QfremoveFunction(<q-args>)
if executable('tidyp')
command! TidyHTML :silent! %!tidyp --indent-attributes 1 --sort-attributes alpha -q -i --show-errors 0 --tidy-mark 0 --show-body-only 1
endif
if executable('python')
command! TidyJSON :%!python -m json.tool
endif
nmap gn :%normal
vnoremap gn :normal
nnoremap <silent> gm :silent make \| redraw!<cr>
nnoremap gM :make!<cr>
nnoremap <silent> c* :set hls<cr>*Ncgn
" 'entire' text object
xnoremap ie GoggV
onoremap ie :<C-u>normal vie<CR>
" 'next' text object, by https://gist.github.com/AndrewRadev/1171559
onoremap an :<c-u>call <SID>NextTextObject('a')<cr>
xnoremap an :<c-u>call <SID>NextTextObject('a')<cr>
onoremap in :<c-u>call <SID>NextTextObject('i')<cr>
xnoremap in :<c-u>call <SID>NextTextObject('i')<cr>
function! s:NextTextObject(motion)
echo
let c = nr2char(getchar())
let c = c ==# "b" ? "(" : c
exe "normal! f".c."v".a:motion.c
endfunction
" line text object
xnoremap <silent> il <Esc>^vg_
onoremap <silent> il :<C-U>normal! ^vg_<CR>
" fuzzy buffer completion
function! GetBufferFileNames() abort
let buffers = range(1, bufnr('$'))
call filter(buffers, 'buflisted(v:val)')
call map(buffers, "fnamemodify(bufname(v:val), ':.')")
return buffers
endfunction
function! GetOldFileNames() abort
let oldfiles = deepcopy(v:oldfiles)
call map( oldfiles, 'fnamemodify( v:val, ":." )' )
call filter( oldfiles, 'filereadable( v:val )' )
call filter( oldfiles, 'v:val !~ "^/" && v:val !~ "^\\."' )
return oldfiles
endfunction
function! s:CompareFileModTime(a, b)
let a = getftime(a:a)
let b = getftime(a:b)
return a == b ? 0 : a < b ? 1 : -1
endfunc
function! s:bufferCompletionFunction(lead, cmdline, _) abort
let buffers = GetBufferFileNames()
let old_buffers = GetOldFileNames()
call extend(buffers, old_buffers)
let cfile = fnamemodify( bufname(bufnr('%')), ":." )
call uniq(sort(filter(buffers, 'v:val !=# "' . cfile . '"' ), 's:CompareFileModTime'))
let filtered = haystack#filter(buffers, a:lead)
call sort(buffers, 's:CompareFileModTime')
return filtered
endfunction
function! s:filesCompletionFunction(lead, cmdline, _) abort
let files = systemlist('ag -l')
return haystack#filter(files, a:lead)
endfunction
command! -bar -bang -nargs=* -complete=customlist,<sid>bufferCompletionFunction B :silent! edit <args>
command! -bar -bang -nargs=* -complete=customlist,<sid>filesCompletionFunction Files :silent! edit <args>
nmap <space> :B
nmap g<space> :Files
fun! s:ExchangeWindows(direction) abort
let wnr1 = winnr()
let bnr1 = bufnr('%')
let wview1 = winsaveview()
exec "wincmd " . a:direction
let wnr2 = winnr()
let bnr2 = bufnr('%')
let wview2 = winsaveview()
if wnr1 == wnr2
return
endif
if bnr1 == bnr2
call winrestview(wview1)
wincmd p
call winrestview(wview2)
else
exec wnr1 . "wincmd w"
exec 'hide buf' bnr2
call winrestview(wview2)
exec wnr2 . "wincmd w"
exec 'hide buf' bnr1
call winrestview(wview1)
endif
exec wnr2 . "wincmd w"
endfun
nmap <silent> <c-w>h :call <sid>ExchangeWindows('h')<cr>
nmap <silent> <c-w>j :call <sid>ExchangeWindows('j')<cr>
nmap <silent> <c-w>k :call <sid>ExchangeWindows('k')<cr>
nmap <silent> <c-w>l :call <sid>ExchangeWindows('l')<cr>
" syntax group under the cursor
nmap zS :echo join(map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")'), '/')<cr>
" :o => :on
cnoreabbrev <expr> o ((getcmdtype() is# ':' && getcmdline() is# 'o')?('on'):('o'))
" completion
inoremap <expr> <tab> <SID>tab()
inoremap <expr> <s-tab> <SID>shift_tab()
inoremap <expr> <c-n> pumvisible()?"\<c-n>":"\<c-p>"
function! s:shift_tab()
if pumvisible()
return "\<c-p>"
endif
return "\<tab>"
endfunction
function! s:tab()
if pumvisible()
return "\<c-n>"
endif
let line = getline('.')
let col = col('.') - 2
if line[col] !~ '\k\|[/~.]'
return "\<tab>"
endif
let prefix = expand(matchstr(line[0:col], '\S*$'))
if prefix =~ '^[~/.]'
return "\<c-x>\<c-f>"
endif
return "\<c-p>"
endfunction
" }}}
" Auto Commands {{{
inoreabbrev <expr> #!! "#!/usr/bin/env" . (empty(&filetype) ? '' : ' '.&filetype)
augroup CursorLine
au!
au VimEnter,WinEnter,BufWinEnter * if !&diff | setlocal cursorline | endif
au WinLeave * setlocal nocursorline
augroup END
" return to same line on reopen, unless diff-ing
augroup line_return
au!
au BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") && !&diff |
\ execute 'normal! g`"zvzz' |
\ endif
augroup END
augroup q_to_quit
au!
au BufReadPost,BufNewFile *
\ if !&modifiable |
\ nnoremap <buffer> q :q<cr>|
\ endif
au BufReadPost fugitive://* nnoremap <buffer> q :q<cr>
au FileType qf nnoremap <buffer> q :q<cr>
au FileType qf set nowinfixheight
au FileType qf setlocal stl=%t%{exists('w:quickfix_title')?\ '\ '.w:quickfix_title\ :\ ''}\ %=\ %l\ of\ %L
au FileType ref-* nnoremap <buffer> q :q<cr>
augroup END
augroup vim_tweaks
au!
au VimResized * :wincmd =
au CmdwinEnter * nnoremap <buffer> <CR> <CR>
augroup END
" source vimrc on save
augroup vimrc
au!
au BufWritePost *vimrc{,.local} if filereadable(expand('%'))|execute 'source ' . expand('%')|endif
augroup END
augroup diff_update
au!
au BufWritePost * if &diff == 1 | diffupdate | endif
augroup END
" highlight ExtraWhitespace only after entering insert mode
if hlID('ExtraWhitespace') == 0
hi link ExtraWhitespace StatusLineNC
endif
augroup extra_whitespace
au!
au BufNewFile,BufRead,InsertLeave * silent! match ExtraWhitespace /\s\+$/
au InsertEnter * silent! match ExtraWhitespace /\s\+\%#\@<!$/
augroup END
augroup auto_open_quickfix
autocmd!
autocmd QuickFixCmdPost grep,make,cgetfile nested below cwindow
autocmd QuickFixCmdPost lgrep,lmake nested below lwindow
augroup END
" }}}
" Per-language config {{{
let g:perl_compiler_force_warnings = 0
let g:perl_sub_signatures=1
augroup filetype_options
au!
au FileType haskell iabbrev <buffer> undef undefined
au FileType haskell iabbrev <buffer> und undefined
au FileType haskell setlocal iskeyword+='
au FileType haskell compiler stack-ghc
au FileType ledger set commentstring=;%s
au FileType ledger setlocal foldmethod=manual
au FileType perl compiler perl
au FileType perl setlocal makeprg=perl\ -w\ -Mstrict\ -c\ %
au FileType perl
\ let b:endwise_addition = '}' |
\ let b:endwise_words = 'if,else,sub,while,for,foreach,unless,elsif' |
\ let b:endwise_syngroups = 'perlConditional,perlFunction,perlRepeat'
au FileType perl set iskeyword-=:
au FileType perl nnoremap <silent><buffer> ]m m':call search('^\s*sub\>', "W")<CR>
au FileType perl nnoremap <silent><buffer> ]] m':call search('^\s*sub\>', "W")<CR>
au FileType perl nnoremap <silent><buffer> [m m':call search('^\s*sub\>', "bW")<CR>
au FileType perl nnoremap <silent><buffer> [[ m':call search('^\s*sub\>', "bW")<CR>
au FileType perl set foldmethod=indent
" shell-style comments in json
au FileType json set commentstring=#%s
au FileType json syn match jsonComment /#.*/
au FileType json hi link jsonComment Comment
if executable('jshint')
au FileType javascript setlocal errorformat=%f:\ line\ %l\\,\ col\ %c\\,\ %m,%-G%.%#
au FileType javascript setlocal makeprg=jshint\ %
endif
au FileType javascript syntax region javaScriptStringT start=+`+ skip=+\\\(`\|$\)+ end=+`\|$+
au FileType javascript hi link javaScriptStringT String
au FileType r set commentstring=#%s
au FileType r
\ let b:endwise_addition = '}' |
\ let b:endwise_words = 'function,for' |
\ let b:endwise_syngroups = 'rType,rRepeat'
au FileType tracwiki setlocal shiftwidth=2 tabstop=2
au FileType tracwiki set commentstring={{{#!comment#%s}}}
au FileType tracwiki syn clear tracDefList
au FileType tracwiki syn match tracDefList "^\s.\+::$"
au FileType erlang set commentstring=%\ %s
au FileType mail set noexpandtab
au FileType gitcommit setlocal spell
au BufReadPost *vimrc* setlocal foldmethod=marker
au BufWinEnter *.md set ft=markdown
au FileType markdown syn clear markdownItalic | syn clear markdownError
au BufWinEnter *.conf set ft=conf
augroup END
" }}}
if filereadable(s:local_vimrc())
execute "source " . s:local_vimrc()
endif