-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvimrc
319 lines (265 loc) · 8.83 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
" -----------------------------------------------
" Neobundle
" -----------------------------------------------
if !1 | finish | endif
if has('vim_starting')
if &compatible
set nocompatible
endif
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
call neobundle#begin(expand('~/.vim/bundle/'))
NeoBundleFetch 'Shougo/neobundle.vim'
NeoBundle 'Shougo/vimproc', {
\ 'build' : {
\ 'windows' : 'make -f make_mingw32.mak',
\ 'cygwin' : 'make -f make_cygwin.mak',
\ 'mac' : 'make -f make_mac.mak',
\ 'unix' : 'make -f make_unix.mak',
\ },
\ }
NeoBundle 'thinca/vim-quickrun'
NeoBundle 'Shougo/unite.vim'
NeoBundle 'Shougo/neomru.vim'
NeoBundle 'Shougo/vimfiler'
"NeoBundle 'Shougo/neosnippet'
NeoBundle 'Shougo/neocomplcache'
NeoBundle 'h1mesuke/unite-outline'
NeoBundle 'tsukkee/unite-tag'
NeoBundle 'The-NERD-tree'
NeoBundle 'The-NERD-Commenter'
NeoBundle 'bkad/CamelCaseMotion'
NeoBundle 'Align'
NeoBundle 'taichouchou2/vim-endwise.git'
NeoBundle 'vim-scripts/ruby-matchit'
NeoBundle 'tpope/vim-surround'
" Git
NeoBundle 'tpope/vim-fugitive'
" Ruby/Rails
NeoBundle 'vim-ruby/vim-ruby'
NeoBundle 'basyura/unite-rails'
NeoBundle 'tpope/vim-rails'
NeoBundle 'tpope/vim-bundler'
NeoBundle 'kchmck/vim-coffee-script'
NeoBundle 'slim-template/vim-slim.git'
NeoBundle 'pangloss/vim-javascript'
NeoBundle 'mxw/vim-jsx'
" NeoBundle 'scrooloose/syntastic'
NeoBundle 'w0rp/ale'
NeoBundle 'markcornick/vim-terraform'
" Statusline
NeoBundle 'itchyny/lightline.vim'
" ColorSchemes
NeoBundle 'ujihisa/unite-colorscheme'
NeoBundle 'w0ng/vim-hybrid'
NeoBundle 'shelling/railscasts.vim'
NeoBundle 'nathanaelkane/vim-indent-guides'
NeoBundle 'itchyny/calendar.vim'
NeoBundle 'posva/vim-vue'
NeoBundle 'digitaltoad/vim-pug'
call neobundle#end()
filetype plugin indent on
syntax on
" Edit vimrc
nmap <Space>e :edit $MYVIMRC<CR>
nmap <Space>s :source $MYVIMRC<CR>
" 表示
set title " タイトルを表示
set number " 行番号を表示
set ruler " ルーラーを表示
set noswapfile " swapをつくらない
set hidden " 編集中でも他のファイルを開けるようにする
set backspace=indent,eol,start " backspaceで消せるようにする
set vb t_vb= " ビープ音を鳴らさない
set clipboard=unnamed " OSのクリップボードを使用する
" 不可視文字表示
set list
set listchars=tab:>\ ,trail:-,extends:>,precedes:<
highlight link ZenkakuSpace Error
match ZenkakuSpace / /
" タブ
set expandtab
set smarttab
set tabstop=2
set shiftwidth=2
set softtabstop=0
" 折り畳み
set foldmethod=marker
nmap <silent> ,fc :<C-U>%foldclose<CR>
nmap <silent> ,fo :<C-U>%foldopen<CR>
" StatusLine
set noshowmode
set noshowcmd
set laststatus=2
" 検索設定
set incsearch
set ignorecase
set smartcase
set wrapscan
" Color
set t_Co=256
colorscheme hybrid
" 移動を直感的に
set whichwrap=b,s,h,l,<,>,[,]
nnoremap <silent> j gj
nnoremap <silent> gj j
nnoremap <silent> k gk
nnoremap <silent> gk k
nnoremap <silent> $ g$
nnoremap <silent> g$ $
vnoremap <silent> j gj
vnoremap <silent> gj j
vnoremap <silent> k gk
vnoremap <silent> gk k
vnoremap <silent> $ g$
vnoremap <silent> g$ $
" Unite
let g:unite_enable_start_insert=1
let g:unite_source_history_yank_enable =1
let g:unite_source_file_mru_limit = 200
nnoremap [unite] <Nop>
nmap <Space>u [unite]
nnoremap [unite]u :<C-u>UniteWithCurrentDir -buffer-name=files buffer file_mru bookmark file<CR>
nnoremap [unite]b :<C-u>Unite buffer<CR>
nnoremap [unite]y :<C-u>Unite history/yank<CR>
nnoremap [unite]f :<C-u>UniteWithBufferDir -buffer-name=files file<CR>
nnoremap [unite]r :<C-u>Unite -buffer-name=register register<CR>
" nnoremap [unite]u :<C-u>Unite file_mru buffer<CR>
" ESCキーを2回押すとUniteを終了する
au FileType unite nnoremap <silent> <buffer> <ESC><ESC> :q<CR>
au FileType unite inoremap <silent> <buffer> <ESC><ESC> <ESC>:q<CR>
" Unite-rails
nnoremap [unite-rails] <Nop>
nmap <Space>r [unite-rails]
nnoremap [unite-rails]m :<C-u>Unite rails/model<CR>
nnoremap [unite-rails]v :<C-u>Unite rails/view<CR>
nnoremap [unite-rails]c :<C-u>Unite rails/controller<CR>
nnoremap [unite-rails]h :<C-u>Unite rails/helper<CR>
nnoremap [unite-rails]h :<C-u>Unite rails/helper<CR>
nnoremap [unite-rails]l :<C-u>Unite rails/lib<CR>
nnoremap [unite-rails]f :<C-u>Unite rails/config<CR>
nnoremap [unite-rails]s :<C-u>Unite rails/spec<CR>
nnoremap [unite-rails]d :<C-u>Unite rails/db<CR>
nnoremap [unite-rails]a :<C-u>Unite rails/asset<CR>
nnoremap [unite-rails]b :<C-u>Unite rails/bundled_gem<CR>
" NERD Tree
let g:NERDTreeIgnore=['\.git$', '\.swp$', '\~$', '\.keep$', '\.bundle$']
let g:NERDTreeShowHidden=1
let g:NERDTreeMinimalUI=1
let g:NERDTreeDirArrows=0
nmap <silent> <C-e> :NERDTreeToggle<CR>
vmap <silent> <C-e> <Esc>:NERDTreeToggle<CR>
omap <silent> <C-e> :NERDTreeToggle<CR>
imap <silent> <C-e> <Esc>:NERDTreeToggle<CR>
cmap <silent> <C-e> <C-u>:NERDTreeToggle<CR>
" ファイル指定なしで起動するとNERDTreeを開いた状態から始める
" autocmd vimenter * if !argc() | NERDTree | endif
" NERD Commenter
let NERDSpaceDelims = 1
nmap ,, <Plug>NERDCommenterToggle
vmap ,, <Plug>NERDCommenterToggle
" Syntastic
" set statusline+=%#warningmsg#
" set statusline+=%{SyntasticStatuslineFlag()}
" set statusline+=%*
" let g:syntastic_always_populate_loc_list = 1
" let g:syntastic_auto_loc_list = 1
" let g:syntastic_check_on_open = 1
" let g:syntastic_check_on_wq = 0
" let g:syntastic_ruby_checkers = ['rubocop']
" Ale
let g:ale_sign_column_always = 1
let g:ale_linters = {
\ 'ruby': ['rubocop'],
\ 'javascript': ['eslint']
\ }
let g:ale_fixers = {
\ 'ruby': ['rubocop'],
\ 'javascript': ['eslint']
\ }
" LightLine
let g:lightline = {
\ 'colorscheme': 'jellybeans',
\ 'active': {
\ 'left': [
\ ['mode', 'paste'],
\ ['readonly', 'filename', 'modified', 'ale'],
\ ]
\ },
\ 'component_function': {
\ 'ale': 'ALEGetStatusLine'
\ }
\ }
" CamelCaseMotion
map <silent> w <Plug>CamelCaseMotion_w
map <silent> b <Plug>CamelCaseMotion_b
map <silent> e <Plug>CamelCaseMotion_e
sunmap w
sunmap b
sunmap e
" Align
let g:Align_xstrlen=3
" Fugitive
nnoremap [git] <Nop>
nmap <Space>g [git]
nnoremap [git]d :<C-u>Gdiff HEAD<Enter>
nnoremap [git]s :<C-u>Gstatus<Enter>
nnoremap [git]l :<C-u>Glog<Enter>
nnoremap [git]a :<C-u>Gwrite<Enter>
nnoremap [git]c :<C-u>Gcommit<Enter>
nnoremap [git]C :<C-u>Git commit --amend<Enter>
nnoremap [git]b :<C-u>Gblame<Enter>
" Neocomplcache
let g:acp_enableAtStartup = 0
let g:neocomplcache_force_overwrite_completefunc = 1
let g:neocomplcache_enable_at_startup = 1
let g:neocomplcache_enable_smart_case = 1
let g:neocomplcache_min_syntax_length = 3
let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*'
let g:neocomplcache_enable_camel_case_completion = 1
let g:neocomplcache_enable_underbar_completion = 1
let g:neocomplcache_dictionary_filetype_lists = {
\ 'default' : '',
\ 'ruby' : $HOME . '/.vim/dict/ruby.dict',
\ 'php' : $HOME . '/.vim/dict/php.dict'
\ }
if !exists('g:neocomplcache_keyword_patterns')
let g:neocomplcache_keyword_patterns = {}
endif
let g:neocomplcache_keyword_patterns['default'] = '\h\w*'
inoremap <expr><C-g> neocomplcache#undo_completion()
inoremap <expr><C-l> neocomplcache#complete_common_string()
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
function! s:my_cr_function()
return neocomplcache#smart_close_popup() . "\<CR>"
endfunction
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
inoremap <expr><C-h> neocomplcache#smart_close_popup()."\<C-h>"
inoremap <expr><BS> neocomplcache#smart_close_popup()."\<C-h>"
inoremap <expr><C-y> neocomplcache#close_popup()
inoremap <expr><C-e> neocomplcache#cancel_popup()
inoremap <expr><Space> pumvisible() ? neocomplcache#close_popup() : "\<Space>"
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=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
autocmd FileType ruby setlocal omnifunc=rubycomplete#CompleteTags
" Indent Guides
let g:indent_guides_auto_colors = 0
let g:indent_guides_start_level = 2
let g:indent_guides_guide_size = 1
let g:indent_guides_enable_on_vim_startup = 1
hi IndentGuidesOdd ctermbg=black
hi IndentGuidesEven ctermbg=black
" Local settings
augroup vimrc-local
autocmd!
autocmd BufNewFile,BufReadPost * call s:vimrc_local(expand('<afile>:p:h'))
augroup END
function! s:vimrc_local(loc)
let files = findfile('.vimrc.local', escape(a:loc, ' ') . ';', -1)
for i in reverse(filter(files, 'filereadable(v:val)'))
source `=i`
endfor
endfunction