-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.vimrc
More file actions
220 lines (178 loc) · 5.73 KB
/
.vimrc
File metadata and controls
220 lines (178 loc) · 5.73 KB
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
" ------------------------------------
" dein setting
" ------------------------------------
if &compatible
set nocompatible
endif
let s:dein_dir = expand('~/.cache/dein')
let s:dein_repo_dir = s:dein_dir . '/repos/github.com/Shougo/dein.vim'
if !isdirectory(s:dein_repo_dir)
execute '!git clone https://github.com/Shougo/dein.vim' s:dein_repo_dir
endif
execute 'set runtimepath^=' . s:dein_repo_dir
if dein#load_state(s:dein_dir)
call dein#begin(s:dein_dir)
let s:toml = '~/.dein.toml'
let s:lazy_toml = '~/.dein_lazy.toml'
call dein#load_toml(s:toml, {'lazy': 0})
call dein#load_toml(s:lazy_toml, {'lazy': 1})
call dein#end()
call dein#save_state()
endif
if dein#check_install()
call dein#install()
endif
" ------------------------------------
" general setting
" ------------------------------------
" フォント設定
set guifont=Ricty-BoldForPowerline
" カーソル行をハイライト
set cursorline
" タブの挿入設定
set smarttab
set expandtab
set tabstop=2
set shiftwidth=2
augroup fileTypeIndent
autocmd!
autocmd BufNewFile,BufRead *.py setlocal tabstop=4 softtabstop=4 shiftwidth=4
autocmd BufNewFile,BufRead *.rb setlocal tabstop=2 softtabstop=2 shiftwidth=2
autocmd BufNewFile,BufRead *.rake setlocal tabstop=2 softtabstop=2 shiftwidth=2
augroup END
" 保存時に行末の空白を自動で削除
autocmd BufWritePre * :%s/\s\+$//ge
" バックスペースキーで削除できるものを指定
" indent : 行頭の空白
" eol : 改行
" start : 挿入モード開始位置より手前の文字
set backspace=indent,eol,start
" 行番号を表示する
set number
" 検索で大文字小文字を区別しない
set ignorecase
"全角スペースをハイライト表示する
function! ZenkakuSpace()
highlight ZenkakuSpace cterm=reverse ctermfg=DarkMagenta gui=reverse guifg=DarkMagenta
endfunction
if has('syntax')
augroup ZenkakuSpace
autocmd!
autocmd ColorScheme * call ZenkakuSpace()
autocmd VimEnter,WinEnter * match ZenkakuSpace / /
augroup END
call ZenkakuSpace()
endif
" 最後のカーソル位置を復元する
if has("autocmd")
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal! g'\"" |
\ endif
endif
"タブ、空白、改行の可視化する
set listchars=tab:>.,trail:_,extends:>,precedes:<,nbsp:%
" 勝手にコメントアウトしない
augroup auto_comment_off
autocmd!
autocmd BufEnter * setlocal formatoptions-=r
autocmd BufEnter * setlocal formatoptions-=o
augroup END
" Swapファイル と Backupファイルを無効化する
set nowritebackup
set nobackup
set noswapfile
" 検索マッチテキストをハイライト
set hlsearch
" 不可視文字を可視化する
set list
" 自動的に改行が入るのを無効化
set textwidth=0
" 対応括弧に'<'と'>'のペアを追加する
set matchpairs& matchpairs+=<:>
" ------------------------------------
" syntastic setting
" ------------------------------------
let g:syntastic_always_populate_loc_list = 0
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_python_checkers = ['pyflakes', 'pep8']
let g:syntastic_mode_map = { 'mode': 'active', 'active_filetypes': [
\ 'ruby', 'javascript','coffee', 'scss', 'html', 'haml', 'slim', 'sh',
\ 'spec', 'vim', 'zsh', 'sass', 'eruby'] }
let g:syntastic_ruby_checkers = ['rubocop']
let g:syntastic_javascript_checkers=['eslint']
let g:syntastic_coffee_checkers = ['coffeelint']
let g:syntastic_scss_checkers = ['scss_lint']
let g:syntastic_error_symbol='x'
let g:syntastic_style_error_symbol = 'x'
let g:syntastic_warning_symbol = 'w'
let g:syntastic_style_warning_symbol = 'w'
let g:syntastic_ruby_rubocop_exe = 'bundle exec rubocop'
" ------------------------------------
" file encode setting
" ------------------------------------
" 文字コード
set encoding=utf-8
set termencoding=utf-8
set fileencoding=utf-8
set fileencodings=utf-8,euc-jp,sjis,cp932,iso-2022-jp
" ------------------------------------
" key setting
" ------------------------------------
" <Space>i でコードをインデント整形
map <Space>i gg=<S-g><C-o><C-o>zz
" visual モードで連続して、インデント出来るように設定
vnoremap <silent> > >gv
vnoremap <silent> < <gv
" TABキーで対応ペアにジャンプ
nnoremap <Tab> %
vnoremap <Tab> %
" C-a, C-e で行頭と行末に移動する
inoremap <C-e> <Esc>$
inoremap <C-a> <Esc>^
noremap <C-e> <Esc>$
noremap <C-a> <Esc>^
" ------------------------------------
" status line
" ------------------------------------
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
set laststatus=2
set t_Co=256
let g:lightline = {
\ 'colorscheme': 'wombat',
\ }
" ------------------------------------
" python setting
" ------------------------------------
filetype plugin on
autocmd FileType python setl autoindent
autocmd FileType python setl smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
" ------------------------------------
" pluging setting
" ------------------------------------
" caw.vim.git C-k でまとめてコメントアウト
nmap <C-K> <Plug>(caw:i:toggle)
vmap <C-K> <Plug>(caw:i:toggle)
" ------------------------------------
" color setting
" ------------------------------------
syntax enable
set background=dark
colorscheme gruvbox
" ビープ音をすべて視覚表示する
set visualbell
let g:gitgutter_max_signs = 500
" use <tab> for trigger completion and navigate to the next complete item
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
nnoremap ww <C-w>w
nnoremap wj <C-w>j
nnoremap wk <C-w>k
nnoremap wl <C-w>l
nnoremap wh <C-w>h