-
Notifications
You must be signed in to change notification settings - Fork 2
/
.vimrc
299 lines (257 loc) · 6.94 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
" set char
set encoding=utf-8
scriptencoding utf-8
set fenc=utf-8
set fileencodings=utf-8
set fileformats=unix,dos,mac
" set
set nobackup
set noswapfile
set autoread
set hidden
set showcmd
set spell
set wildmenu
set history=5000
set backspace=indent,eol,start
" indent
set tabstop=2
set shiftwidth=2
set softtabstop=2
set autoindent
set smartindent
set list
set listchars=tab:¦_,trail:~,nbsp:~
hi SpecialKey ctermfg=darkmagenta
command I set list!
" search
set ignorecase
set smartcase
set incsearch
set wrapscan
set hlsearch
" style
set number
set cursorline
set ruler
set showmatch
set virtualedit=onemore
set laststatus=2
set wildmode=list:longest
" Custom map
command Ss :split
command P set paste
command Np set nopaste
cnoremap w!! w !sudo tee > /dev/null %<CR> :e!<CR>
cnoremap rep %s/before/after/g
cnoremap jc! !javac
cnoremap ja! !java
nnoremap <C-O> :<C-u>call append(expand('.'), '')<Cr>j
nnoremap <silent><Esc><Esc> :<C-u>set nohlsearch!<CR>
nnoremap <silent> <Space><Space> "zyiw:let @/ = '\<' . @z . '\>'<CR>:set hlsearch<CR>
nmap # <Space><Space>:%s/<C-r>///g<Left><Left>
vnoremap <silent> y y`]
vnoremap <silent> p p`]
nnoremap <silent> p p`]
vnoremap v $h
inoremap <C-t> <Esc><Left>"zx"zpa
inoremap jj <ESC>
" move
nnoremap j gj
nnoremap k gk
" split
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
nnoremap <S-Left> <C-w><<CR>
nnoremap <S-Right> <C-w>><CR>
nnoremap <S-Up> <C-w>-<CR>
nnoremap <S-Down> <C-w>+<CR>
" tarm emacs
cnoremap <C-p> <Up>
cnoremap <C-n> <Down>
cnoremap <C-b> <Left>
cnoremap <C-f> <Right>
cnoremap <C-a> <Home>
cnoremap <C-e> <End>
cnoremap <C-d> <Del>
" Custom Leader
let mapleader = ","
nnoremap <Leader>w :w<CR>
nnoremap <Leader>q :q<CR>
nnoremap <Leader>wq :wq<CR>
nnoremap <Leader>vs :vs<CR>
nnoremap <Leader>ss :split<CR>
nnoremap <Leader>h ^
nnoremap <Leader>l $
vmap <Leader>y "+y
vmap <Leader>d "+d
nmap <Leader>p "+p
nmap <Leader>P "+P
vmap <Leader>p "+p
vmap <Leader>P "+P
if has("autocmd")
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal! g'\"" |
\ endif
endif
" Color
syntax on
" Plugins
:let g:neobundle_default_git_protocol='https'
if has('vim_starting')
set runtimepath+=~/.vim/bundle/neobundle.vim/
if !isdirectory(expand("~/.vim/bundle/neobundle.vim/"))
echo "install NeoBundle..."
:call system("git clone https://github.com/Shougo/neobundle.vim ~/.vim/bundle/neobundle.vim")
endif
endif
call neobundle#begin(expand('~/.vim/bundle/'))
NeoBundleFetch 'Shougo/neobundle.vim'
"----------------------------------------------------------
" set
NeoBundle 'tomasr/molokai'
NeoBundle 'itchyny/lightline.vim'
NeoBundle 'bronson/vim-trailing-whitespace'
NeoBundle 'scrooloose/nerdtree'
NeoBundle 'terryma/vim-multiple-cursors'
NeoBundle 'tomtom/tcomment_vim'
NeoBundle 'tpope/vim-surround'
NeoBundle 'Shougo/neocomplcache.vim'
" snippet
NeoBundle 'Shougo/neosnippet'
NeoBundle 'Shougo/neosnippet-snippets'
NeoBundle 'no1fushi/mysnippets'
" Search
NeoBundle 'thinca/vim-visualstar'
NeoBundle 'haya14busa/incsearch.vim'
" gosh
NeoBundle 'aharisu/vim_goshrepl'
NeoBundle 'aharisu/vim-gdev'
" Ruby
NeoBundle 'tpope/vim-endwise'
NeoBundle 'szw/vim-tags'
NeoBundle 'marcus/rsense'
" HTML
NeoBundle 'mattn/emmet-vim'
NeoBundle 'othree/html5.vim'
NeoBundle 'hokaccha/vim-html5validator'
" CSS
NeoBundle 'hail2u/vim-css3-syntax'
" JavaScript
NeoBundle 'jelera/vim-javascript-syntax'
NeoBundle 'jiangmiao/simple-javascript-indenter'
"json
NeoBundle 'elzr/vim-json'
" Git
NeoBundle 'airblade/vim-gitgutter'
NeoBundle 'tpope/vim-fugitive'
"----------------------------------------------------------
call neobundle#end()
NeoBundleCheck
filetype plugin indent on
"---------------------------------------------------------
" plugins set
" molokai
if neobundle#is_installed('molokai')
colorscheme molokai
autocmd Colorscheme * highlight FullWidthSpace ctermbg=white
autocmd VimEnter * match FullWidthSpace / /
endif
set t_Co=256
syntax enable
" lightline
set laststatus=2
set showmode
set showcmd
" NERDTree
if neobundle#is_installed('nerdtree')
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
cnoremap nt! NERDTree
endif
" incsearch.vim
if neobundle#is_installed('incsearch.vim')
map / <Plug>(incsearch-forward)
endif
" Rsense
if neobundle#is_installed('rsense')
let g:rsenseHome = '/usr/local/lib/rsense-0.3'
let g:rsenseUseOmniFunc = 1
endif
" gauche
if neobundle#is_installed('vim_goshrepl')
cnoremap gosh GoshREPLWithBuffer
endif
" emmet
if neobundle#is_installed('emmet')
let g:user_emmet_settings = {'variables': {'lang' : 'ja'}}
endif
" vim-json
if neobundle#is_installed('vim-json')
let g:vim_json_syntax_conceal = 0
endif
" snippet
if neobundle#is_installed('neosnippet')
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
xmap <C-k> <Plug>(neosnippet_expand_target)
if has('conceal')
set conceallevel=2 concealcursor=niv
endif
let g:neosnippet#snippets_directory='~/.vim/bundle/neosnippet-snippets/snippets/,~/.vim/bundle/mysnippets/snippets/'
endif
" multiple-cursors
if neobundle#is_installed('vim-multiple-cursors')
let g:multi_cursor_use_default_mapping = 0
let g:multi_cursor_start_word_key = '<C-n>'
let g:multi_cursor_select_all_word_key = '<A-n>'
let g:multi_cursor_start_key = 'g<C-n>'
let g:multi_cursor_select_all_key = 'g<A-n>'
let g:multi_cursor_next_key = '<C-n>'
let g:multi_cursor_prev_key = '<C-p>'
let g:multi_cursor_skip_key = '<C-x>'
let g:multi_cursor_quit_key = '<Esc>'
endif
" vim-fugitive
if neobundle#is_installed('vim-fugitive')
set statusline+=%{fugitive#statusline()}
cnoremap gs! Gstatus
cnoremap ga! Gwrite
cnoremap gc! Gcommit -m
cnoremap gps! Git push
cnoremap gpl! Git pull
cnoremap gl! Git log
cnoremap gco! Git checkout
cnoremap gb! Git branch
cnoremap gbd! Git branch -d
cnoremap gr! Git reset
cnoremap grh! Git reset --hard
cnoremap gra! Git remote add origin
endif
" neocomplcache
if neobundle#is_installed('neocomplcache.vim')
command Ncomp :NeoComplCacheDisable
command Ycomp :NeoComplCacheEnable
let g:acp_enableAtStartup = 0
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_dictionary_filetype_lists = {
\ 'default' : ''
\ }
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()
endif