-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
392 lines (340 loc) · 12.2 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
set nocompatible
function! s:LetAndMkdir(variable, path) "{{{
try
if !isdirectory(a:path)
call mkdir(a:path, 'p')
endif
catch
echohl WarningMsg
echom '[error]' . a:path . 'is exist and is not directory, but is file or something.'
echohl None
endtry
execute printf("let %s = a:path", a:variable)
endfunction "}}}
let $DOTVIM=expand('~/.vim')
"##### Path #####
call s:LetAndMkdir('&backupdir',$DOTVIM.'/backup')
set swapfile
call s:LetAndMkdir('&directory',$DOTVIM.'/swap')
call s:LetAndMkdir('&undodir' ,$DOTVIM.'/undo')
set viminfo+=n$DOTVIM/.viminfo
set autoindent
set backspace=indent,eol,start
set wrapscan
set showmatch
set formatoptions+=mM
set nonumber
set ruler
set wrap
set laststatus=2
set cmdheight=2
set showcmd
set title
set tabstop=4 "Tabの幅を設定
set shiftwidth=4 "自動インデント
set expandtab "タブではなくスペースでインデント
set encoding=utf-8 "UTF8
set textwidth=0 "自動折り返しをしない
set list "空白文字を表示
set listchars=eol:',tab:>\
set wildmenu wildmode=longest,list,full "補完をShell互換に
set history=2000
set showbreak=+++
set incsearch "インクリメントサーチ
set ignorecase "大小文字
set smartcase "検索を賢く
set display=lastline "入りきらなくても@にしない
set hlsearch
au BufNewFile,BufRead *.nas setf nasm
colorscheme desert
"##### キー無効化 #####
"保存全終了
nnoremap ZZ <Nop>
"未保存全終了
nnoremap ZQ <Nop>
let mapleader=" "
inoremap <C-CR> <br><CR>
" dein settings {{{
" dein自体の自動インストール
let s:cache_home = $DOTVIM "empty($XDG_CACHE_HOME) ? $TEMP : $XDG_CACHE_HOME
let s:dein_dir = s:cache_home . '/dein'
let s:dein_repo_dir = s:dein_dir . '/repos/github.com/Shougo/dein.vim'
if !isdirectory(s:dein_repo_dir)
call system('git clone https://github.com/Shougo/dein.vim ' . shellescape(s:dein_repo_dir))
endif
let &runtimepath = s:dein_repo_dir .",". &runtimepath
" プラグイン読み込み&キャッシュ作成
let s:toml_file = $DOTVIM."/dein.toml"
if dein#load_state(s:dein_dir)
call dein#begin(s:dein_dir, [$MYVIMRC, s:toml_file])
call dein#load_toml(s:toml_file)
call dein#end()
call dein#save_state()
endif
" 不足プラグインの自動インストール
if has('vim_starting') && dein#check_install()
call dein#install()
endif
"}}}
""##### neobundle ##### {{z{
""##################################################
"if has('vim_starting')
"set nocompatible " Be iMproved
"
"" Required:
"set runtimepath+=$HOME/.vim/bundle/neobundle.vim/
"endif
"
"" Required:
"call neobundle#begin(expand('~/.vim/bundle/'))
"
"" Let NeoBundle manage NeoBundle
"" Required:
"NeoBundleFetch 'Shougo/neobundle.vim'
"
"" My Bundles here:
""
"NeoBundle 'Shougo/neocomplete.vim'
"NeoBundle 'Shougo/neosnippet.vim'
"NeoBundle 'Shougo/neosnippet-snippets'
"NeoBundle 'tpope/vim-fugitive'
"NeoBundle 'kien/ctrlp.vim'
"NeoBundle 'flazz/vim-colorschemes'
"NeoBundle 'itchyny/lightline.vim' "ステータスバーをかっこよく
"NeoBundle 'Shougo/unite.vim'
"NeoBundle 'Shougo/vimshell.vim'
"NeoBundle 'easymotion/vim-easymotion'
"NeoBundle 'Shougo/neomru.vim'
"NeoBundle 'altercation/vim-colors-solarized'
"NeoBundle 'Shougo/vinarise'
"NeoBundle 'mattn/emmet-vim'
"NeoBundle 'fuenor/im_control.vim'
"NeoBundle 'tpope/vim-surround'
"NeoBundle 'LeafCage/yankround.vim'
"NeoBundle 'Shougo/neoyank.vim'
"
"" You can specify revision/branch/tag.
"NeoBundle 'Shougo/vimshell', { 'rev' : '3787e5' }
"
"call neobundle#end()
"
"" Required:
"filetype plugin indent on
"
"" If there are uninstalled bundles found on startup,
"" this will conveniently prompt you to install them.
"NeoBundleCheck
""}}}
" 'justmao945/vim-clang' {{{
" disable auto completion for vim-clanG
let g:clang_auto = 0
let g:clang_complete_auto = 0
let g:clang_auto_select = 0
let g:clang_use_library = 1
" default 'longest' can not work with neocomplete
let g:clang_c_completeopt = 'menuone'
let g:clang_cpp_completeopt = 'menuone'
if executable('clang-3.6')
let g:clang_exec = 'clang-3.6'
elseif executable('clang-3.5')
let g:clang_exec = 'clang-3.5'
elseif executable('clang-3.4')
let g:clang_exec = 'clang-3.4'
else
let g:clang_exec = 'clang'
endif
if executable('clang-format-3.6')
let g:clang_format_exec = 'clang-format-3.6'
elseif executable('clang-format-3.5')
let g:clang_format_exec = 'clang-format-3.5'
elseif executable('clang-format-3.4')
let g:clang_format_exec = 'clang-format-3.4'
else
let g:clang_exec = 'clang-format'
endif
let g:clang_c_options = '-std=c11'
let g:clang_cpp_options = '-std=c++11 -stdlib=libc++'
" }}}
"
"##### lightline #####{{{
"################################################
let g:lightline = {
\ 'colorscheme': 'solarized',
\ 'component': {
\ 'readonly': '%{&readonly?"[RO]":""}',
\ 'jpmode' : '%{IMStatus("[日]")}',
\ },
\ 'active' : {
\ 'left' : [['mode','paste','jpmode'],['readonly','filename','modified']]
\},
\ 'inactive' : { 'left' : [['readonly','filename','modified']] },
\ 'subseparator' : {'left' : '>' , 'right' : '<'}
\}
" End of lightline}}}
"##### 全角スペース ##### {{{
"##################################################
"https://sites.google.com/site/fudist/Home/vim-nihongo-ban/vim-color#color-zenkaku
"デフォルトのZenkakuSpaceを定義
function! ZenkakuSpace()
highlight ZenkakuSpace cterm=underline ctermfg=darkgrey gui=underline guibg=#663333
endfunction
if has('syntax')
augroup ZenkakuSpace
autocmd!
" ZenkakuSpaceをカラーファイルで設定するなら次の行は削除
autocmd ColorScheme * call ZenkakuSpace()
" 全角スペースのハイライト指定
autocmd VimEnter,WinEnter * match ZenkakuSpace / /
autocmd VimEnter,WinEnter * match ZenkakuSpace '\%u3000'
augroup END
call ZenkakuSpace()
endif
" End of 全角スペース }}}
"##### neocomplete ##### {{{
if(has("lua"))
"Note: This option must set it in .vimrc(_vimrc). NOT IN .gvimrc(_gvimrc)!
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
" Use neocomplete.
let g:neocomplete#enable_at_startup = 1
" Use smartcase.
let g:neocomplete#enable_smart_case = 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*'
" Plugin key-mappings.
inoremap <expr><C-g> neocomplete#undo_completion()
inoremap <expr><C-l> neocomplete#complete_common_string()
" Recommended key-mappings.
" <CR>: close popup and save indent.
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
function! s:my_cr_function()
return neocomplete#close_popup() . "\<CR>"
" For no inserting <CR> key.
"return pumvisible() ? neocomplete#close_popup() : "\<CR>"
endfunction
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" <C-h>, <BS>: close popup and delete backword char.
inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
inoremap <expr><C-y> neocomplete#close_popup()
inoremap <expr><C-e> neocomplete#cancel_popup()
" Close popup by <Space>.
"inoremap <expr><Space> pumvisible() ? neocomplete#close_popup() : "\<Space>"
" For cursor moving in insert mode(Not recommended)
"inoremap <expr><Left> neocomplete#close_popup() . "\<Left>"
"inoremap <expr><Right> neocomplete#close_popup() . "\<Right>"
"inoremap <expr><Up> neocomplete#close_popup() . "\<Up>"
"inoremap <expr><Down> neocomplete#close_popup() . "\<Down>"
" Or set this.
"let g:neocomplete#enable_cursor_hold_i = 1
" Or set this.
"let g:neocomplete#enable_insert_char_pre = 1
" AutoComplPop like behavior.
"let g:neocomplete#enable_auto_select = 1
" Shell like behavior(not recommended).
"set completeopt+=longest
"let g:neocomplete#enable_auto_select = 1
"let g:neocomplete#disable_auto_complete = 1
"inoremap <expr><TAB> pumvisible() ? "\<Down>" : "\<C-x>\<C-u>"
" 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=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
" Enable heavy omni completion.
if !exists('g:neocomplete#sources#omni#input_patterns')
let g:neocomplete#sources#omni#input_patterns = {}
endif
"let g:neocomplete#sources#omni#input_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
"let g:neocomplete#sources#omni#input_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)'
"let g:neocomplete#sources#omni#input_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
" For perlomni.vim setting.
" https://github.com/c9s/perlomni.vim
let g:neocomplete#sources#omni#input_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
end
"##### End Of neocomplete }}}
"##### unite.vim ##### {{{
let g:unite_enable_start_insert=1
let g:unite_source_history_yank_enable =1
let g:unite_source_file_mru_limit = 200
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> ,uu :<C-u>Unite file_mru buffer<CR>
nnoremap <silent> ,uh :<C-u>Unite file_mru<CR>
"End Of unite.vim }}}
"##### vim-easymotion ##### {{{
map <Leader> <Plug>(easymotion-prefix)
let g:EasyMotion_do_mapping = 0
let g:EasyMotion_leader_key = '<Space><Space>'
" <Leader>f{char} to move to {char}
map <Leader>f <Plug>(easymotion-bd-f)
nmap <Leader>f <Plug>(easymotion-overwin-f)
" s{char}{char} to move to {char}{char}
nmap S <Plug>(easymotion-overwin-f2)
nmap s <Plug>(easymotion-overwin-f)
" Move to line
map <Leader>L <Plug>(easymotion-bd-jk)
nmap <Leader>L <Plug>(easymotion-overwin-line)
" Move to word
map <Leader>w <Plug>(easymotion-bd-w)
nmap <Leader>w <Plug>(easymotion-overwin-w)"End of vim-easymotion}}}
let g:EasyMotion_use_migemo = 1
"}}}
"##### im_control.vim #####{{{
" 「日本語入力固定モード」切替キー
inoremap <silent> <C-j> <C-r>=IMState('FixMode')<CR>
" PythonによるIBus制御指定
let IM_CtrlIBusPython = 1
"}}}}
" ------------------- clang_complete -------------
" neocomplcacheとの競合を避けるため、自動呼び出しはOff
let g:clang_complete_auto=1
let g:clang_auto_select=0
"libclangを使う
let g:clang_use_library=1
let g:clang_debug=1
let g:clang_library_file="/usr/lib/libclang.so"
let g:clang_user_options = '-std=c++11'
" コマンドオプション
let g:clang_user_options = '-std=c++11'
" neocomplete.vim と併用して使用する場合は以下の設定も行う
if !exists('g:neocomplete#force_omni_input_patterns')
let g:neocomplete#force_omni_input_patterns = {}
endif
let g:neocomplete#force_overwrite_completefunc = 1
let g:neocomplete#force_omni_input_patterns.c =
\ '[^.[:digit:] *\t]\%(\.\|->\)\w*'
let g:neocomplete#force_omni_input_patterns.cpp =
\ '[^.[:digit:] *\t]\%(\.\|->\)\w*\|\h\w*::\w*'
let g:neocomplete#force_omni_input_patterns.objc =
\ '[^.[:digit:] *\t]\%(\.\|->\)\w*'
let g:neocomplete#force_omni_input_patterns.objcpp =
\ '[^.[:digit:] *\t]\%(\.\|->\)\w*\|\h\w*::\w*'
" clang_complete では自動補完を行わない用に設定
let g:clang_complete_auto = 0
let g:clang_auto_select = 0
" --------
let g:syntastic_enable_sign=1
let g:syntastic_auto_loc_list=2
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-forward)
map m/ <Plug>(incsearch-migemo-/)
map m? <Plug>(incsearch-migemo-?)
filetype plugin indent on
" vim: foldmethod=marker