-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
1186 lines (1055 loc) · 41.9 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
" Must set in System Vimrc of Macvim
" When you feel something wrong with vim, check system vimrc and add this
" line.
let g:no_vimrc_example = 1
" No Vi互換モード
if !&compatible
set nocompatible
endif
" reset augroup
augroup MyAutoCmd
autocmd!
augroup END
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" NeoBundle関連
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let s:noplugin = 0
let s:bundle_root = expand('~/.vim/bundle')
let s:neobundle_root = s:bundle_root . '/neobundle.vim'
if !isdirectory(s:neobundle_root) || v:version < 702
" NeoBundleが存在しない, Vimのバージョンが古い場合はプラグインを一切読み込まない
let s:noplugin = 1
else
" NeoBundleを'runtimepath'に追加し初期化を行う
if has('vim_starting')
" bundleで管理するディレクトリを指定
execute "set runtimepath+=" . s:neobundle_root
endif
" [141022] NeoBundle#rc() is now deprecated...
call neobundle#begin(expand('~/.vim/bundle/'))
NeoBundleFetch 'Shougo/neobundle.vim'
" NeoBundle自身をNeoBundleで管理させる
NeoBundleFetch 'Shougo/neobundle.vim'
" 非同期通信を可能にする
" 'build'が指定されているのでインストール時に自動的に
" 指定されたコマンドが実行され vimproc がコンパイルされる
NeoBundle 'Shougo/vimproc.vim', {
\ 'build' : {
\ 'windows' : 'tools\\update-dll-mingw',
\ 'cygwin' : 'make -f make_cygwin.mak',
\ 'mac' : 'make -f make_mac.mak',
\ 'linux' : 'make',
\ 'unix' : 'gmake',
\ },
\ }
NeoBundle 'Shougo/vimshell.vim'
" 導入プラグインリスト
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 日本語ヘルプ
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundle 'vim-jp/vimdoc-ja'
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" コンテキストに合わせてファイルタイプを変更する
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundle 'Shougo/context_filetype.vim'
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" LightLine
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundle 'itchyny/lightline.vim'
let g:lightline = {
\ 'colorscheme': 'jellybeans',
\ 'mode_map': {'c': 'NORMAL'},
\ 'active': {
\ 'left': [
\ ['mode', 'paste'],
\ ['pyenv'],
\ ['fugitive', 'gitgutter', 'filename'],
\ ],
\ 'right': [
\ ['lineinfo', 'syntastic'],
\ ['percent'],
\ ['charcode', 'fileformat', 'fileencoding', 'filetype'],
\ ]
\ },
\ 'component_function': {
\ 'modified': 'MyModified',
\ 'readonly': 'MyReadonly',
\ 'fugitive': 'MyFugitive',
\ 'filename': 'MyFilename',
\ 'fileformat': 'MyFileformat',
\ 'filetype': 'MyFiletype',
\ 'fileencoding': 'MyFileencoding',
\ 'mode': 'MyMode',
\ 'syntastic': 'SyntasticStatuslineFlag',
\ 'charcode': 'MyCharCode',
\ 'gitgutter': 'MyGitGutter',
\ 'pyenv': "pyenv#statusline#component"
\ },
\ 'separator': {'left': '>', 'right': '<'},
\ 'subseparator': {'left': '>', 'right': '<'}
\ }
function! MyModified()
return &ft =~ 'help\|vimfiler\|gundo' ? '' : &modified ? '+' : &modifiable ? '' : '-'
endfunction
function! MyReadonly()
return &ft !~? 'help\|vimfiler\|gundo' && &ro ? '>' : ''
endfunction
function! MyFilename()
return ('' != MyReadonly() ? MyReadonly() . ' ' : '') .
\ (&ft == 'vimfiler' ? vimfiler#get_status_string() :
\ &ft == 'unite' ? unite#get_status_string() :
\ &ft == 'vimshell' ? substitute(b:vimshell.current_dir,expand('~'),'~','') :
\ '' != expand('%:t') ? expand('%:t') : '[No Name]') .
\ ('' != MyModified() ? ' ' . MyModified() : '')
endfunction
function! MyFugitive()
try
if &ft !~? 'vimfiler\|gundo' && exists('*fugitive#head')
let _ = fugitive#head()
return strlen(_) ? '> '._ : ''
endif
catch
endtry
return ''
endfunction
function! MyFileformat()
return winwidth('.') > 70 ? &fileformat : ''
endfunction
function! MyFiletype()
return winwidth('.') > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : ''
endfunction
function! MyFileencoding()
return winwidth('.') > 70 ? (strlen(&fenc) ? &fenc : &enc) : ''
endfunction
function! MyMode()
return winwidth('.') > 60 ? lightline#mode() : ''
endfunction
function! MyGitGutter()
if ! exists('*GitGutterGetHunkSummary')
\ || ! get(g:, 'gitgutter_enabled', 0)
\ || winwidth('.') <= 90
return ''
endif
let symbols = [
\ g:gitgutter_sign_added . ' ',
\ g:gitgutter_sign_modified . ' ',
\ g:gitgutter_sign_removed . ' '
\ ]
let hunks = GitGutterGetHunkSummary()
let ret = []
for i in [0, 1, 2]
if hunks[i] > 0
call add(ret, symbols[i] . hunks[i])
endif
endfor
return join(ret, ' ')
endfunction
" https://github.com/Lokaltog/vim-powerline/blob/develop/autoload/Powerline/Functions.vim
function! MyCharCode()
if winwidth('.') <= 70
return ''
endif
" Get the output of :ascii
redir => ascii
silent! ascii
redir END
if match(ascii, 'NUL') != -1
return 'NUL'
endif
" Zero pad hex values
let nrformat = '0x%02x'
let encoding = (&fenc == '' ? &enc : &fenc)
if encoding == 'utf-8'
" Zero pad with 4 zeroes in unicode files
let nrformat = '0x%04x'
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]+)')
" Format the numeric value
let nr = printf(nrformat, nr)
return "'". char ."' ". nr
endfunction
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim-template
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundle "thinca/vim-template"
" テンプレート中に含まれる特定文字列を置き換える
autocmd MyAutoCmd User plugin-template-loaded call s:template_keywords()
function! s:template_keywords()
silent! %s/<+DATE+>/\=strftime('%Y-%m-%d')/g
silent! %s/<+FILENAME+>/\=expand('%:r')/g
endfunction
" テンプレート中に含まれる'<+CURSOR+>'にカーソルを移動
autocmd MyAutoCmd User plugin-template-loaded
\ if search('<+CURSOR+>')
\ | silent! execute 'normal! "_da>'
\ | endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim Outliner
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundle 'vim-scripts/VOoM'
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Unite-vim
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundleLazy "Shougo/unite.vim", {
\ "autoload": {
\ "commands": ["Unite", "UniteWithBufferDir"]
\ }}
NeoBundle "Shougo/unite-outline"
NeoBundleLazy 'Shougo/neomru.vim', {
\ "autoload": {
\ "commands": ["Unite"]
\ }}
nnoremap [unite] <Nop>
nmap U [unite]
nnoremap <silent> [unite]U :UniteResume<CR>
nnoremap <silent> [unite]/ :<C-u>Unite -buffer-name=search line -start-insert -no-quit<CR>
nnoremap <silent> [unite]s :<C-u>Unite -buffer-name=search line -start-insert -no-quit<CR>
nnoremap <silent> [unite]f :<C-u>UniteWithBufferDir -buffer-name=files file<CR>
nnoremap <silent> [unite]b :<C-u>Unite buffer<CR>
nnoremap <silent> [unite]g :<C-u>Unite grep<CR>
nnoremap <silent> [unite]G :<C-u>Unite grammarous<CR>
nnoremap <silent> [unite]r :<C-u>Unite register<CR>
nnoremap <silent> [unite]y :<C-u>Unite history/yank<CR>
nnoremap <silent> [unite]m :<C-u>Unite file_mru<CR>
nnoremap <silent> [unite]c :<C-u>Unite bookmark<CR>
nnoremap <silent> [unite]p :<C-u>Unite process<CR>
nnoremap <silent> [unite]o :<C-u>Unite outline -vertical -winwidth=40<CR>
nnoremap <silent> [unite]t :<C-u>Unite tab<CR>
nnoremap <silent> [unite]w :<C-u>Unite window<CR>
let s:hooks = neobundle#get_hooks("unite.vim")
function! s:hooks.on_source(bundle)
" start unite in insert mode
let g:unite_enable_start_insert = 1
let g:unite_source_history_yank_enable = 1
let g:unite_source_file_mru_limit = 200
" use vimfiler to open directory
call unite#custom_default_action("source/bookmark/directory", "vimfiler")
call unite#custom_default_action("directory", "vimfiler")
call unite#custom_default_action("directory_mru", "vimfiler")
autocmd MyAutoCmd FileType unite call s:unite_settings()
function! s:unite_settings()
imap <buffer> <Esc><Esc> <Plug>(unite_exit)
nmap <buffer> <Esc> <Plug>(unite_exit)
nmap <buffer> <Esc><Esc> <Plug>(unite_exit)
nmap <buffer> <C-n> <Plug>(unite_select_next_line)
nmap <buffer> <C-p> <Plug>(unite_select_previous_line)
endfunction
endfunction
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" VimFiler
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundleLazy "Shougo/vimfiler", {
\ "depends": ["Shougo/unite.vim"],
\ "autoload": {
\ "commands": ["VimFilerTab", "VimFiler", "VimFilerExplorer"],
\ "mappings": ['<Plug>(vimfiler_switch)'],
\ "explorer": 1,
\ }}
nnoremap <Leader>e :VimFilerExplorer<CR>
" close vimfiler automatically when there are only vimfiler open
autocmd MyAutoCmd BufEnter * if (winnr('$') == 1 && &filetype ==# 'vimfiler') | q | endif
let s:hooks = neobundle#get_hooks("vimfiler")
function! s:hooks.on_source(bundle)
let g:vimfiler_as_default_explorer = 1
let g:vimfiler_enable_auto_cd = 1
" .から始まるファイルおよび.pycで終わるファイルを不可視パターンに
" 2013-08-14 追記
let g:vimfiler_ignore_pattern = "\%(^\..*\|\.pyc$\)"
" vimfiler specific key mappings
autocmd MyAutoCmd FileType vimfiler call s:vimfiler_settings()
function! s:vimfiler_settings()
" ^^ to go up
nmap <buffer> ^^ <Plug>(vimfiler_switch_to_parent_directory)
" use R to refresh
nmap <buffer> R <Plug>(vimfiler_redraw_screen)
" overwrite C-l
nmap <buffer> <C-l> <C-w>l
endfunction
endfunction
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Git 関連
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundleLazy "mattn/gist-vim", {
\ "depends": ["mattn/webapi-vim"],
\ "autoload": {
\ "commands": ["Gist"],
\ }}
" vim-fugitiveは'autocmd'多用してるっぽくて遅延ロード不可
NeoBundle "tpope/vim-fugitive"
NeoBundleLazy "gregsexton/gitv", {
\ "depends": ["tpope/vim-fugitive"],
\ "autoload": {
\ "commands": ["Gitv"],
\ }}
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Enhanced Commentify
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"コメントアウトしたい範囲を選択して、
"[Leader]xでコメントアウト
NeoBundle 'hrp/EnhancedCommentify'
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" テキスト編集関連
" Vim-Surround
" Align
" Yankring.vim
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundle 'tpope/vim-surround'
NeoBundle 'vim-scripts/Align'
NeoBundle 'vim-scripts/YankRing.vim'
NeoBundle 'kana/vim-textobj-user'
NeoBundle 'kana/vim-operator-user'
NeoBundle 'kana/vim-textobj-line'
NeoBundle 'osyo-manga/vim-textobj-multiblock'
let g:yankring_history_dir = '~/.vim/'
let g:yankring_max_history = 10000
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" NeoComplete
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if has('lua') && v:version >= 703 && has('patch885')
NeoBundleLazy "Shougo/neocomplete.vim", {
\ "autoload": {
\ "insert": 1,
\ }}
let s:hooks = neobundle#get_hooks("neocomplete.vim")
let g:neocomplete#enable_at_startup = 1
function! s:hooks.on_source(bundle)
let g:acp_enableAtStartup = 0
let g:neocomplete#enable_smart_case = 1
let g:neocomplete#enable_fuzzy_completion = 1
let g:neocomplete#enable_auto_select = 0
" _(アンダースコア)区切りの補完を有効化
let g:neocomplete#enable_underbar_completion = 1
let g:neocomplete#enable_camel_case_completion = 1
" Set minimum syntax keyword length.
let g:neocomplete#sources#syntax#min_keyword_length = 3
let g:neocomplete#lock_buffer_name_pattern = '\*ku\*'
" Define dictionary.
let g:neocomplete#sources#dictionary#dictionaries = {
\ 'default' : '',
\ 'vimshell' : $HOME.'/.vimshell_hist',
\ 'scheme' : $HOME.'/.gosh_completions'
\ }
" Define keyword.
if !exists('g:neocomplete#keyword_patterns')
let g:neocomplete#keyword_patterns = {}
endif
let g:neocomplete#keyword_patterns['default'] = '\h\w*'
" キーマッピング
" 補完のキャンセル
inoremap <expr><BS> neocomplete#smart_close_popup()."\<BS>"
inoremap <expr><S-Tab> neocomplete#smart_close_popup()."<C-X><C-O><C-P>"
" Enterで補完の確定(endwiseとの競合対策)
function! s:my_crinsert()
return pumvisible() ? neocomplete#close_popup() : "\<Cr>"
endfunction
inoremap <silent> <CR> <C-R>=<SID>my_crinsert()<CR>
inoremap <expr><C-Space> pumvisible() ? "\<down>" : neocomplete#start_manual_complete()
" TABで補完を選択
inoremap <expr><TAB> pumvisible() ? "<C-N>" : "<TAB>"
if !exists('g:neocomplete#force_omni_input_patterns')
let g:neocomplete#force_omni_input_patterns = {}
endif
" Enable omni completion.
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
" autocmd FileType python setlocal omnifunc=jedi#completions
" autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType python3 setlocal omnifunc=python3complete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
let g:neocomplete#force_omni_input_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\w*\|\h\w*::\w*'
let g:neocomplete#force_omni_input_patterns.typescript = '[^. \t]\.\%(\h\w*\)\?' " Same as JavaScript
let g:neocomplete#force_omni_input_patterns.go = '[^. \t]\.\%(\h\w*\)\?' " Same as JavaScript
" let g:neocomplete#force_omni_input_patterns.python = '\h\w*\|[^. \t]\.\w*'
" let g:neocomplete#force_omni_input_patterns.python =
" \ '\%([^. \t]\.\|^\s*@\|^\s*from\s.\+import \|^\s*from \|^\s*import \)\w*'
endfunction
else
NeoBundleLazy "Shougo/neocomplcache.vim", {
\ "autoload": {
\ "insert": 1,
\ }}
let g:neocomplcache_enable_at_startup = 1
let s:hooks = neobundle#get_hooks("neocomplcache.vim")
function! s:hooks.on_source(bundle)
let g:acp_enableAtStartup = 0
let g:neocomplcache_enable_smart_case = 1
endfunction
endif
" Include Path Completion
NeoBundle "Shougo/neoinclude.vim"
" Syntax completion
NeoBundle "Shougo/neco-syntax"
let g:necosyntax#min_keyword_length = 2
" Vim syntax Completion
NeoBundle "Shougo/neco-vim"
" English words completion
NeoBundle "ujihisa/neco-look"
" Github completion
" NeoBundle "rhysd/github-complete.vim"
" let g:github_complete_enable_neocomplete = 1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" vim-go
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundle 'fatih/vim-go'
set rtp+=$GOPATH/src/github.com/golang/lint/misc/vim
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_structs = 1
let g:go_highlight_interfaces = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Fast-Fold
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundle "Konfekt/FastFold"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" SuperTab
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundle "ervandew/supertab"
" Omni補完をShift + Tabで実現
" <C-E>で補完解除、<C-X><C-O>でオムニ補完、<C-P>で補完選択解除
let g:SuperTabDefaultCompletionType = "<C-X><C-O><C-P>"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Jedi-vim
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ~/.pyenv/shimsを$PATHに追加
" jedi-vim や vim-pyenc のロードよりも先に行う必要がある、はず。
" " docstringは表示しない
" autocmd FileType python setlocal completeopt-=preview
"
" NeoBundleLazy "davidhalter/jedi-vim", {
" \ "autoload": {
" \ "filetypes": ["python", "python3", "djangohtml"],
" \ },
" \ "build": {
" \ "mac": "pip install jedi",
" \ "unix": "pip install jedi",
" \ }}
"
" let s:hooks = neobundle#get_hooks("jedi-vim")
"
" function! s:hooks.on_source(bundle)
" let python_version = system("python -V")
" let g:jedi#force_py_version = str2nr(matchstr(python_version, "[0-9]", 0))
" if jedi#init_python()
" function! s:jedi_auto_force_py_version() abort
" let major_version = pyenv#python#get_internal_major_version()
" call jedi#force_py_version(major_version)
" endfunction
" augroup vim-pyenv-custom-augroup
" autocmd! *
" autocmd User vim-pyenv-activate-post call s:jedi_auto_force_py_version()
" autocmd User vim-pyenv-deactivate-post call s:jedi_auto_force_py_version()
" augroup END
" endif
" let g:jedi#force_py_version = 2
" let g:jedi#force_py_version = 3
" jediにvimの設定を任せると'completeopt+=preview'するので
" 自動設定機能をOFFにし手動で設定を行う
" let g:jedi#auto_vim_configuration = 0
" let g:jedi#show_call_signatures = "0"
" " 補完の最初の項目が選択された状態だと使いにくいためオフにする
" let g:jedi#popup_select_first = 0
" " Don't Popup on dot.
" let g:jedi#completions_enabled = 0
" let g:jedi#popup_on_dot = 0
" " quickrunと被るため大文字に変更
" " gundoと被るため大文字に変更 (2013-06-24 10:00 追記)
" let g:jedi#rename_command = '<Leader>R'
" let g:jedi#goto_assignments_command = '<Leader>G'
" endfunction
" Do not load vim-pyenv until *.py is opened and
" make sure that it is loaded after jedi-vim is loaded.
" NeoBundleLazy 'lambdalisue/vim-pyenv', {
" \ 'depends': ['davidhalter/jedi-vim'],
" \ 'autoload': {
" \ 'filetypes': ['python', 'python3'],
" \ }}
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" [BugFix] Djangoを正しくVimで読み込めるようにする
" [BugFix] Vimで正しくvirtualenvを処理できるようにする
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" " Djangoを正しくVimで読み込めるようにする
" [ERROR] vim-django-support will suppress vim performnce
" NeoBundleLazy "lambdalisue/vim-django-support", {
" \ "autoload": {
" \ "filetypes": ["python", "python3", "djangohtml"]
" \ }}
"
" Vimで正しくvirtualenvを処理できるようにする
NeoBundleLazy "jmcantrell/vim-virtualenv", {
\ "autoload": {
\ "filetypes": ["python", "python3", "djangohtml"]
\ }}
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Neo-Snippet
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" NeoBundleLazy "Shougo/neosnippet.vim", {
" \ "depends": ["honza/vim-snippets"],
" \ "autoload": {
" \ "insert": 1,
" \ }}
"
" let s:hooks = neobundle#get_hooks("neosnippet.vim")
" function! s:hooks.on_source(bundle)
"
" " 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)
"
" " SuperTab like snippets behavior.
" imap <expr><TAB> neosnippet#expandable_or_jumpable() ?
" \ "\<Plug>(neosnippet_expand_or_jump)"
" \: pumvisible() ? "\<C-n>" : "\<TAB>"
" smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
" \ "\<Plug>(neosnippet_expand_or_jump)"
" \: "\<TAB>"
" " For snippet_complete marker.
" if has('conceal')
" set conceallevel=2 concealcursor=i
" endif
"
" " Enable snipMate compatibility feature.
" let g:neosnippet#enable_snipmate_compatibility = 1
"
" " Tell Neosnippet about the other snippets
" let g:neosnippet#snippets_directory=s:bundle_root . '/vim-snippets/snippets'
" endfunction
"
" NeoBundle "Shougo/neosnippet-snippets"
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" vim-indent-guides
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundle "nathanaelkane/vim-indent-guides"
" vim立ち上げたときに、自動的にvim-indent-guidesをオンにする
let g:indent_guides_enable_on_vim_startup=1
" ガイドをスタートするインデントの量
let g:indent_guides_start_level=1
" 自動カラーを無効にする
let g:indent_guides_auto_colors=0
" 奇数インデントのカラー
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=#262626 ctermbg=gray
" 偶数インデントのカラー
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=#3c3c3c ctermbg=darkgray
" ハイライト色の変化の幅
let g:indent_guides_color_change_percent = 30
" ガイドの幅
let g:indent_guides_guide_size = 1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" vim-grammarous
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundle "rhysd/vim-grammarous"
" let g:grammarous#default_comments_only_filetypes = {
" \ '*' : 1, 'help' : 0, 'markdown' : 0,
" \ }
let g:grammarous#disabled_rules = {
\ '*' : ['WHITESPACE_RULE', 'EN_QUOTES'],
\ 'help' : ['WHITESPACE_RULE', 'EN_QUOTES', 'SENTENCE_WHITESPACE', 'UPPERCASE_SENTENCE_START'],
\ }
let g:grammarous#hooks = {}
function! g:grammarous#hooks.on_check(errs)
nmap <buffer><C-n> <Plug>(grammarous-move-to-next-error)
nmap <buffer><C-p> <Plug>(grammarous-move-to-previous-error)
nmap <buffer><Esc><Esc> <Plug>(grammarous-reset)
endfunction
function! g:grammarous#hooks.on_reset(errs)
nunmap <buffer><C-n>
nunmap <buffer><C-p>
nunmap <buffer><Esc><Esc>
endfunction
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" gundo.vim
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundleLazy "sjl/gundo.vim", {
\ "autoload": {
\ "commands": ['GundoToggle'],
\}}
nnoremap <Space>g :GundoToggle<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" TaskList
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundleLazy "vim-scripts/TaskList.vim", {
\ "autoload": {
\ "mappings": ['<Plug>TaskList'],
\}}
nmap <Space>T <plug>TaskList
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Tagbar
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundle 'majutsushi/tagbar', {
\ "autload": {
\ "commands": ["TagbarToggle"],
\ },
\ "build": {
\ "mac": "brew install ctags",
\ }}
nmap <Space>t :TagbarToggle<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" QuickRun
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundleLazy "thinca/vim-quickrun", {
\ "autoload": {
\ "mappings": [['nxo', '<Plug>(quickrun)']]
\ }}
if has("clientserver")
nmap <Space>r :QuickRun -runner vimproc<CR>
else
nmap <Space>r <Plug>(quickrun)
endif
let s:hooks = neobundle#get_hooks("vim-quickrun")
function! s:hooks.on_source(bundle)
let g:quickrun_config = {
\ "_": {
\ "outputter/buffer/close_on_empty" : 1,
\ "outputter/buffer/split" : ":vertical rightb",
\ "runner" : "vimproc",
\ "runner/vimproc/updatetime" : 60,
\ },
\ "python":{
\ "type" : "python",
\ "command" : "python",
\ },}
endfunction
" <C/c>で、強制終了
" quickrun.vim が実行していない場合には <C-c> を呼び出す
nnoremap <expr><silent> <C-c> quickrun#is_running() ? quickrun#sweep_sessions() : "\<C-c>"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" VimPandoc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundleLazy "vim-pandoc/vim-pandoc", {
\ "autoload": {
\ "filetypes": ["text", "pandoc", "markdown", "rst", "textile"],
\ }}
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Syntastic
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"[TODO] エラー表示の矢印がどう考えても劣化している。
"[TODO] コードに直接色づけするのをやめさせる。
NeoBundle "scrooloose/syntastic"
", {
" \ "build": {
" \ "mac": ["pip install flake8", "npm -g install coffeelint"],
" \ "unix": ["pip install flake8", "npm -g install coffeelint"],
" \ }}
let g:syntastic_enable_signs = 1
let g:syntastic_auto_loc_list = 2
let g:syntastic_check_on_open = 0
let g:syntastic_check_on_wq = 0
" Python用のチェッカー指定
" pylint is not available for pyenv
let g:syntastic_python_python_exec = 'python'
let g:syntastic_python_checkers = ["flake8","pyflakes","pep257","pep8","python"]
" エラー無視の設定
" 複数指定する場合はカンマ区切り
let g:syntastic_python_pep8_args = '--ignore="E501,E128"'
let g:syntastic_python_pylint_args = '--disable="C0301,W1402"'
let g:syntastic_python_flake8_args = '--ignore="E501,E128"'
" Go用のチェッカー
" let g:syntastic_mode_map = { 'mode': 'passive',
" \ 'active_filetypes': ['go'] }
let g:syntastic_go_checkers = ['go', 'golint', 'govet', 'errcheck', 'gofmt']
" let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim-R-Plugin
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundleLazy 'jcfaria/Vim-R-Plugin', {
\ "autoload": {
\ "filetypes": ["R"],
\ }}
let vimrplugin_r_path='C:\Program Files\R\R-3.0.3\bin'
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" HTML5 ominicomplete & syntax
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundleLazy 'othree/html5.vim', {
\ 'autoload': {'filetypes': ['html']}
\ }
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CSS3 syntax
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundleLazy 'hail2u/vim-css3-syntax', {
\ 'autoload': {'filetypes': ['css']}
\ }
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" vim-ref
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundleLazy 'thinca/vim-ref', {
\ 'autoload': {'commands': ['Ref']}
\ }
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Auto Save
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundle 'vim-scripts/vim-auto-save'
" デフォルトで無効にする
let g:auto_save = 0
" do not save while in insert mode
let g:auto_save_in_insert_mode = 0
nmap [toggle]S :AutoSaveToggle<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Markdown
" Previm
" Markdownの自己完結型プレビューワー
" [TODO] 何とか駆動するようにがんばろう。。。
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundleLazy 'plasticboy/vim-markdown', {
\ 'autoload': {'filetypes': ['pandoc','md', 'mkd']}
\ }
let s:hooks = neobundle#get_hooks("vim-markdown")
function! s:hooks.on_source(bundle)
" Markdown Preview
let g:vim_markdown_folding_disabled = 1
endfunction
NeoBundleLazy 'tyru/open-browser.vim', {
\ 'autoload': {'filetypes': ['pandoc','md', 'mkd']}
\ }
NeoBundleLazy 'kannokanno/previm', {
\ 'autoload': {'filetypes': ['pandoc','md', 'mkd']}
\ }
" <F7>でプレビュー
nnoremap <silent> <F7> :PrevimOpen<CR>
" 現在のタブを閉じる
nnoremap <silent> <Leader>q :ChromeTabClose<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Tcomment_vim
" コメントON/OFFを手軽に実行
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundle 'tomtom/tcomment_vim'
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim Trailing WhiteSpace
" 行末の半角スペースを可視化
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundle 'bronson/vim-trailing-whitespace'
let g:extra_whitespace_ignored_filetypes = ['unite', 'mkd', 'md']
""""""""""""""""""""""""""""""""""""""""""""""""
" Indent Obey PEP8.
""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundleLazy 'hynek/vim-python-pep8-indent', {
\ "autoload": {
\ "filetypes": ["python", "python3", "djangohtml"],
\ },
\ }
""""""""""""""""""""""""""""""""""""""""""""""""
" Python Syntax Highlighting
""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundleLazy 'hdima/python-syntax', {
\ "autoload": {
\ "filetypes": ["python", "python3", "djangohtml"],
\ },
\ }
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"カラースキーマの設定
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Hybrid カラースキーム
NeoBundle 'w0ng/vim-hybrid'
" solarized カラースキーム
NeoBundle 'altercation/vim-colors-solarized'
" mustang カラースキーム
NeoBundle 'croaker/mustang-vim'
" wombat カラースキーム
NeoBundle 'jeffreyiacono/vim-colors-wombat'
" jellybeans カラースキーム
NeoBundle 'nanotech/jellybeans.vim'
" lucius カラースキーム
NeoBundle 'vim-scripts/Lucius'
" zenburn カラースキーム
NeoBundle 'vim-scripts/Zenburn'
" mrkn256 カラースキーム
NeoBundle 'mrkn/mrkn256.vim'
" railscasts カラースキーム
NeoBundle 'jpo/vim-railscasts-theme'
" pyte カラースキーム
NeoBundle 'therubymug/vim-pyte'
" molokai カラースキーム
NeoBundle 'tomasr/molokai'
call neobundle#end()
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" インストールされていないプラグインのチェックおよびダウンロード
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
NeoBundleCheck
let g:hybrid_use_Xresources = 1
colorscheme jellybeans
endif
filetype on
" 注意: この内容は:filetype onよりも後に記述すること。
autocmd FileType *
\ if &l:omnifunc == ''
\ | setlocal omnifunc=syntaxcomplete#Complete
\ | endif
" 普通は入れなくても動くと思うが、挙動不審なとき用の設定
" -----
" 文字コード関係で困ったとき用
set fileencodings=utf-8,iso-2022-jp,eucjp,cp932,ucs-bom,latin1
set fileformats=unix,dos,mac
" vim内部のエンコーディング
set encoding=utf-8
" 表示関係
" -----
" 256色許可
set t_Co=256
" ステータスラインを常に表示
set laststatus=2
" コマンドラインの行数
set cmdheight=1
" Title掃除
set notitle
" 編集中のファイル名の表示
"set title
" 行番号の色
highlight LineNr ctermfg=darkyellow
" シンタックス・ハイライトを有効にする
syntax on
" コマンドをステータスラインに表示
set showcmd
" 左端に行番号を表示する
set number
" カーソル行の背景色を変える
set cursorline
" 長い文字の折り返し
set wrap
" 自動改行無効化
set textwidth=0
" その代わり80文字目にラインを入れる
set colorcolumn=80
" 前時代的スクリーンベルの無効化
set t_vb=
set novisualbell
" 不可視文字も表示する
set list
" デフォルトの不可視文字は美しくないのでUniCodeできれいに
set listchars=eol:¬,tab:▸\
"set listchars=eol:~
"set listchars=tab:»\ ,trail:-,extends:»,precedes:«,nbsp:%
" モードの表示
" lightlineとの併用のため無効化しました。(2014/03/24)
set noshowmode
" ファイルマネージャで上キーで上のディレクトリに
set wildmenu
" 背景を真っ黒にする。
set background=dark
"日本語の行の連結時には空白を入力しない。
set formatoptions+=mM
"□や○の文字があってもカーソル位置がずれないようにする。
set ambiwidth=double
"画面最後の行をできる限り表示する。
set display+=lastline
" インデント関係
" -----
" オートインデント
set autoindent
set smartindent
set cindent
" ハードタブ教 & タブは4文字教 の人に最適化
" -----
" 自動インデント等を有効にする
" filetype plugin indent on
" ファイルを開いた時のTab文字(<Tab>, \t)を空白何文字分で表示するか
set tabstop=4
" 自動インデントや << or >> で入力されるインデントの幅
set shiftwidth=4
" 入力中にTabキーを押した時、何文字分の空白で表示するか
set softtabstop=4
" Tabを空白に変換する
set expandtab
" 検索関係
" -----
" 検索文字列をハイライトする
set hlsearch
" 検索する時、大文字と小文字を無視する
set ignorecase
" 検索文字に大文字が入ったらやっぱり考慮する
set smartcase
" インクリメンタルサーチ
set incsearch
" バックスラッシュやクエスチョンを状況に合わせてエスケープする
cnoremap <expr> / getcmdtype() == '/' ? '\/' : '/'
cnoremap <expr> ? getcmdtype() == '?' ? '\?' : '?'
" 編集関係
" -----
" 全モードでのマウス有効化
set mouse=a
" '<'や'>'でインデントする際に'shiftwidth'の倍数に丸める
set shiftround
" 補完時に大文字小文字を区別しない
set infercase
" cursorを文字がない部分でも動くようにする。
set virtualedit=all
" 左右のカーソル移動で行間移動可能にする。
set whichwrap=b,s,h,l,<,>,[,]
" バッファ切り替え時にHidden(プロセスを殺さない)
set hidden
" 新しく開く代わりにすでに開いているバッファを開く
set switchbuf=useopen
" 対応する括弧などのハイライト表示
set showmatch
" 対応括弧のハイライト表示を三秒間にする
set matchtime=3
" 対応括弧に<>を入れる
set matchpairs& matchpairs+=<:>
" BackSpaceでなんでも消す
set backspace=indent,eol,start
" Swapファイル?Backupファイル?前時代的すぎ
" なので全て無効化する
set nowritebackup
set nobackup
set noswapfile
set noundofile