-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
282 lines (231 loc) · 7.3 KB
/
vimrc
File metadata and controls
282 lines (231 loc) · 7.3 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
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
scriptencoding utf-8
"-------------------------------------------
" neobundle.vim
"-------------------------------------------
if has('vim_starting')
set runtimepath+=~/.vim/bundle/neobundle.vim
endif
call neobundle#begin(expand('~/.vim/bundle'))
NeoBundleFetch 'Shougo/neobundle.vim'
NeoBundle 'Shougo/unite.vim'
NeoBundle 'Shougo/tabpagebuffer.vim'
NeoBundle 'Shougo/unite-outline'
NeoBundle 'Shougo/junkfile.vim'
NeoBundle 'thinca/vim-singleton'
NeoBundle 'thinca/vim-localrc'
NeoBundle 'tpope/vim-surround'
NeoBundle 'tpope/vim-repeat'
NeoBundle 'kana/vim-tabpagecd'
NeoBundle 'kana/vim-submode'
NeoBundle 'kana/vim-textobj-user'
NeoBundle 'kana/vim-textobj-lastpat'
NeoBundle 'scrooloose/nerdcommenter'
NeoBundle 'tyru/eskk.vim'
NeoBundle 'junegunn/vim-easy-align'
NeoBundle 'osyo-manga/vim-anzu'
" Color Scheme
NeoBundle 'tomasr/molokai'
NeoBundle 'aereal/vim-colors-japanesque'
NeoBundle 'Shougo/vimproc', {
\ 'build' : {
\ 'windows' : 'tools\\update-dll-mingw',
\ 'mac' : 'make',
\ 'unix' : 'make',
\ },
\ }
call neobundle#end()
filetype plugin indent on
NeoBundleCheck
"-------------------------------------------
" macros
"-------------------------------------------
if has('vim_starting')
runtime macros/matchit.vim
if !has('kaoriya')
runtime macros/encode.vim
endif
endif
"-------------------------------------------
" singleton
"-------------------------------------------
if has('clientserver')
call singleton#enable()
endif
"-------------------------------------------
" autocmd
"-------------------------------------------
augroup MyAutoCmd
autocmd!
augroup END
function! s:set_indent(n)
let &l:shiftwidth = a:n
let &l:softtabstop = a:n
setlocal expandtab
endfunction
augroup MyTab
autocmd!
autocmd FileType ruby call s:set_indent(2)
autocmd FileType vim call s:set_indent(2)
autocmd FileType html call s:set_indent(2)
autocmd FileType haml call s:set_indent(2)
autocmd FileType css call s:set_indent(2)
autocmd FileType scss call s:set_indent(2)
autocmd FileType eruby call s:set_indent(2)
autocmd FileType javascript call s:set_indent(2)
autocmd FileType php call s:set_indent(4)
autocmd FileType haskell call s:set_indent(2)
autocmd FileType yaml call s:set_indent(2)
autocmd FileType json call s:set_indent(2)
autocmd FileType go setlocal noexpandtab tabstop=4 shiftwidth=4
autocmd FileType go autocmd BufWritePre <buffer> Fmt
augroup END
" Move cursor to last edit position.
autocmd MyAutoCmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"-------------------------------------------
" Basic
"-------------------------------------------
syntax enable
set nobackup
set swapfile
" Remove indent, eol and start by <BS>.
set backspace=indent,eol,start
set title
set ruler
set wrap
set breakindent
set showmatch
set matchtime=2
set wildmenu
set wildignorecase
set wildmode=longest:full,full
set whichwrap=b,s,h,l,<,>,[,]
set autoread
set cmdheight=2
set laststatus=2
set statusline=%<%f\ %r%h%w%m[%{&fenc!=''?&fenc:&enc}][%{&ff=='unix'?'LF':&ff=='dos'?'CRLF':'CR'}]\ %y\ %=[0x%B]\ %c,%l/%L
set list
set listchars=tab:>-,eol:$
set display=lastline
set ambiwidth=double
set splitright
set textwidth=0
set colorcolumn=81
" default tab & indent settings
set softtabstop=4
set shiftwidth=4
set expandtab
" Line feed code
set fileformat=unix
set fileformats=unix,dos,mac
if !exists('g:colors_name') && !has('gui_running')
" Use 256 colors in terminal.
set t_Co=256
colorscheme molokai
endif
set helplang=en,ja
set formatoptions+=mM
if has('persistent_undo')
let $UNDODIR = expand('~/.vim/undo')
if !isdirectory($UNDODIR)
call mkdir($UNDODIR)
endif
set undofile
set undodir=$UNDODIR
endif
let $TMPDIR = expand('~/.vim/tmp')
if !isdirectory($TMPDIR)
call mkdir($TMPDIR)
endif
set directory=$TMPDIR
" Use English interface.
language message C
"-------------------------------------------
" Searching
"-------------------------------------------
set wrapscan
set ignorecase
set smartcase
set incsearch
set hlsearch
"-------------------------------------------
" commands
"-------------------------------------------
" Reload with specified encoding.
command! -bang -bar -complete=file -nargs=? Cp932 edit ++enc=cp932 <args>
command! -bang -bar -complete=file -nargs=? EucJp edit ++enc=euc-jp <args>
command! -bang -bar -complete=file -nargs=? Iso2022jp edit ++enc=iso-2022-jp <args>
command! -bang -bar -complete=file -nargs=? Utf8 edit ++enc=utf-8 <args>
" Aliases
command! -bang -bar -complete=file -nargs=? Jis Iso2022jp <args>
command! -bang -bar -complete=file -nargs=? Sjis Cp932 <args>
"-------------------------------------------
" key mappings
"-------------------------------------------
" Move cursor by display lines.
noremap j gj
noremap k gk
noremap <Down> gj
noremap <Up> gk
" For US Keybord.
noremap ; :
noremap : ;
" :help under cursor keyword.
nnoremap <C-h><C-h> :<C-u>help<Space><C-r><C-w><CR>
" Select last modified text.
nnoremap gc '[v']
vnoremap gc :<C-u>normal gc<CR>
onoremap gc :<C-u>normal gc<CR>
nnoremap <silent> <Esc><Esc> :<C-u>nohlsearch<CR>
cnoremap <expr> %% getcmdtype() == ':' ? expand('%:h') . '/' : '%%'
nnoremap <C-]> g<C-]>
"-------------------------------------------
" NERDCommenter
"-------------------------------------------
" Off default key-mappings.
let g:NERDCreateDefaultMappings = 0
let NERDSpaceDelims = 1
let g:NERDCustomDelimiters = {
\ 'haskell': {'left': '--', 'leftAlt': '{-', 'rightAlt': '-}'}
\ }
" Define my key-mappings.
nmap <Leader>cc <Plug>NERDCommenterToggle
vmap <Leader>cc <Plug>NERDCommenterToggle
"-------------------------------------------
" unite
"-------------------------------------------
nnoremap <silent> ,b :<C-u>Unite -buffer-name=files buffer_tab<CR>
nnoremap <silent> ,a :<C-u>Unite file_rec/git:--cached:--others:--exclude-standard<CR>
nnoremap <silent> ,o :<C-u>Unite outline<CR>
"-------------------------------------------
" eskk
"-------------------------------------------
" Please put configuraion file to ~/.local.vimrc for each environment.
"-------------------------------------------
" submode
"-------------------------------------------
" resize window mode
call submode#enter_with('winsize', 'n', '', '<C-w>>', '<C-w>>')
call submode#enter_with('winsize', 'n', '', '<C-w><', '<C-w><')
call submode#enter_with('winsize', 'n', '', '<C-w>-', '<C-w>-')
call submode#enter_with('winsize', 'n', '', '<C-w>+', '<C-w>+')
call submode#map('winsize', 'n', '', '>', '<C-w>>')
call submode#map('winsize', 'n', '', '<', '<C-w><')
call submode#map('winsize', 'n', '', '-', '<C-w>-')
call submode#map('winsize', 'n', '', '+', '<C-w>+')
" switch tab mode
call submode#enter_with('switchtab', 'n', '', 'gt', 'gt')
call submode#enter_with('switchtab', 'n', '', 'gT', 'gT')
call submode#map('switchtab', 'n', '', 't', 'gt')
call submode#map('switchtab', 'n', '', 'T', 'gT')
let g:submode_keep_leaving_key = 1
"-------------------------------------------
" vim-easy-align
"-------------------------------------------
vmap <Enter> <Plug>(EasyAlign)
"-------------------------------------------
" vim-anzu
"-------------------------------------------
nmap n <Plug>(anzu-n-with-echo)
nmap N <Plug>(anzu-N-with-echo)
nmap * <Plug>(anzu-star-with-echo)
nmap # <Plug>(anzu-sharp-with-echo)