-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
456 lines (395 loc) · 12.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
"dein" {{{
"dein Scripts-----------------------------
if &compatible
set nocompatible " Be iMproved
endif
" Required:
set runtimepath+=$HOME/.vim/bundles/repos/github.com/Shougo/dein.vim
if dein#load_state('$HOME/.vim/bundles')
" Required:
call dein#begin('$HOME/.vim/bundles')
call dein#add('$HOME/.vim/bundles/repos/github.com/Shougo/dein.vim')
" Add or remove your plugins here:
call dein#add('Lokaltog/vim-easymotion')
call dein#add('Shougo/deoplete.nvim')
if !has('nvim')
call dein#add('roxma/nvim-yarp')
call dein#add('roxma/vim-hug-neovim-rpc')
endif
call dein#add('Shougo/neomru.vim')
call dein#add('Shougo/neosnippet-snippets')
call dein#add('Shougo/neosnippet.vim')
call dein#add('Shougo/unite.vim')
call dein#add('Sixeight/unite-grep')
call dein#add('altercation/vim-colors-solarized')
call dein#add('basyura/unite-rails')
call dein#add('bling/vim-airline')
call dein#add('briancollins/vim-jst')
call dein#add('chriskempson/vim-tomorrow-theme')
call dein#add('csscomb/vim-csscomb')
call dein#add('digitaltoad/vim-jade')
call dein#add('duganchen/vim-soy')
call dein#add('fatih/vim-go')
call dein#add('fuenor/im_control.vim')
call dein#add('gmarik/sudo-gui.vim')
call dein#add('groenewege/vim-less')
call dein#add('honza/vim-snippets')
call dein#add('kana/vim-textobj-user')
call dein#add('kchmck/vim-coffee-script')
call dein#add('leafgarland/typescript-vim')
call dein#add('lilydjwg/colorizer')
call dein#add('nathanaelkane/vim-indent-guides')
call dein#add('nazo/pt.vim')
call dein#add('nono/vim-handlebars')
call dein#add('osyo-manga/vim-over')
call dein#add('othree/html5.vim')
call dein#add('othree/yajs.vim')
call dein#add('plasticboy/vim-markdown')
call dein#add('rhysd/github-complete.vim')
call dein#add('rhysd/vim-textobj-ruby')
call dein#add('rking/ag.vim')
call dein#add('scrooloose/nerdcommenter')
call dein#add('scrooloose/nerdtree')
call dein#add('sjl/gundo.vim')
call dein#add('slim-template/vim-slim')
call dein#add('taku-o/vim-ro-when-swapfound')
call dein#add('taku-o/vim-toggle')
call dein#add('tell-k/vim-browsereload-mac')
call dein#add('thinca/vim-fontzoom')
call dein#add('thinca/vim-qfreplace')
call dein#add('thinca/vim-quickrun')
call dein#add('thinca/vim-ref')
call dein#add('tomasr/molokai')
call dein#add('tpope/vim-bundler')
call dein#add('tpope/vim-fugitive')
call dein#add('tpope/vim-haml')
call dein#add('tpope/vim-liquid')
call dein#add('tpope/vim-rails')
call dein#add('tpope/vim-rake')
call dein#add('tpope/vim-repeat')
call dein#add('tpope/vim-surround')
call dein#add('ujihisa/neco-look')
call dein#add('ujihisa/rdoc.vim')
call dein#add('ujihisa/unite-colorscheme')
call dein#add('vim-ruby/vim-ruby')
call dein#add('vim-scripts/NERV-ous')
call dein#add('vim-scripts/smartchr')
call dein#add('vim-scripts/sudo.vim')
call dein#add('vim-scripts/zoom.vim')
call dein#add('w0ng/vim-hybrid')
" Required:
call dein#end()
call dein#save_state()
endif
" Required:
filetype plugin indent on
syntax enable
"End dein Scripts-------------------------
" }}}
"BASIC " {{{
"
" font
"set gfn=SCPM:h13
set gfn=ゆたぽん(コーディング):h13
"set gfn=Ricty-Bold:h13
"set gfn=RictyDiscord-Bold:h13
set showcmd
let mapleader=","
" 行番号
set number
" 現在の行をハイライト
"set cursorline
set foldmethod=marker
" インクリメンタルサーチ
set incsearch
" 検索結果のハイライト
set hlsearch
" インデント
set cindent
" タブの設定
set expandtab
set tabstop=2
set softtabstop=2
set shiftwidth=2
set smarttab
set showmatch
set nobackup
set splitright
set splitbelow
set novisualbell
set magic
set wrap
set wildmenu
set smartindent
set ignorecase smartcase
" 検索を循環させない
set nowrapscan
" 文字コード関連
" 文字コードの自動解釈の優先順位
set fileencodings=utf-8,cp932,euc-jp
" 改行コードの解釈優先順位
set fileformats=unix,dos
" 内部の解釈の文字コード 設定ファイルもこのコードで書け
set encoding=utf-8
" 内部の改行コード
set fileformat=unix
syntax enable
" helpの言語の優先順位
set helplang=ja,en
" window size
" please push Alt+F10
" % def ~ end
runtime macros/matchit.vim
" indent guide enable
let g:indent_guides_enable_on_vim_startup=1
let g:indent_guides_guide_size=1
let g:indent_guides_auto_colors = 1
let g:indent_guides_color_change_percent = 5
"autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=black ctermbg=3
"autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=black ctermbg=4
" ESC + ESC = no hi
nnoremap <Esc><Esc> :nohlsearch<CR>
"inoremap <expr> = smartchr#loop(' = ', '=', ' == ')
"autocmd FileType ruby inoremap <expr> = smartchr#loop(' = ', ' => ', '=', ' == ')
"autocmd FileType eruby inoremap <expr> = smartchr#loop('<%= ', ' = ', '=', ' == ')
"autocmd FileType haml inoremap <expr> = smartchr#loop('= ', ' => ', '=', ' == ')
inoremap <expr> , smartchr#one_of(', ', ',')
imap <C-j> <C-[>
nmap <C-j> <C-[>
imap jj <C-[>
function! s:remove_dust()
let cursor = getpos(".")
" 保存時に行末の空白を除去する
" %s/\s\+$//ge
" " 保存時にtabを2スペースに変換する
%s/\t/ /ge
call setpos(".", cursor)
unlet cursor
endfunction
"autocmd BufWritePre * call <SID>remove_dust()
" Ruby1.8 Hashを除去する
" origin by http://robots.thoughtbot.com/post/17450269990/convert-ruby-1-8-to-1-9-hash-syntax
"autocmd BufWritePre * %s/\([^:]\+\):\{1}\([^ :"']\+\)\s=>/\1\2:/ge
" アンチエイリアシング
set antialias
" 検索語を中央に表示する
nmap n nzz
nmap N Nzz
nmap * *zz
nmap # #zz
nmap g* g*zz
nmap g# g#zz
noremap <Leader>t :noautocmd vimgrep /TODO/j **/*.rb **/*.js **/*.coffee **/*.css **/*.sass **/*.spec **/*.erb **/*.haml **/*.slim<CR>:cw<CR>
" http://qiita.com/items/bd97a9b963dae40b63f5
vnoremap <silent> <C-p> "0p<CR>
au BufRead,BufNewFile *.hamlc set ft=haml
au BufRead,BufNewFile *.sass set ft=sass
au BufRead,BufNewFile *.slim set ft=slim
au BufRead,BufNewFile *.schema set ft=ruby
let g:ackprg = 'ag --nogroup --nocolor --column'
" enable clipboard on mac
set clipboard+=unnamed
" for performance
set re=1
set nocursorline
set norelativenumber
set nocursorcolumn
set guicursor=
" set synmaxcol=180
" syntax sync minlines=100 maxlines=1000
" }}}
"COLOR" {{{
"colorscheme nerv-ous
"colorscheme molokai
"let g:molokai_original=1
"set background=dark
"colorscheme solarized
"colorscheme Tomorrow-Night
"colorscheme Tomorrow-Night-Eighties
"colorscheme wombat
"colorscheme jellybeans
let g:hybrid_custom_term_colors = 1
let g:hybrid_use_Xresources = 1
"let g:hybrid_reduced_contrast = 1
set background=dark
colorscheme hybrid
" }}}
" Unite" {{{
" for vim-airline
let g:unite_force_overwrite_statusline = 0
"""" unite.vim
"" ヤンク一覧
nnoremap <silent> ,uy :<C-u>Unite history/yank<CR>
"" バッファ一覧
nnoremap <silent> ,ub :<C-u>Unite buffer<CR>
"" ファイル一覧
nnoremap <silent> ,uf :<C-u>UniteWithBufferDir -buffer-name=files file<CR>
"" レジスタ一覧
nnoremap <silent> ,ur :<C-u>Unite -buffer-name=register register<CR>
"" 最近使用したファイル一覧
"nnoremap <silent> ,um :<C-u>Unite file_mru<CR>
"" 常用セット
nnoremap <silent> ,uu :<C-u>Unite buffer file_mru<CR>
"" 全部乗せ
nnoremap <silent> ,ua :<C-u>UniteWithBufferDir -buffer-name=files buffer file_mru bookmark file<CR>
nnoremap <silent> ,uc :<C-u>Unite colorscheme -auto-preview<CR>
" }}}
" NeoSnippet" {{{
" Tell Neosnippet about the other snippets
let g:neosnippet#snippets_directory='~/.vim/bundle/snipmate-snippets/snippets'
" 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)
xmap <C-l> <Plug>(neosnippet_start_unite_snippet_target)
" For snippet_complete marker.
if has('conceal')
set conceallevel=2 concealcursor=i
endif
" " }}}
" over.vim {{{
" http://qiita.com/PSP_T/items/3a1af1301ee197b32a8a
" over.vimの起動
nnoremap <silent> <Leader>m :OverCommandLine<CR>
" カーソル下の単語をハイライト付きで置換
nnoremap sub :OverCommandLine<CR>%s/<C-r><C-w>//g<Left><Left>
" コピーした文字列をハイライト付きで置換
nnoremap subp y:OverCommandLine<CR>%s!<C-r>=substitute(@0, '!', '\\!', 'g')<CR>!!gI<Left><Left><Left>
" }}}
" Rails.vim " {{{
let g:rails_projections = {
\ "app/assets/javascripts/models/*.js.coffee": {
\ "command": "jmodel",
\ "alternate": "spec/javascripts/models/%s_spec.js.coffee",
\ "template": "class @AppName.Models.%S extends Backbone.Model"
\ },
\ "app/assets/javascripts/collections/*.js.coffee": {
\ "command": "jcollection",
\ "alternate": "spec/javascripts/collections/%s_spec.js.coffee",
\ "template": "class @AppName.Collections.%S extends Backbone.Collection"
\ },
\ "app/assets/javascripts/layouts/*.js.coffee": {
\ "command": "jlayout",
\ "alternate": "spec/javascripts/layouts/%s_spec.js.coffee",
\ "related": "app/assets/templates/%s.jst.hamlc",
\ "template": "class @AppName.Layouts.%S extends Backbone.Marionette.Layout"
\ },
\ "app/assets/javascripts/views/*.js.coffee": {
\ "command": "jview",
\ "alternate": "spec/javascripts/views/%s_spec.js.coffee",
\ "related": "app/assets/templates/%s.jst.hamlc",
\ "template": "class @AppName.Views.%S extends Backbone.Marionette.ItemView"
\ },
\ "app/assets/javascripts/controllers/*.js.coffee": {
\ "command": "jcontroller",
\ "alternate": "spec/javascripts/controllers/%s_spec.js.coffee",
\ "template": "class @AppName.Controllers.%S"
\ },
\ "app/assets/javascripts/routers/*.js.coffee": {
\ "command": "jrouter",
\ "alternate": "spec/javascripts/routers/%s_spec.js.coffee",
\ "template": "class @AppName.Routers.%S"
\ },
\ "spec/javascripts/*_spec.js.coffee": {
\ "command": "jspec",
\ "alternate": "app/assets/javascripts/%s.js.coffee"
\ },
\ "app/assets/javascripts/templates/*.jst.hamlc": {
\ "command": "template",
\ "alternate": "app/assets/javascripts/views/%s.js.coffee"
\ },
\ "app/decorators/*_decorator.rb": {
\ "command": "decorator",
\ "test": [
\ "spec/decorators/%s_decorator_spec.rb"
\ ]
\ },
\ "app/filters/*_filter.rb": {
\ "command": "filter",
\ "test": [
\ "spec/filters/%s_filter_spec.rb"
\ ]
\ },
\ "app/forms/*_form.rb": {
\ "command": "form",
\ "test": [
\ "spec/forms/%s_form_spec.rb"
\ ]
\ },
\ "app/jobs/*_job.rb": {
\ "command": "job",
\ "test": [
\ "spec/jobs/%s_job_spec.rb"
\ ]
\ },
\ "app/observers/*_observer.rb": {
\ "command": "observer",
\ "test": [
\ "spec/observers/%s_observer_spec.rb"
\ ]
\ },
\ "app/services/*_service.rb": {
\ "command": "service",
\ "spec": [
\ "spec/services/%s_service_spec.rb"
\ ]
\ },
\ "app/policies/*_policy.rb": {
\ "command": "policy",
\ "test": [
\ "spec/policies/%s_policy_spec.rb"
\ ]
\ },
\ "app/serializers/*_serializer.rb": {
\ "command": "serializer",
\ "related": "app/models/%s.rb",
\ "spec": [
\ "spec/serializers/%s_serializer_spec.rb"
\ ]
\ },
\ "app/validators/*_validator.rb": {
\ "command": "validator",
\ "spec": [
\ "spec/validators/%s_validator_spec.rb"
\ ]
\ },
\ "app/uploaders/*_uploader.rb": {
\ "command": "uploader",
\ "test": [
\ "spec/uploaders/%s_uploader_spec.rb"
\ ]
\ },
\ "app/workers/*_worker.rb": {
\ "command": "worker",
\ "test": [
\ "spec/workers/%_worker_spec.rb"
\ ]
\ }
\}
" }}}
" Other " {{{
" github
let g:github_user = 'takuyan'
"let g:github_token = ''
" <leader>
let mapleader=","
" vim-toggle
imap <C-C> <Plug>ToggleI
nmap <C-C> <Plug>ToggleN
vmap <C-C> <Plug>ToggleV
"nnoremap <Leader>sn :NumbersToggle<CR>
" rhysd/unite-ruby-require.vim
" Usage
" :Unite ruby/require
" This is for rbenv user
let g:unite_source_ruby_require_ruby_command = '$HOME/.rbenv/shims/ruby'
" 日付挿入
"imap <silent> <C-D><C-D> <C-R>=strftime("%Y-%m-%d")<CR>
imap <s-tab> <c-d>
" https://github.com/plasticboy/vim-markdown
let g:vim_markdown_folding_disabled = 1
let g:vim_markdown_new_list_item_indent = 2
let g:vim_markdown_conceal = 0
" Use deoplete.
let g:deoplete#enable_at_startup = 1
" " }}}