-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
1893 lines (1681 loc) · 63.8 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
" Clear augroup =========================================== {{{
augroup MyVimrc
autocmd!
augroup END
" }}}
" Startup ================================================= {{{
if has('vim_starting')
if !has('autocmd')
echoerr "Recompile with +autocmd !"
finish
elseif !has('iconv')
echoerr "Recompile with +iconv !"
finish
elseif !has('multi_byte')
echoerr "Recompile with +multi_bute !"
finish
elseif !has('syntax')
echoerr "Recompile with +syntax !"
finish
endif
" http://rbtnn.hateblo.jp/entry/2014/11/30/174749
if &encoding !=# 'utf-8'
set encoding=japan
set fileencoding=japan
endif
scriptencoding utf-8
" ↑より前に日本語のコメントを書いてはいけない。
" http://rbtnn.hateblo.jp/entry/2014/11/30/174749
" Encoding : 文字コード自動判定 ========================== {{{
" http://www.kawaz.jp/pukiwiki/?vim#cb691f26
let s:enc_euc = 'euc-jp'
let s:enc_jis = 'iso-2022-jp'
" iconvがeucJP-msに対応しているかをチェック
if iconv("\x87\x64\x87\x6a", 'cp932', 'eucjp-ms') ==# "\xad\xc5\xad\xcb"
let s:enc_euc = 'eucjp-ms'
let s:enc_jis = 'iso-2022-jp-3'
" iconvがJISX0213に対応しているかをチェック
elseif iconv("\x87\x64\x87\x6a", 'cp932', 'euc-jisx0213') ==# "\xad\xc5\xad\xcb"
let s:enc_euc = 'euc-jisx0213'
let s:enc_jis = 'iso-2022-jp-3'
endif
" fileencodingsを構築
if &encoding ==# 'utf-8'
let s:fileencodings_default = &fileencodings
if has('mac')
let &fileencodings = s:enc_jis .','. s:enc_euc
let &fileencodings = &fileencodings .','. s:fileencodings_default
else
let &fileencodings = s:enc_jis .','. s:enc_euc .',cp932'
let &fileencodings = &fileencodings .','. s:fileencodings_default
endif
unlet s:fileencodings_default
else
let &fileencodings = &fileencodings .','. s:enc_jis
set fileencodings&
set fileencodings+=utf-8,ucs-2le,ucs-2
if &encoding =~# '^\(euc-jp\|euc-jisx0213\|eucjp-ms\)$'
set fileencodings+=cp932
set fileencodings-=euc-jp
set fileencodings-=euc-jisx0213
set fileencodings-=eucjp-ms
let &encoding = s:enc_euc
let &fileencoding = s:enc_euc
else
let &fileencodings = &fileencodings .','. s:enc_euc
endif
endif
" 定数を処分
unlet s:enc_euc
unlet s:enc_jis
" 日本語を含まない場合はfileencodingにencodingを使うようにする
function! AU_ReCheck_FENC()
if &fileencoding =~# 'iso-2022-jp' && search("[^\x01-\x7e]", 'n') == 0
let &fileencoding=&encoding
endif
endfunction
autocmd MyVimrc BufReadPost * call AU_ReCheck_FENC()
" 改行コードの自動認識
set fileformats=unix,dos,mac
" □とか○の文字があってもカーソル位置がずれないようにする
if exists('&ambiwidth')
if has('macunix')
set ambiwidth=single
else
set ambiwidth=double
endif
endif
" }}}
endif
" }}}
" Functions =============================================== {{{
function! s:MkdirP(dir)
if !isdirectory(a:dir)
call mkdir(iconv(a:dir, &encoding, &termencoding), 'p')
endif
endfunction
" }}}
" Directories & Runtimepath =============================== {{{
if has('vim_starting')
let s:rc_dir = fnamemodify($MYVIMRC, ":p:h")
" neobundle
let s:bundle_dir = s:rc_dir . '/bundle'
let s:neobundle_dir = s:bundle_dir . '/neobundle.vim'
let &runtimepath = &runtimepath . ',' . s:neobundle_dir
call s:MkdirP(s:neobundle_dir)
" template
call s:MkdirP(s:rc_dir . '/template')
" runtimepath
if executable('gocode') && exists('$GOPATH')
let &runtimepath = &runtimepath . ',' . globpath($GOPATH, 'src/github.com/nsf/gocode/vim')
endif
endif
" }}}
" NeoBundle : プラグイン {{{
" `loadplugins`がtrueならNeoBundleを実行する。
" `--noplugin`で起動してもNeoBundleでの設定が中途半端に読み込まれるので、
" `loadplugins`をチェックする。
if &loadplugins
" https://github.com/Shougo/neobundle.vim
" http://blog.supermomonga.com/articles/vim/neobundle-sugoibenri.html
" http://qiita.com/rbtnn/items/39d9ba817329886e626b
" http://vim-users.jp/2011/10/hack238/
" neobundle.vimの有無をチェック。
" neobundle.vimが無くてもgitコマンドが存在すれは
" githubから持ってくる。
if !filereadable(s:neobundle_dir . '/autoload/neobundle.vim')
if (has('macunix') || has('unix') || has('win32unix')) && executable('git')
" https://github.com/joedicastro/dotfiles/blob/master/vim/vimrc
silent exe '!git clone https://github.com/Shougo/neobundle.vim '
\ . s:neobundle_dir
else
echoerr "Install NeoBundle (neobundle.vim) plugin !"
finish
endif
endif
call neobundle#begin(s:bundle_dir)
" neobundle.vimをneobundle自身で管理する。
NeoBundleFetch 'Shougo/neobundle.vim'
NeoBundle 'altercation/vim-colors-solarized'
NeoBundle 'gcmt/wildfire.vim'
NeoBundle 'itchyny/lightline.vim'
NeoBundle 'thinca/vim-localrc', {'disabled':has('win32unix')}
NeoBundle 'tpope/vim-surround'
NeoBundle 'vim-scripts/cecutil.git'
NeoBundleLazy 'AndrewRadev/linediff.vim'
NeoBundleLazy 'Lokaltog/vim-easymotion'
NeoBundleLazy 'Shougo/context_filetype.vim'
NeoBundleLazy 'Shougo/neocomplcache.vim'
NeoBundleLazy 'Shougo/neomru.vim'
NeoBundleLazy 'Shougo/neosnippet.vim'
NeoBundleLazy 'Shougo/unite-outline'
NeoBundleLazy 'Shougo/unite.vim'
NeoBundleLazy 'Shougo/vimproc'
NeoBundleLazy 'Valloric/MatchTagAlways'
NeoBundleLazy 'airblade/vim-gitgutter'
NeoBundleLazy 'airblade/vim-rooter'
NeoBundleLazy 'c9s/perlomni.vim'
NeoBundleLazy 'cohama/agit.vim'
NeoBundleLazy 'eagletmt/ghcmod-vim'
NeoBundleLazy 'eagletmt/neco-ghc'
NeoBundleLazy 'ervandew/supertab'
NeoBundleLazy 'h1mesuke/vim-alignta'
NeoBundleLazy 'kana/vim-filetype-haskell'
NeoBundleLazy 'kmnk/vim-unite-giti'
NeoBundleLazy 'koron/codic-vim'
NeoBundleLazy 'lambdalisue/vim-gista'
NeoBundleLazy 'mattn/perlvalidate-vim'
NeoBundleLazy 'mojako/ref-sources.vim'
NeoBundleLazy 'osyo-manga/vim-anzu'
NeoBundleLazy 'osyo-manga/vim-precious'
NeoBundleLazy 'othree/html5.vim'
NeoBundleLazy 'py0n/vim-slack'
NeoBundleLazy 'rhysd/unite-codic.vim'
NeoBundleLazy 'scrooloose/syntastic'
NeoBundleLazy 'tacroe/unite-mark'
NeoBundleLazy 'thinca/vim-quickrun'
NeoBundleLazy 'thinca/vim-ref'
NeoBundleLazy 'tpope/vim-fugitive'
NeoBundleLazy 'ujihisa/ref-hoogle'
NeoBundleLazy 'vim-jp/vim-go-extra'
NeoBundleLazy 'vim-pandoc/vim-pandoc-syntax'
NeoBundleLazy 'vim-perl/vim-perl'
call neobundle#end()
" Required!
filetype plugin indent on
" Brief help
" :NeoBundleList - list configured bundles
" :NeoBundleInstall(!) - install(update) bundles
" :NeoBundleClean(!) - confirm(or auto-approve) removal of unused bundles
" 未インストールのplguinが存在する場合は
" 自動でインストール。
NeoBundleCheck
" Installation check.
if neobundle#exists_not_installed_bundles()
echomsg 'Not installed bundles : ' .
\ string(neobundle#get_not_installed_bundle_names())
echomsg 'Please execute ":NeoBundleInstall" command.'
finish
endif
" Plguin : Agit.vim ======================================= {{{
" https://github.com/cohama/agit.vim
if neobundle#tap('agit.vim')
call neobundle#append()
call neobundle#config({
\ 'on_cmd' : ['Agit', 'AgitFile'],
\ })
call neobundle#end()
call neobundle#untap()
endif
" }}}
" Plugin : Cscope ========================================= {{{
" http://cscope.sourceforge.net/
" http://blog.miraclelinux.com/penguin/2007/02/vi_7fa6.html
if has("cscope")
set csprg=/usr/bin/cscope
set csto=0
set cst
set nocsverb
" 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 csverb
map g<C-]> :cs find 3 <C-R>=expand("<cword>")<CR><CR>
map g<C-\> :cs find 0 <C-R>=expand("<cword>")<CR><CR>
endif
" }}}
" Plugin : codic-vim ====================================== {{{
" https://github.com/koron/codic-vim
if neobundle#tap('codic-vim')
call neobundle#append()
call neobundle#config({
\ 'on_cmd' : ['Codic'],
\ 'on_source' : ['unite-codic.vim'],
\ })
call neobundle#end()
call neobundle#untap()
endif
" }}}
" Plugin : ghcmod-vim ===================================== {{{
" https://github.com/eagletmt/ghcmod-vim
if neobundle#tap('ghcmod-vim')
call neobundle#append()
call neobundle#config({
\ 'depends' : ['Shougo/vimproc'],
\ 'external_commands' : ['ghc-mod'],
\ 'on_ft' : ['haskell'],
\ 'on_source' : ['Shougo/vimproc'],
\ })
call neobundle#end()
function! neobundle#tapped.hooks.on_source(bundel)
let g:haddock_browser = "firefox"
autocmd MyVimrc BufWritePost,FileWritePost *.hs :GhcModCheck
autocmd MyVimrc FileType haskell nnoremap [ghcmod] <Nop>
autocmd MyVimrc FileType haskell nmap <Space>g [ghcmod]
autocmd MyVimrc FileType haskell nnoremap <buffer> [ghcmod]c :GhcModCheck<CR>
autocmd MyVimrc FileType haskell nnoremap <buffer> [ghcmod]l :GhcModLint<CR>
autocmd MyVimrc FileType haskell nnoremap <buffer> [ghcmod]t :GhcModTypeClear<CR>:GhcModType<CR>
autocmd MyVimrc FileType haskell nnoremap <buffer> [ghcmod]tc :GhcModTypeClear<CR>
endfunction
call neobundle#untap()
endif
" }}}
" Plugin : html5 ========================================== {{{
if neobundle#tap('html5')
call neobundle#append()
call neobundle#config({
\ 'on_ft' : ['html'],
\ })
call neobundle#end()
call neobundle#untap()
endif
" }}}
" Plugin : lightline.vim ================================== {{{
" http://d.hatena.ne.jp/itchyny/20130828/1377653592
" http://qiita.com/yuyuchu3333/items/20a0acfe7e0d0e167ccc
" https://github.com/itchyny/lightline.vim
if neobundle#tap('lightline.vim')
let s:colorscheme
\ = neobundle#is_installed('vim-colors-solarized')
\ ? 'solarized'
\ : 'wombat'
let g:lightline = {
\ 'colorscheme': s:colorscheme,
\ 'mode_map': {'c': 'NORMAL'},
\ 'active': {
\ 'left': [
\ [ 'mode' ],
\ [ 'fugitive', 'gitgutter', 'filename', 'anzu' ]
\ ],
\ 'right': [
\ [ 'syntastic', 'lineinfo' ],
\ [ 'percent' ],
\ [ 'charcode', 'fileformat', 'fileencoding', 'filetype' ]
\ ],
\ },
\ 'component_expand': {
\ 'syntastic': 'SyntasticStatuslineFlag'
\ },
\ 'component_function': {
\ 'anzu' : 'MyAnzu',
\ 'charcode' : 'MyCharCode',
\ 'fileencoding' : 'MyFileencoding',
\ 'fileformat' : 'MyFileformat',
\ 'filename' : 'MyFilename',
\ 'filetype' : 'MyFiletype',
\ 'fugitive' : 'MyFugitive',
\ 'gitgutter' : 'MyGitgutter',
\ 'lineinfo' : 'MyLineinfo',
\ 'mode' : 'MyMode',
\ 'percent' : 'MyPercent',
\ },
\ 'component_type': {
\ 'syntastic': 'error'
\ },
\ 'separator': { 'left': '', 'right': '', },
\ 'subseparator': { 'left': '', 'right': '', },
\ }
let s:funcorder = [
\ 'MyMode' , 'MyFilename' , 'MyLineinfo' ,
\ 'MyPercent' , 'MyFugitive' , 'MyAnzu' ,
\ 'MyFileencoding' , 'MyFiletype' , 'MyFileformat' ,
\ 'MyGitgutter' , 'MyCharCode' ,
\ ]
function! s:is_display(width, funcname)
let l:index = index(s:funcorder, a:funcname)
let l:width = a:width
for i in range(l:index)
let l:width += strlen(call(s:funcorder[i], [])) + 2
endfor
return winwidth(0) >= l:width ? 1 : 0
endfunction
" http://qiita.com/shiena/items/f53959d62085b7980cb5
function! MyAnzu() " {{{
if !neobundle#is_installed('vim-anzu')
return ''
endif
let l:anzu = anzu#search_status()
return s:is_display(strlen(l:anzu), 'MyAnzu') ? l:anzu : ''
endfunction " }}}
" カーソル下にある文字の文字コードを取得する。
" http://qiita.com/yuyuchu3333/items/20a0acfe7e0d0e167ccc
" https://github.com/Lokaltog/vim-powerline/blob/develop/autoload/Powerline/Functions.vim
function! MyCharCode() " {{{
" Get the output of :ascii
redir => ascii
silent! ascii
redir END
if match(ascii, 'NUL') != -1
return s:is_display(strlen('NUL'), 'MyCharCode') ? 'NUL' : ''
endif
" Get the character and the numeric value from the return value of :ascii
" This matches the two first pieces of the return value, e.g.
" "<F> 70" => char: 'F', nr: '70'
let [str, char, nr; rest] = matchlist(ascii, '\v\<(.{-1,})\>\s*([0-9]+)')
" Unicodeスカラ値
let uniHex = printf('%X', nr)
if strlen(uniHex) < 4
for i in range(4 - strlen(uniHex))
let uniHex = '0' . uniHex
endfor
endif
let uniHex = 'U+' . uniHex
" iconvが利用可能ならfileencodingでの文字コードも表示する
let fencStr = iconv(char, &encoding, &fileencoding)
let fencHex = ''
for i in range(strlen(fencStr))
let fencHex = fencHex . printf('%X', char2nr(fencStr[i]))
endfor
let fencHex = '0x' . (strlen(fencHex) % 2 == 1 ? '0' : '') . fencHex
let l:ccl = "'" . char . "' " . fencHex . " (" . uniHex . ")"
if s:is_display(strlen(l:ccl), 'MyCharCode')
return l:ccl
endif
let l:ccs = "'" . char . "' (" . uniHex . ")"
return s:is_display(strlen(l:ccs), 'MyCharCode') ? l:ccs : ''
endfunction " }}}
function! MyFileencoding() " {{{
let l:en = strlen(&fileencoding) ? &fileencoding : &encoding
return s:is_display(strlen(en), 'MyFileencoding') ? l:en : ''
endfunction " }}}
function! MyFileformat() " {{{
return s:is_display(strlen(&ff), 'MyFileformat') ? &ff : ''
endfunction " }}}
function! MyFilename() " {{{
return ('' != MyReadonly() ? MyReadonly() . ' ' : '') .
\ (&ft == 'vimfiler' ? vimfiler#get_status_string() :
\ &ft == 'unite' ? unite#get_status_string() :
\ &ft == 'vimshell' ? vimshell#get_status_string() :
\ '' != expand('%:t') ? expand('%:t') : '[No Name]') .
\ ('' != MyModified() ? ' ' . MyModified() : '')
endfunction " }}}
function! MyFiletype() " {{{
let l:ft = strlen(&filetype) ? &filetype : 'no ft'
return s:is_display(strlen(l:ft), 'MyFiletype') ? l:ft : ''
endfunction " }}}
function! MyFugitive() " {{{
try
if &filetype !~? '\v(vimfiler|gundo)'
let l:fg = fugitive#head()
else
throw 'vimfiler_or_gundo'
endif
catch
let l:fg = ''
endtry
return s:is_display(strlen(l:fg), 'MyFugitive') ? l:fg : ''
endfunction " }}}
function! MyGitgutter() " {{{
" http://qiita.com/yuyuchu3333/items/20a0acfe7e0d0e167ccc
if !neobundle#is_installed('vim-gitgutter')
return ''
endif
let hunks = GitGutterGetHunkSummary()
let symbols = [
\ g:gitgutter_sign_added . ' ',
\ g:gitgutter_sign_modified . ' ',
\ g:gitgutter_sign_removed . ' '
\ ]
let ret = []
for i in [0, 1, 2]
if hunks[i] > 0
call add(ret, symbols[i] . hunks[i])
endif
endfor
let l:gg = join(ret, ' ')
return s:is_display(strlen(l:gg), 'MyGitgutter') ? l:gg : ''
endfunction " }}}
function! MyLineinfo() " {{{
let l:cl = line('.')
let l:cc = col('.')
let l:li = printf('%d:%d', l:cl, l:cc)
return s:is_display(strlen(l:li), 'MyLineinfo') ? l:li : ''
endfunction " }}}
function! MyMode() " {{{
let l:ps = ''
if &paste
let l:ps = ' P'
endif
return lightline#mode() . l:ps
endfunction " }}}
function! MyModified() " {{{
return &filetype =~ '\v(help|vimfiler|gundo)'
\ ? '' : &modified
\ ? '+' : &modifiable
\ ? '' : '-'
endfunction " }}}
function! MyPercent() " {{{
let l:cl = line('.')
let l:ll = line('$')
let l:pc = printf('%3d%%', 100 * l:cl / l:ll)
return s:is_display(strlen(l:pc), 'MyPercent') ? l:pc : ''
endfunction " }}}
function! MyReadonly() " {{{
return &ft !~? '\v(help|vimfiler|gundo)' && &ro ? 'x' : ''
endfunction " }}}
unlet s:colorscheme
call neobundle#untap()
endif
" }}}
" Plugin : linediff.vim =================================== {{{
" https://github.com/AndrewRadev/linediff.vim
" http://deris.hatenablog.jp/entry/2013/12/15/235606
if neobundle#tap('linediff.vim')
call neobundle#append()
call neobundle#config({
\ 'on_cmd' : ['Linediff', 'LinediffReset']
\ })
call neobundle#end()
call neobundle#untap()
endif
" }}}
" Plugin : MatchTagAlways {{{
" 対応するタグをハイライトする
" https://github.com/Valloric/MatchTagAlways
if neobundle#tap('MatchTagAlways')
call neobundle#append()
call neobundle#config({
\ 'on_ft' : ['html', 'xml']
\ })
call neobundle#end()
call neobundle#untap()
endif
" }}}
" Plugin : neco-ghc {{{
" https://github.com/eagletmt/neco-ghc
if neobundle#tap('neco-ghc')
call neobundle#append()
call neobundle#config({
\ 'external_commands' : ['ghc-mod']
\ })
call neobundle#end()
call neobundle#untap()
endif
" }}}
" Plugin : neocomplcache.vim ============================== {{{
" https://github.com/Shougo/neocomplcache.vim
if neobundle#tap('neocomplcache.vim')
call neobundle#append()
call neobundle#config({
\ 'on_source' : ['neosnippet.vim']
\ })
call neobundle#end()
function! neobundle#tapped.hooks.on_source(bundle)
let g:neocomplcache_enable_at_startup = 1
endfunction
call neobundle#untap()
endif
" }}}
" Plugin : neomru.vim ===================================== {{{
if neobundle#tap('neomru.vim')
call neobundle#append()
call neobundle#config({
\ 'on_source' : 'unite.vim'
\ })
call neobundle#end()
call neobundle#untap()
endif
" }}}
" Plugin : neosnippet.vim ================================= {{{
" https://github.com/Shougo/neosnippet.vim
if neobundle#tap('neosnippet.vim')
call neobundle#append()
call neobundle#config({
\ 'depends' : ['Shougo/neocomplcache.vim', 'Shougo/neosnippet-snippets'],
\ 'on_i' : 1,
\ })
call neobundle#end()
function! neobundle#tapped.hooks.on_source(bundle)
let $SNIPPETDIRPATH=s:rc_dir.'/snippets'
call s:MkdirP($SNIPPETDIRPATH)
let g:neosnippet#snippets_directory=$SNIPPETDIRPATH
" Plugin key-mappings.
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
xmap <C-k> <Plug>(neosnippet_expand_target)
" For snippet_complete marker.
if has('conceal')
set conceallevel=2 concealcursor=i
endif
endfunction
call neobundle#untap()
endif
" }}}
" Plugin : perlomni.vim =================================== {{{
" https://github.com/c9s/perlomni.vim
if neobundle#tap('perlomni.vim')
call neobundle#append()
call neobundle#config({
\ 'on_ft' : ['perl'],
\ })
call neobundle#end()
function! neobundle#tapped.hooks.on_source(bundle)
endfunction
call neobundle#untap()
endif
" }}}
" Plugin : perlvalidate-vim =============================== {{{
" https://github.com/kana/vim-filetype-haskell
if neobundle#tap('perlvalidate-vim')
call neobundle#append()
call neobundle#config({
\ 'on_ft' : ['perl'],
\ })
call neobundle#end()
function! neobundle#tapped.hooks.on_source(bundle)
endfunction
call neobundle#untap()
endif
" }}}
" Plugin : ref-hoogle {{{
" https://github.com/ujihisa/ref-hoogle
if neobundle#tap('ref-hoogle')
call neobundle#append()
call neobundle#config({
\ 'depends' : ['thinca/vim-ref'],
\ 'external_commands' : ['hoogle'],
\ 'on_ft' : ['haskell'],
\ 'on_func' : ['ref#complete', 'ref#ref'],
\ 'on_source' : ['unite.vim'],
\ })
call neobundle#end()
call neobundle#untap()
endif
" }}}
" Plugin : ref-sources.vim {{{
" https://github.com/mojako/ref-sources.vim
if neobundle#tap('ref-sources.vim')
call neobundle#append()
call neobundle#config({
\ 'depends' : ['thinca/vim-ref'],
\ 'external_commands' : ['curl'],
\ 'on_ft' : ['ref#complete', 'ref#ref'],
\ 'on_source' : ['unite.vim'],
\ })
call neobundle#end()
function! neobundle#tapped.hooks.on_source(bundle)
let g:ref_auto_resize = 1
endfunction
call neobundle#untap()
endif
" }}}
" Plugin : supertab ======================================= {{{
" https://github.com/ervandew/supertab
if neobundle#tap('supertab')
call neobundle#append()
call neobundle#config({
\ 'on_i' : 1
\ })
call neobundle#end()
call neobundle#untap()
endif
" }}}
" Plugin : syntastic ====================================== {{{
" https://github.com/scrooloose/syntastic
" http://d.hatena.ne.jp/heavenshell/20120106/1325866974
" http://d.hatena.ne.jp/itchyny/20130918/1379461406
if neobundle#tap('syntastic')
call neobundle#append()
call neobundle#config({
\ 'on_cmd' : 'SyntasticCheck',
\ 'on_func' : 'SyntasticStatuslineFlag',
\ })
call neobundle#end()
" 作者が教える! lightline.vimの設定方法! 〜 中級編 - 展開コンポーネントを理解しよう - プログラムモグモグ
" http://itchyny.hatenablog.com/entry/20130918/1379461406
" syntasticでperlのsyntaxcheckが動かなくなった件 - 呆備録
" http://d.hatena.ne.jp/oppara/20140515/p1
" 【Go × Vim】 VimでGoを書く - 2015 Spring
" http://qiita.com/izumin5210/items/1f3c312edd7f0075b09c
let g:syntastic_debug = 0
let g:syntastic_enable_perl_checker = 1
let g:syntastic_mode_map = {'mode': 'passive'}
let g:syntastic_go_checkers = ['go', 'golint']
let g:syntastic_perl_checkers = ['perl', 'perlcritic', 'podchecker']
augroup MyVimrc
autocmd BufWritePost *.go call s:syntastic()
autocmd BufWritePost *.pl,*.pm call s:syntastic()
autocmd BufWritePost *.py call s:syntastic()
autocmd BufWritePost *.t call s:syntastic()
augroup END
function! s:syntastic()
SyntasticCheck
call lightline#update()
endfunction
call neobundle#untap()
endif
" }}}
" Plugin : unite-codic.vim {{{
if neobundle#tap('unite-codic.vim')
call neobundle#append()
call neobundle#config({
\ 'depends' : ['koron/codic-vim'],
\ 'on_source' : 'unite.vim'
\ })
call neobundle#end()
call neobundle#untap()
endif
" }}}
" Plugin : unite-mark {{{
" https://github.com/tacroe/unite-mark
if neobundle#tap('unite-mark')
call neobundle#append()
call neobundle#config({
\ 'on_source' : 'unite.vim'
\ })
call neobundle#end()
nnoremap <silent> [unite]m :<C-u>Unite mark<CR>
call neobundle#untap()
endif
" }}}
" Plugin : unite-outline {{{
" https://github.com/Shougo/unite-outline
if neobundle#tap('unite-outline')
call neobundle#append()
call neobundle#config({
\ 'on_source' : 'unite.vim'
\ })
call neobundle#end()
" http://qiita.com/martini3oz/items/2cebdb805f45e7b4b901
nnoremap <silent> [unite]o :<C-u>Unite -vertical outline<CR>
call neobundle#untap()
endif
" }}}
" Plugun : unite.vim {{{
" https://github.com/Shougo/unite.vim
" http://d.hatena.ne.jp/ruedap/20110110/vim_unite_plugin
" http://d.hatena.ne.jp/ruedap/20110117/vim_unite_plugin_1_week
if neobundle#tap('unite.vim')
call neobundle#append()
call neobundle#config({
\ 'depends' : ['Shougo/vimproc'],
\ 'on_cmd' : [{
\ 'name' : 'Unite',
\ 'complete' : 'customlist,unite#complete_source'
\ }],
\ })
call neobundle#end()
function! neobundle#tapped.hooks.on_source(bundle)
call unite#custom#profile('default', 'context', {
\ 'direction' : 'botright',
\ 'ignorecase' : 1,
\ 'prompt_direction' : 'top',
\ 'smartcase' : 1,
\ 'start_insert' : 1,
\ })
endfunction
" バッファ及び最近使用したファイル一覧
nnoremap <C-P> :<C-u>Unite -buffer-name=file buffer file_mru<CR>
" ファイル一覧
nnoremap <C-N> :<C-u>Unite file<CR>
" http://deris.hatenablog.jp/entry/2013/05/02/192415
nnoremap [unite] <Nop>
nmap <Space>u [unite]
" grep
nnoremap <silent> [unite]g :<C-u>Unite grep -buffer-name=search-buffer<CR>
nnoremap <silent> [unite]r :<C-u>UniteResume search-buffer<CR>
" ESC二回で終了
autocmd MyVimrc FileType unite inoremap <silent> <buffer> <ESC><ESC> <ESC>:q<CR>
autocmd MyVimrc FileType unite nnoremap <silent> <buffer> <ESC><ESC> :q<CR>
" unite grep で pt を利用する
" Ref. help unite-source-grep
" http://blog.monochromegane.com/blog/2013/09/18/ag-and-unite/
if executable('pt')
" Use pt in unite grep source.
" https://github.com/monochromegane/the_platinum_searcher
let g:unite_source_grep_command = 'pt'
let g:unite_source_grep_default_opts = '--nogroup --nocolor'
let g:unite_source_grep_encoding = 'utf-8'
let g:unite_source_grep_recursive_opt = ''
elseif executable('ag')
" Use ag in unite grep source.
let g:unite_source_grep_command = 'ag'
let g:unite_source_grep_default_opts =
\ '-i --line-numbers --nocolor --nogroup --hidden --ignore ' .
\ '''.hg'' --ignore ''.svn'' --ignore ''.git'' --ignore ''.bzr'''
let g:unite_source_grep_recursive_opt = ''
elseif executable('ack-grep')
" Use ack in unite grep source.
let g:unite_source_grep_command = 'ack-grep'
let g:unite_source_grep_default_opts =
\ '-i --no-heading --no-color -k -H'
let g:unite_source_grep_recursive_opt = ''
endif
let g:unite_source_history_yank_list = 10000
call neobundle#untap()
endif
" }}}
" Plugin : vim-alignta ==================================== {{{
" https://github.com/h1mesuke/vim-alignta
if neobundle#tap('vim-alignta')
call neobundle#append()
call neobundle#config({
\ 'on_cmd' : ['Align', 'AlignTsp', 'Alignta'],
\ })
call neobundle#end()
function! neobundle#tapped.hooks.on_source(bundle)
" http://nanasi.jp/articles/vim/align/align_vim_ext.html
" Alignを日本語環境で使用する
let g:Align_xstrlen=3
" AlignCtrlで変更した設定を初期状態に戻す
command! -nargs=0 AlignReset call Align#AlignCtrl("default")
" 空白揃へ (ref. \tsp or \Tsp)
" http://nanasi.jp/articles/vim/align/align_vim_mapt.html
command! -range -nargs=? AlignTsp :<line1>,<line2>Alignta <args> \S\+
endfunction
call neobundle#untap()
endif
" }}}
" Plugin : vim-anzu ======================================= {{{
" https://github.com/osyo-manga/vim-anzu
if neobundle#tap('vim-anzu')
call neobundle#append()
call neobundle#config({
\ 'pre_func' : 'anzu#',
\ })
call neobundle#end()
function! neobundle#tapped.hooks.on_source(undle)
" ヒットした檢索語が畫面中段に來るやうに
" `zz'を付加してゐる。
nmap n <Plug>(anzu-n-with-echo)zvzz
nmap N <Plug>(anzu-N-with-echo)zvzz
nmap * <Plug>(anzu-star-with-echo)zvzz
nmap # <Plug>(anzu-sharp-with-echo)zvzz
" 一定時間キー入力がないとき、ウインドウを移動したとき、
" タブを移動したときに検索ヒット数の表示を消去する。
autocmd MyVimrc CursorHold * call anzu#clear_search_status()
autocmd MyVimrc CursorHoldI * call anzu#clear_search_status()
autocmd MyVimrc WinLeave * call anzu#clear_search_status()
autocmd MyVimrc TabLeave * call anzu#clear_search_status()
endfunction
call neobundle#untap()
endif
" }}}
" Plugin : vim-colors-solarized {{{
" https://github.com/altercation/vim-colors-solarized
if neobundle#tap('vim-colors-solarized')
" http://ethanschoonover.com/solarized
let g:solarized_contrast="high"
let g:solarized_hitrail=1
let g:solarized_termcolors=256
let g:solarized_termtrans=1
let g:solarized_visibility="high"
set background=dark
colorscheme solarized
" toggle bg
call togglebg#map("<F5>")
call neobundle#untap()
endif
" }}}
" Plugin : vim-filetype-haskell =========================== {{{
" https://github.com/c9s/perlomni.vim
if neobundle#tap('vim-filetype-haskell')
call neobundle#append()
call neobundle#config({
\ 'on_ft' : ['haskell'],
\ })
call neobundle#end()
function! neobundle#tapped.hooks.on_source(bundle)
endfunction
call neobundle#untap()
endif
" }}}
" Plugin : vim-fugitive =================================== {{{
" https://github.com/tpope/vim-fugitive
if neobundle#tap('vim-fugitive')
call neobundle#append()
call neobundle#config({
\ 'external_commands' : ['git'],
\ 'on_cmd' : ['Gblame', 'Gdiff', 'Gwrite'],
\ 'on_func' : ['fugitive#head'],
\ })
call neobundle#end()
" http://leafcage.hateblo.jp/entry/nebulavim_intro
function! neobundle#tapped.hooks.on_post_source(bundle)
doautoall fugitive BufNewFile
endfunction
call neobundle#untap()
endif
" }}}
" Plugin : vim-easymotion ================================= {{{
" http://haya14busa.com/mastering-vim-easymotion/
" https://github.com/Lokaltog/vim-easymotion
if neobundle#tap('vim-easymotion')
call neobundle#append()
call neobundle#config({
\ 'on_map' : ['/', '<Space>h', '<Space>j', '<Space>k', '<Space>l']
\ })
call neobundle#end()
function! neobundle#tapped.hooks.on_source(bundle)
" Disable default mappings
" If you are true vimmer, you should explicitly map keys by yourself.
" Do not rely on default bidings.
let g:EasyMotion_do_mapping = 0
" n-character serach motion
" Extend search motions with vital-over command line interface
" Incremental highlight of all the matches
" Now, you don't need to repetitively press `n` or `N` with
" EasyMotion feature
" `<Tab>` & `<S-Tab>` to scroll up/down a page with next match
" :h easymotion-command-line
nmap / <Plug>(easymotion-sn)
xmap / <Plug>(easymotion-sn)
omap / <Plug>(easymotion-tn)
" hjkl motions
map <Space>h <Plug>(easymotion-linebackward)
map <Space>j <Plug>(easymotion-j)
map <Space>k <Plug>(easymotion-k)
map <Space>l <Plug>(easymotion-lineforward)
" keep cursor colum when JK motion
let g:EasyMotion_startofline = 0