-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.vimrc.plugins_setting
508 lines (438 loc) · 17.6 KB
/
.vimrc.plugins_setting
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
"-------------------------------------------------------------------------------
" プラグインごとの設定 Plugins
"-------------------------------------------------------------------------------
"------------------------------------
" YankRing.vim
"------------------------------------
" Yankの履歴参照
nmap ,y ;YRShow<CR>
"------------------------------------
" MiniBufExplorer
"------------------------------------
"set minibfexp
let g:miniBufExplMapWindowNavVim=1 "hjklで移動
let g:miniBufExplSplitBelow=0 " Put new window above
let g:miniBufExplMapWindowNavArrows=1
let g:miniBufExplMapCTabSwitchBufs=1
let g:miniBufExplModSelTarget=1
let g:miniBufExplSplitToEdge=1
let g:miniBufExplMaxSize = 10
":MtでMiniBufExplorerの表示トグル
command! Mt :TMiniBufExplorer
"------------------------------------
" Align
"------------------------------------
" Alignを日本語環境で使用するための設定
let g:Align_xstrlen = 3
"------------------------------------
" VTreeExplorer
"------------------------------------
" 縦に表示する
let g:treeExplVertical=1
"------------------------------------
" NERD_commenter.vim
"------------------------------------
" コメントの間にスペースを空ける
let NERDSpaceDelims = 1
"<Leader>xでコメントをトグル(NERD_commenter.vim)
map <Leader>x, c<space>
""未対応ファイルタイプのエラーメッセージを表示しない
let NERDShutUp=1
" ------------------------------------
" grep.vim
"------------------------------------
" 検索外のディレクトリ、ファイルパターン
let Grep_Skip_Dirs = '.svn .git .hg'
let Grep_Skip_Files = '*.bak *~'
"------------------------------------
" surround.vim
"------------------------------------
" s, ssで選択範囲を指定文字でくくる
nmap s <Plug>Ysurround
nmap ss <Plug>Yssurround
let g:surround_{char2nr('e')} = "begin \r end"
let g:surround_{char2nr('d')} = "do \r end"
let g:surround_{char2nr("-")} = ":\r"
"------------------------------------
" smartchr.vim
"------------------------------------
" inoremap <expr> = smartchr#loop('=', '==', '=>')
" inoremap <expr> . smartchr#loop('.', '->', '=>')
"
" " 演算子の間に空白を入れる
" inoremap <buffer><expr> + smartchr#one_of(' + ', ' ++ ', '+')
" inoremap <buffer><expr> += smartchr#one_of(' += ')
" " inoremap <buffer><expr> - smartchr#one_of(' - ', ' -- ', '-')
" inoremap <buffer><expr> -= smartchr#one_of(' -= ')
" " inoremap <buffer><expr> / smartchr#one_of(' / ', ' // ', '/')
" inoremap <buffer><expr> /= smartchr#one_of(' /= ')
" inoremap <buffer><expr> * smartchr#one_of(' * ', ' ** ', '*')
" inoremap <buffer><expr> *= smartchr#one_of(' *= ')
" inoremap <buffer><expr> & smartchr#one_of(' & ', ' && ', '&')
" inoremap <buffer><expr> % smartchr#one_of(' % ', '%')
" inoremap <buffer><expr> => smartchr#one_of(' => ')
" inoremap <buffer><expr> <- smartchr#one_of(' <- ')
" inoremap <buffer><expr> <Bar> smartchr#one_of(' <Bar> ', ' <Bar><Bar> ', '<Bar>')
" inoremap <buffer><expr> , smartchr#one_of(', ', ',')
" " 3項演算子の場合は、後ろのみ空白を入れる
" inoremap <buffer><expr> ? smartchr#one_of('? ', '?')
" " inoremap <buffer><expr> : smartchr#one_of(': ', '::', ':')
" " =の場合、単純な代入や比較演算子として入力する場合は前後にスペースをいれる。
" " 複合演算代入としての入力の場合は、直前のスペースを削除して=を入力
" inoremap <buffer><expr> = search('¥(&¥<bar><bar>¥<bar>+¥<bar>-¥<bar>/¥<bar>>¥<bar><¥) ¥%#', 'bcn')? '<bs>= ' : search('¥(*¥<bar>!¥)¥%#', 'bcn') ? '= ' : smartchr#one_of(' = ', ' == ', '=')
" " 下記の文字は連続して現れることがまれなので、二回続けて入力したら改行する
" inoremap <buffer><expr> } smartchr#one_of('}', '}<cr>')
" inoremap <buffer><expr> ; smartchr#one_of(';', ';<cr>')
" "()は空白入れる
" inoremap <buffer><expr> ( smartchr#one_of('( ')
" inoremap <buffer><expr> ) smartchr#one_of(' )')
" " if文直後の(は自動で間に空白を入れる
" inoremap <buffer><expr> ( search('¥<¥if¥%#', 'bcn')? ' (': '('
"------------------------------------
" Fugitive.vim
"------------------------------------
nnoremap <Space>gd :<C-u>Gdiff<Enter>
nnoremap <Space>gs :<C-u>Gstatus<Enter>
nnoremap <Space>gl :<C-u>Glog<Enter>
nnoremap <Space>ga :<C-u>Gwrite<Enter>
nnoremap <Space>gc :<C-u>Gcommit<Enter>
nnoremap <Space>gC :<C-u>Git commit --amend<Enter>
nnoremap <Space>gb :<C-u>Gblame<Enter>
"------------------------------------
" BufExplorer
"------------------------------------
"<Leader>l<Space>でBufferList
nnoremap <Leader>l<Space> :BufExplorer<CR>
"------------------------------------
" VTreeExplorer
"------------------------------------
let g:treeExplVertical=1
"<Leader>t<Space>でディレクトリツリー表示
noremap <Leader>t<Space> :VSTreeExplore<CR>
"分割したウィンドウのサイズ
let g:treeExplWinSize=30
"------------------------------------
" DumbBuf.vim
"------------------------------------
"<Leader>b<Space>でBufferList
let dumbbuf_hotkey = '<Leader>b<Space>'
let dumbbuf_mappings = {
\ 'n': {
\'<Esc>': { 'opt': '<silent>', 'mapto': ':<C-u>close<CR>' }
\}
\}
let dumbbuf_single_key = 1
let dumbbuf_updatetime = 1 " &updatetimeの最小値
let dumbbuf_wrap_cursor = 0
let dumbbuf_remove_marked_when_close = 1
"------------------------------------
" vim-indent-guides
"------------------------------------
nnoremap <silent> <Space>id :<C-u>IndentGuidesToggle<Enter>
let g:indent_guides_auto_colors = 0
let g:indent_guides_start_level = 4
let g:indent_guides_guide_size = 1
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=red ctermbg=3
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=green ctermbg=4
if 'dark' == &background
hi IndentGuidesOdd ctermbg=black
hi IndentGuidesEven ctermbg=darkgrey
else
hi IndentGuidesOdd ctermbg=white
hi IndentGuidesEven ctermbg=lightgrey
endif
"------------------------------------
" smooth_scroll.vim
"------------------------------------
map :call SmoothScroll("d",1, 1)<CR>
map :call SmoothScroll("u",1, 1)<CR>
"------------------------------------
" gundo.Vim
"------------------------------------
" nmap U :<C-u>GundoToggle<CR>
"------------------------------------
" taglist.Vim
"------------------------------------
" 関数一覧
set tags=tags
"set tags+=~/.tags
"let Tlist_Ctags_Cmd = '/Applications/MacVim.app/Contents/MacOS/ctags' " ctagsのパス
let Tlist_Show_One_File = 1 " 現在編集中のソースのタグしか表示しない
let Tlist_Exit_OnlyWindow = 1 " taglistのウィンドーが最後のウィンドーならばVimを閉じる
" let Tlist_Use_Right_Window = 1 " 右側でtaglistのウィンドーを表示
let Tlist_Enable_Fold_Column = 1 " 折りたたみ
let Tlist_Auto_Open = 1 " 自動表示
let Tlist_Auto_Update = 1
let Tlist_WinWidth = 30
"map <silent> <leader>tl :Tlist<CR> " taglistを開くショットカットキー
nmap <F7> :CMiniBufExplorer<CR>:TrinityToggleTagList<CR>:TMiniBufExplorer<CR>
nmap <Leader>tl :CMiniBufExplorer<CR>:TrinityToggleTagList<CR>:TMiniBufExplorer<CR>
"------------------------------------
" Srcexp
"------------------------------------
" [Srcexpl] tagsを利用したソースコード閲覧・移動補助機能
let g:SrcExpl_UpdateTags = 1 " tagsをsrcexpl起動時に自動で作成(更新)
let g:SrcExpl_RefreshTime = 0 " 自動表示するまでの時間(0:off)
let g:SrcExpl_WinHeight = 9 " プレビューウインドウの高さ
let g:SrcExpl_RefreshMapKey = "<Space>" " 手動表示のMAP
let g:SrcExpl_GoBackMapKey = "<C-b>" " 戻る機能のMAP
" Source Explorerの機能ON/OFF
" nmap <F8> :CMiniBufExplorer<CR>:SrcExplToggle<CR>:TMiniBufExplorer<CR>
"------------------------------------
" open-blowser.vim
"------------------------------------
" カーソル下のURLをブラウザで開く
nmap <Leader>fu <Plug>(openbrowser-open)
vmap <Leader>fu <Plug>(openbrowser-open)
" カーソル下のキーワードをググる
nnoremap <Leader>fs :<C-u>OpenBrowserSearch<Space><C-r><C-w><Enter>
"------------------------------------
" operator-camelize.vim
"------------------------------------
" camel-caseへの変換
map <Leader>u <Plug>(operator-camelize)
map <Leader>U <Plug>(operator-decamelize)
"------------------------------------
" operator-replace.vim
"------------------------------------
" RwなどでYankしてるもので置き換える
map R <Plug>(operator-replace)
"------------------------------------
" sumartword.vim
"------------------------------------
noremap ,w w
noremap ,b b
noremap ,e e
noremap ,ge ge
map W <Plug>(smartword-w)
map B <Plug>(smartword-b)
map E <Plug>(smartword-e)
map ge <Plug>(smartword-ge)
"------------------------------------
" camelcasemotion.vim
"------------------------------------
" <Shift-wbe>でCameCaseやsnake_case単位での単語移動
map <silent> w <Plug>CamelCaseMotion_w
map <silent> b <Plug>CamelCaseMotion_b
map <silent> e <Plug>CamelCaseMotion_e
" text-objectで使用できるように
omap <silent> iw <Plug>CamelCaseMotion_iw
xmap <silent> iw <Plug>CamelCaseMotion_iw
omap <silent> ib <Plug>CamelCaseMotion_ib
xmap <silent> ib <Plug>CamelCaseMotion_ib
omap <silent> ie <Plug>CamelCaseMotion_ie
xmap <silent> ie <Plug>CamelCaseMotion_ie
"------------------------------------
" errormarker.vim
"------------------------------------
" disable default shortcut mapping and re-define to <Leader>ec
let g:errormarker_disablemappings = 1
nmap <silent> <unique> <Leader>ec :ErrorAtCursor<CR>
"------------------------------------
" vimshell
"------------------------------------
let g:vimshell_user_prompt = 'fnamemodify(getcwd(), ":~")'
let g:vimshell_right_prompt = 'vimshell#vcs#info("(%s)-[%b]", "(%s)-[%b|%a]")'
let g:vimshell_enable_smart_case = 1
if has('win32') || has('win64')
" Display user name on Windows.
let g:vimshell_prompt = $USERNAME."% "
else
" Display user name on Linux.
let g:vimshell_prompt = $USER."% "
call vimshell#set_execute_file('bmp,jpg,png,gif', 'gexe eog')
call vimshell#set_execute_file('mp3,m4a,ogg', 'gexe amarok')
let g:vimshell_execute_file_list['zip'] = 'zipinfo'
call vimshell#set_execute_file('tgz,gz', 'gzcat')
call vimshell#set_execute_file('tbz,bz2', 'bzcat')
endif
function! g:my_chpwd(args, context)
call vimshell#execute('echo "chpwd"')
endfunction
function! g:my_emptycmd(cmdline, context)
call vimshell#execute('echo "emptycmd"')
return a:cmdline
endfunction
function! g:my_preprompt(args, context)
call vimshell#execute('echo "preprompt"')
endfunction
function! g:my_preexec(cmdline, context)
call vimshell#execute('echo "preexec"')
if a:cmdline =~# '^\s*diff\>'
call vimshell#set_syntax('diff')
endif
return a:cmdline
endfunction
function! VimShellCustomKeyMapping()
nnoremap <buffer> <C-j> <C-w>j
nnoremap <buffer> <C-k> <C-w>k
nnoremap <buffer> <C-l> <C-w>l
nnoremap <buffer> <C-h> <C-w>h
inoremap <buffer> <C-j> <C-w>j
inoremap <buffer> <C-k> <C-w>k
inoremap <buffer> <C-l> <C-w>l
inoremap <buffer> <C-h> <C-w>h
endfunction
autocmd FileType vimshell
\ call vimshell#altercmd#define('g', 'git')
\| call vimshell#altercmd#define('i', 'iexe')
\| call vimshell#altercmd#define('l', 'll')
\| call vimshell#altercmd#define('ll', 'ls -l')
\| call vimshell#hook#set('chpwd', ['g:my_chpwd'])
\| call vimshell#hook#set('emptycmd', ['g:my_emptycmd'])
\| call vimshell#hook#set('preprompt', ['g:my_preprompt'])
\| call vimshell#hook#set('preexec', ['g:my_preexec'])
autocmd FileType vimshell call VimShellCustomKeyMapping()
autocmd FileType int-rails call VimShellCustomKeyMapping()
command! Vs :VimShell
command! Vsrc :VimShellInteractive rails console
nmap <Leader>pry :VimShellInteractive pry<CR>
nmap <Leader>irb :VimShellInteractive irb<CR>
"------------------------------------
" unite.vim
"------------------------------------
" The prefix key.
nnoremap [unite] <Nop>
nmap f [unite]
nnoremap [unite]u :<C-u>Unite -no-split<Space>
" 全部乗せ
nnoremap <silent> [unite]a :<C-u>UniteWithCurrentDir -no-split -buffer-name=files buffer file_mru bookmark file<CR>
" ファイル一覧
nnoremap <silent> [unite]f :<C-u>Unite -no-split -buffer-name=files file<CR>
" バッファ一覧
nnoremap <silent> [unite]b :<C-u>Unite -no-split buffer<CR>
" 常用セット
nnoremap <silent> [unite]u :<C-u>Unite -no-split buffer file_mru<CR>
" 最近使用したファイル一覧
nnoremap <silent> [unite]m :<C-u>Unite -no-split file_mru<CR>
" 現在のバッファのカレントディレクトリからファイル一覧
nnoremap <silent> [unite]d :<C-u>UniteWithBufferDir -no-split file<CR>
" snippet一覧
nnoremap <silent> [unite]s :<C-u>Unite snippet<CR>
" nnoremap <silent> [unite]b :<C-u>UniteWithBufferDir -buffer-name=files buffer file_mru bookmark file<CR>
let g:yankring_zap_keys = ""
" from basyura/unite-rails
nnoremap <silent> [unite]rm :<C-u>Unite -no-split rails/model<CR>
nnoremap <silent> [unite]rc :<C-u>Unite -no-split rails/controller<CR>
nnoremap <silent> [unite]rv :<C-u>Unite -no-split rails/view<CR>
nnoremap <silent> [unite]rl :<C-u>Unite -no-split rails/lib<CR>
nnoremap <silent> [unite]rj :<C-u>Unite -no-split rails/javascript<CR>
nnoremap <silent> [unite]rs :<C-u>Unite -no-split rails/spec<CR>
autocmd FileType unite call s:unite_my_settings()
function! s:unite_my_settings()"{{{
" Overwrite settings.
" ESCキーを2回押すと終了する
nmap <buffer> <ESC> <Plug>(unite_exit)
nmap <buffer> <ESC><ESC> <Plug>(unite_exit)
imap <buffer> jj <Plug>(unite_insert_leave)
nnoremap <silent><buffer> <C-k> :<C-u>call unite#mappings#do_action('preview')<CR>
imap <buffer> <C-w> <Plug>(unite_delete_backward_path)
" Start insert.
let g:unite_enable_start_insert = 1
" ウィンドウを分割して開く
nnoremap <silent> <buffer> <expr> <C-l> unite#do_action('split')
inoremap <silent> <buffer> <expr> <C-l> unite#do_action('split')
" ウィンドウを縦に分割して開く
nnoremap <silent> <buffer> <expr> <C-v> unite#do_action('vsplit')
inoremap <silent> <buffer> <expr> <C-v> unite#do_action('vsplit')
endfunction"}}}
let g:unite_source_file_mru_limit = 200
" unite-plugins
cnoremap UH Unite help<Enter>
cnoremap UO Unite outline<Enter>
"------------------------------------
" quickrun.vim
"------------------------------------
let g:quickrun_config = {}
let g:quickrun_config._ = {
\ 'runner' : 'vimproc',
\ "runner/vimproc/updatetime" : 60,
\ 'outputter/buffer/split' : ':botright 8sp',
\ 'outputter/buffer/close_on_empty' : 1
\}
let g:quickrun_config['rspec/bundle'] = {
\ 'type': 'rspec/bundle',
\ 'command': "rspec",
\ 'cmdopt': "-l %{line('.')}",
\ 'exec': "bundle exec %c %o %s ",
\ 'outputter/buffer/filetype': 'rspec-result',
\ 'filetype': 'rspec-result'
\}
let g:quickrun_config['rspec/normal'] = {
\ 'type': 'rspec/normal',
\ 'command': "rspec",
\ 'cmdopt': "-l %{line('.')}",
\ 'exec': '%c %o %s',
\ 'outputter/buffer/filetype': 'rspec-result',
\ 'filetype': 'rspec-result'
\}
function! RSpecQuickrun()
let b:quickrun_config = {'type' : 'rspec/bundle'}
endfunction
" <C-c> で実行を強制終了させる
" quickrun.vim が実行していない場合には <C-c> を呼び出す
nnoremap <expr><silent> <C-c> quickrun#is_running() ? quickrun#sweep_sessions() : "\<C-c>"
autocmd BufReadPost *_spec.rb call RSpecQuickrun()
"------------------------------------
" Pydiction
"------------------------------------
let g:pydiction_location = '~/.vim/bundle/pydiction/complete-dict'
"------------------------------------
" Syntastic
"------------------------------------
" エラー行をsignで表示する
let g:syntastic_enable_signs = 1
" 可能ならhighligt表示する
let g:syntastic_enable_highlighting = 1
" 自動的に開いたり閉じたりする
let g:syntastic_auto_loc_list=1
"------------------------------------
" toggle.vim
"------------------------------------
imap <C-A> <Plug>ToggleI
nmap <C-A> <Plug>ToggleN
vmap <C-A> <Plug>ToggleV
let g:toggle_pairs = { 'and':'or', 'or':'and', 'if':'unless', 'unless':'if', 'yes':'no', 'no':'yes', 'enable':'disable', 'disable':'enable', 'pick':'reword', 'reword':'fixup', 'fixup':'squash', 'squash':'edit', 'edit':'exec', 'exec':'pick' }
"------------------------------------
" vim-rails.vim
"------------------------------------
let g:rails_some_option = 1
let g:rails_level = 4
let g:rails_syntax = 1
let g:rails_statusline = 1
let g:rails_url='http://localhost:3000'
let g:rails_subversion=0
" let g:dbext_default_SQLITE_bin = 'mysql2'
let g:rails_default_file='config/database.yml'
" let g:rails_ctags_arguments = ''
function! SetUpRailsSetting()
nmap <buffer><C-C> <Nop>
imap <buffer><C-C> <Nop>
map <buffer><C-_><C-C> <Nop>
nmap <buffer><Space>r :R<CR>
nmap <buffer><Space>a :A<CR>
nmap <buffer><Space>m :Rmodel<Space>
nmap <buffer><Space>c :Rcontroller<Space>
nmap <buffer><Space>v :Rview<Space>
nmap <buffer><Space>s :Rspec<Space>
nmap <buffer><Space>p :Rpreview<CR>
nmap <buffer><Space>t :Runittest<CR>
au FileType ruby,eruby,ruby.rspec let g:neocomplcache_dictionary_filetype_lists = {
\'ruby' : $HOME.'/.vim/dict/rails.dict',
\'eruby' : $HOME.'/.vim/dict/rails.dict'
\}
setl dict+=~/.vim/dict/rails.dict
setl dict+=~/.vim/dict/ruby.dict
endfunction
autocmd User Rails call SetUpRailsSetting()
"------------------------------------
" mattn/vim-metarw-redmine
"------------------------------------
let g:metarw_redmine_server = 'http://redmine.dev.scaleout.jp'
let g:metarw_redmine_apikey = '2ed945f405865ec799ff91b7bb364215f932c51c'
"------------------------------------
" GoLang gocde
"------------------------------------
set completeopt=menu,preview
" run go fmt on buffer write
auto BufWritePre *.go Fmt