-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
257 lines (219 loc) · 7.79 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
if has('win32')
let vimfiles_path = '~/vimfiles'
else
let vimfiles_path = '~/.vim'
end
" ----------------------------------------------------------------
" Basic Settings
" Behaviour
set nobackup
set noswapfile
set noundofile
source $VIMRUNTIME/macros/matchit.vim
" Display
set autoindent
set number
set incsearch
set hlsearch
set smartcase
" Editor
set shiftwidth=2
set showtabline=2
set softtabstop=2
set tabstop=2
set scrolloff=0
set foldmethod=indent
set foldlevelstart=999
" let javaScript_fold=1
" Encode and Languages
set encoding=utf-8
set fileencoding=utf-8
set fileformats=unix,dos,mac
set fileformat=unix
set spelllang=en,cjk
set spell
" Ignore Files
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " Basic
set wildignore+=*/node_modules/* " Node
set wildignore+=*/libs/*,*/vendor/* " Common
" ----------------------------------------------------------------
" Keyboard Shortcuts
nnoremap <Space><Space> <Esc>
nnoremap <S-Right> >iB
nnoremap <S-Left> <iB
nnoremap <C-t> :NERDTreeToggle<CR>
nnoremap <C-C><C-D> :cd %:h<CR>:NERDTreeCWD<CR>
nnoremap <C-L><C-C><C-D> :lcd %:h<CR>
imap <C-@> <C-[>
inoremap <C-F>d <C-R>=strftime('%Y-%m-%d')<CR>
inoremap <C-F><S-D> <C-R>=strftime('%H:%M')<CR>
inoremap <C-F><S-F> for (var i=0, l=.length; i<l; i++) {<CR>}<Esc>-15la
nnoremap <C-W><C-R> :browse old<CR>
vnoremap <C-C> "+y
:command! W :set columns=80 lines=25
" Folding
nnoremap <C-Z> za
nnoremap <S-Z> vaBzf
nnoremap zn :set fdo-=search<CR>
nnoremap zN :set fdo+=search<CR>
" Diff
nnoremap <Space>d :diffthis<CR>
nnoremap <Space><S-D> :diffoff!<CR>
nnoremap <Space><C-D> :diffupdate<CR>
" ----------------------------------------------------------------
" File Types
augroup vimrc
autocmd!
autocmd BufRead * setlocal ts=2 sw=2 noet
autocmd FileType javascript inoremap <C-F><C-L> console.log();<Esc>hi
autocmd FileType javascript inoremap <C-F><C-D> console.debug();<Esc>hi
autocmd FileType javascript inoremap <C-F><C-F> function(
autocmd FileType javascript inoremap <C-F><C-G> ) {<CR>}
autocmd FileType javascript inoremap <C-F><C-B> .bind(this)
autocmd FileType javascript inoremap <C-F><C-I> if () {<CR>}<CR>else {<CR>}<Esc>3-wa
autocmd FileType javascript inoremap <C-F><C-E> try {<CR>}<CR>catch (e) {<CR>}<Esc>kkk
autocmd BufRead,BufNewFile *.js inoremap <C-F><C-T> setTimeout(function() {<CR>}.bind(this), 1);<Esc>O
autocmd FileType coffee inoremap <C-F><C-L> console.log <Esc>a
autocmd FileType coffee inoremap <C-F><C-F> () -><Esc>3hi
autocmd FileType ruby setlocal et
autocmd FileType ruby nmap <C-W><C-F> :Unite file file/new<LF>A
autocmd FileType eruby setlocal et
autocmd FileType eruby nmap <C-W><C-F> :Unite file file/new<LF>A
autocmd BufNewFile,BufRead *.hbs set filetype=html
augroup END
" ----------------------------------------------------------------
" NeoBundle
" Note: Skip initialization for vim-tiny or vim-small.
if 0 | endif
if has('vim_starting')
if &compatible
set nocompatible " Be iMproved
endif
" Required:
exe 'set runtimepath+=' . vimfiles_path . '/bundle/neobundle.vim/'
endif
" Required:
call neobundle#begin(expand(vimfiles_path . '/bundle/'))
" Let NeoBundle manage NeoBundle
" Required:
NeoBundleFetch 'Shougo/neobundle.vim'
" My Bundles here:
" Refer to |:NeoBundle-examples|.
" Note: You don't set neobundle setting in .gvimrc!
NeoBundle 'Lokaltog/vim-easymotion'
NeoBundle 'Shougo/neocomplete.vim'
NeoBundle 'Shougo/unite-outline'
NeoBundle 'Shougo/unite.vim'
NeoBundle 'Shougo/neomru.vim'
NeoBundle 'editorconfig/editorconfig-vim'
NeoBundle 'itchyny/lightline.vim'
NeoBundle 'kchmck/vim-coffee-script'
NeoBundle 'mattn/emmet-vim'
NeoBundle 'nathanaelkane/vim-indent-guides'
NeoBundle 'othree/html5.vim'
NeoBundle 'othree/javascript-libraries-syntax.vim'
NeoBundle 'slim-template/vim-slim'
NeoBundle 'terryma/vim-multiple-cursors'
NeoBundle 'tpope/vim-fugitive'
NeoBundle 'tyru/caw.vim'
NeoBundle 'tyru/open-browser.vim'
NeoBundle 'digitaltoad/vim-jade'
NeoBundle 'tpope/vim-rails'
NeoBundle 'leafgarland/typescript-vim'
NeoBundle 'ctrlpvim/ctrlp.vim'
NeoBundle 'itchyny/vim-cursorword'
NeoBundle 'bronson/vim-trailing-whitespace'
NeoBundle 'tpope/vim-surround'
NeoBundle 'posva/vim-vue'
NeoBundle 'scrooloose/nerdtree'
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
" ----------------------------------------------------------------
" Emmet
" https://github.com/mattn/emmet-vim
let g:user_emmet_settings = {
\ 'lang' : 'ja',
\ 'html' : {
\ 'indentation' : ' '
\ },
\}
" ----------------------------------------------------------------
" https://github.com/Shougo/unite.vim
nmap <C-W><S-W> :Unite file_rec directory_rec file/new<LF>
nmap <C-W><C-W> :Unite file file/new<LF>
nmap <C-W><C-B> :Unite buffer<LF>
nmap <C-W><C-M> :Unite bookmark<LF>
nmap <C-W><C-H> :Unite file_mru<LF>
nmap <C-W><C-G> :Unite register<LF>
" Shougo/unite-outline
nmap <C-W><C-O> :Unite outline<LF>
nmap <C-W><S-O> :Unite -vertical -winwidth=20 outline<LF>
" ----------------------------------------------------------------
" https://github.com/tyru/open-browser.vim
nmap <Leader>o <Plug>(openbrowser-open)
" ----------------------------------------------------------------
" itchyny/lightline.vim
" http://qiita.com/items/ab70f914a6a577e25d70
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'active': {
\ 'right': [ [ 'lineinfo' ], [ 'fileformat', 'fileencoding', 'filetype' ] ]
\ }
\ }
" ----------------------------------------------------------------
" https://github.com/kchmck/vim-coffee-script
" http://qiita.com/alpaca_taichou/items/fb442cfa78f91634cfaa
au BufRead,BufNewFile,BufReadPre *.coffee set filetype=coffee
autocmd FileType coffee setlocal sw=2 sts=2 ts=2 et
" ----------------------------------------------------------------
" Markdown
au BufRead,BufNewFile,BufReadPre *.md set filetype=markdown
autocmd FileType markdown setlocal sw=4 sts=4 ts=4 et
if has('win32')
:command! Marked :silent !"C:/Program Files (x86)/Google/Chrome/Application/chrome.exe" --profile-directory=Default "%"
else
:command! Marked :!open -a Marked "%"
endif
" ----------------------------------------------------------------
" EasyMotion
" https://github.com/Lokaltog/vim-easymotion
" http://mba-hack.blogspot.jp/2013/01/vim4.html
let g:Eaotion_keys='hjklasdfgyuiopqwertnmzxcvbHJKLASDFGYUIOPQWERTNMZXCVB'
let g:EasyMotion_leader_key=","
let g:EasyMotion_grouping=1
nmap <C-k><C-k> ,b
nmap <C-k><C-j> ,w
nmap <C-j> <Plug>(easymotion-sn)
" ----------------------------------------------------------------
" neo-complete
" https://github.com/Shougo/neocomplete.vim
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_smart_case = 1
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
" ----------------------------------------------------------------
" encomment
" https://github.com/tyru/caw.vim
nmap <Space>k <Plug>(caw:hatpos:toggle)
vmap <Space>k <Plug>(caw:hatpos:toggle)
nmap <Space><S-k> <Plug>(caw:wrap:toggle)
vmap <Space><S-k> <Plug>(caw:wrap:toggle)
" ----------------------------------------------------------------
" Multiple Cursors
" https://github.com/terryma/vim-multiple-cursors
nnoremap <Space>/ :MultipleCursorsFind
nnoremap <Space>* :MultipleCursorsFind <C-r><C-w><CR>
vnoremap <Space>/ :MultipleCursorsFind
vnoremap <Space>s :<C-h><C-h><C-h><C-h><C-h>MultipleCursorsFind <C-r><C-w><CR>s
" vnoremap <Space>* viw"xy :MultipleCursorsFind <C-r>x<CR>
vnoremap <Space>v "xy :MultipleCursorsFind <C-r>x<CR>
" ----------------------------------------------------------------
" Indent Guides
" https://github.com/nathanaelkane/vim-indent-guides
let g:indent_guides_enable_on_vim_startup = 1