/
vimrc
493 lines (446 loc) · 9.88 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
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
""""""""""""""""""""""""""""""""""""""""
"
" BUNDLES (PATHOGEN)
"
" `:Helptags` to regenerate docs
"
call pathogen#infect()
"
""""""""""""""""""""""""""""""""""""""""
"
" HIGHLIGHTING
"
syntax on
colo mustango
se cursorline
se listchars=tab:▸\ ,trail:□,eol:¬
"
""""""""""""""""""""""""""""""""""""""""
"
" ENVIRONMENT
"
se encoding=utf8
se backspace=2
se fileformat=unix
se fileformats=unix
se nocompatible
se hidden
se nobackup
se noswapfile
se dir=/tmp,/var/tmp
se autoread
se number
se visualbell
se ch=1
se laststatus=2
se noshowmode
se mousehide
se ttyfast
se autoindent
se copyindent
se smartindent
se smarttab
se nolist
se backspace=indent,eol,start
se wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/*cache,*/logs,*/web/bundles,.DS_Store
se path=**
"
""""""""""""""""""""""""""""""""""""""""
"
" FOLDING
"
se foldmethod=syntax
se foldlevel=1
"
""""""""""""""""""""""""""""""""""""""""
"
" SEARCH
"
se incsearch
se hlsearch
se showmatch
se ignorecase
se smartcase
se gdefault
se tags+=vendor.tags
"
""""""""""""""""""""""""""""""""""""""""
"
" SCROLLING
"
se scrolljump=3
se scrolloff=3
"
""""""""""""""""""""""""""""""""""""""""
"
" TABS
"
se tabstop=4
se shiftwidth=4
se softtabstop=4
se showtabline=1
se expandtab
"
""""""""""""""""""""""""""""""""""""""""
"
" AUTOCOMPLETION
"
se wildcharm=<tab>
se wildmenu
se wildmode=full
inoremap <c-l> <c-x><c-l>
"
""""""""""""""""""""""""""""""""""""""""
"
" WRAPPING
"
se wrap
se linebreak
se textwidth=100
se colorcolumn=100
se formatoptions=qrn1
"se formatprg=par
"se formatoptions+=tca
"
"+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
"|
"| > CUSTOM MAPPINGS
"|
"|
""""""""""""""""""""""""""""""""""""""""
"
" COPY-PASTE
"
"set clipboard=unnamed
"
" Use "+p (in N) or <c-r>+ (in I)
"
""""""""""""""""""""""""""""""""""""""""
"
" GENERAL OVERRIDINGS
"
let mapleader = ","
let maplocalleader = "\\"
inoremap jk <esc>
inoremap <esc> <nop>
nnoremap Y y$
"
""""""""""""""""""""""""""""""""""""""""
"
" DASH
"
nnoremap <leader>d :Dash<cr>
"
""""""""""""""""""""""""""""""""""""""""
"
" HIGHLIGHTING MAPPINGS
"
nnoremap <leader>ll :set list!<cr>
nnoremap <silent> <leader><space> :nohlsearch<cr>
"
""""""""""""""""""""""""""""""""""""""""
"
" LINES MOVEMENT
"
nnoremap <s-up> [e
nnoremap <s-down> ]e
vnoremap <s-up> [egv
vnoremap <s-down> ]egv
"
""""""""""""""""""""""""""""""""""""""""
"
" FS NAVIGATION
"
nnoremap <leader>ep :e <c-r>=expand("%:p:h")."/"<cr>
nnoremap <leader>es :vsp <c-r>=expand("%:p:h")."/"<cr>
nnoremap <leader>se :Vex<cr><c-w>=
nnoremap <leader>mk :!mkdir <c-r>=expand("%:p:h")."/"<cr>
nnoremap <leader>rm :!rm -rf <c-r>=expand("%:p:h")."/"<cr>
cnoremap w!! w !sudo tee % >/dev/null
"
""""""""""""""""""""""""""""""""""""""""
"
" TABS MANAGEMENT
"
nnoremap <leader>df :tab split<cr>
nnoremap <leader>dd :tabclose<cr>
nnoremap <leader>do :tabonly<cr>
"
""""""""""""""""""""""""""""""""""""""""
"
" WINDOWS MANAGEMENT
"
nnoremap <leader>we <c-w>v<c-w>l
nnoremap <leader>ws <c-w>s<c-w>j
nnoremap <leader>wq <c-w>v<c-w>h
nnoremap <leader>w2 <c-w>s<c-w>k
nnoremap <leader>wo :on<cr>
nnoremap <leader>w= <c-w>=
nnoremap <leader>w0 <c-w>\|
nnoremap <leader>w- <c-w>_
nnoremap <leader>wk <c-w>K
nnoremap <leader>wh <c-w>H
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 <c-x> <c-w>x
"
""""""""""""""""""""""""""""""""""""""""
"
" BUFFERS MANAGEMENT
"
nnoremap <leader>bo :BufOnly<cr>
nnoremap <leader>bc :bd<cr>
"
""""""""""""""""""""""""""""""""""""""""
"
" MOVEMENT TUNING
"
nnoremap j gj
nnoremap k gk
nnoremap <tab> %
vnoremap <tab> %
vnoremap < <gv
vnoremap > >gv
"
""""""""""""""""""""""""""""""""""""""""
"
" MOVEMENT COMBINATIONS TUNING
"
nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <right> <nop>
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
vnoremap <s-h> <nop>
vnoremap <s-j> <nop>
vnoremap <s-k> <nop>
vnoremap <s-l> <nop>
"
""""""""""""""""""""""""""""""""""""""""
"
" SEARCH TUNING
"
nnoremap / /\v
vnoremap / /\v
nnoremap * *N
"
"+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
"|
"| > PLUGINS CONFIGURATION
"|
"|
""""""""""""""""""""""""""""""""""""""""
"
" AIRLINE
"
let g:airline_powerline_fonts=1
let g:airline_theme='wombatish'
"
""""""""""""""""""""""""""""""""""""""""
"
" FUGITIVE
"
nnoremap <leader>gs :Gstatus<cr>
nnoremap <leader>ga :Gwrite<cr>
nnoremap <leader>gh :Gbrowse!<cr>
nnoremap <leader>gc :Gcommit --verbose<cr>
nnoremap <leader>grm :Gremove<cr>
nnoremap <leader>gmv :Gmove<cr>
"
""""""""""""""""""""""""""""""""""""""""
"
" ACK
"
nnoremap <expr><leader>a ":Ack! "
"
""""""""""""""""""""""""""""""""""""""""
"
" NEOCOMPLCACHE
"
let g:neocomplcache_enable_at_startup = 1
let g:neocomplcache_enable_ignore_case = 0
let g:neocomplcache_enable_camel_case_completion = 1
let g:neocomplcache_enable_underbar_completion = 1
let g:neocomplcache_temporary_dir = '~/.neocomplcache'
set completeopt-=preview
"
""""""""""""""""""""""""""""""""""""""""
"
" UltiSnips
"
let g:UltiSnipsExpandTrigger = '<tab>'
let g:UltiSnipsListSnippets = '<c-tab>'
let g:UltiSnipsJumpForwardTrigger = '<tab>'
let g:UltiSnipsJumpBackwardTrigger = '<s-tab>'
"
""""""""""""""""""""""""""""""""""""""""
"
" CTRLP
"
let g:ctrlp_map = '<c-t>'
let g:ctrlp_working_path_mode = 2
let g:ctrlp_max_height = 15
let g:ctrlp_open_multi = '1v'
let g:ctrlp_custom_ignore = '\v[\/](vendor|\.git|\.hg)$'
let g:ctrlp_match_window_bottom = 0
let g:ctrlp_match_window_reversed = 0
"
""""""""""""""""""""""""""""""""""""""""
"
" LUSTY
"
let g:LustyJugglerShowKeys = '1'
"
""""""""""""""""""""""""""""""""""""""""
"
" TABULAR
"
nnoremap <leader><tab><tab> :Tab /
nnoremap <leader><tab>= :Tab /=<cr>
nnoremap <leader><tab>: :Tab /:\zs<cr>
nnoremap <leader><tab>> :Tab /=><cr>
vnoremap <leader><tab> :Tab /
vnoremap <leader><tab>= :Tab /=<cr>
vnoremap <leader><tab>: :Tab /:\zs<cr>
vnoremap <leader><tab>> :Tab /=><cr>
"
""""""""""""""""""""""""""""""""""""""""
"
" YANKRING
"
let g:yankring_history_file = '.yankring_history'
nnoremap <leader>y :YRShow<cr>
"
""""""""""""""""""""""""""""""""""""""""
"
" EASYMOTION
"
let g:EasyMotion_leader_key='t'
"
""""""""""""""""""""""""""""""""""""""""
"
" VIMUX
"
nnoremap <leader>vr :VimuxPromptCommand<cr>
nnoremap <leader>vl :VimuxRunLastCommand<cr>
nnoremap <leader>vc :VimuxCloseRunner<cr>
"
""""""""""""""""""""""""""""""""""""""""
"
" PHP
"
let g:php_folding=1
let php_noShortTags = 1
nnoremap <leader>u :call PhpInsertUse()<cr>
nnoremap <leader>e :call PhpExpandClass()<cr>
"
""""""""""""""""""""""""""""""""""""""""
"
" BEHAT
"
let feature_filetype='behat'
"
"+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
"|
"| > CUSTOM FUNCTIONS
"|
"|
""""""""""""""""""""""""""""""""""""""""
"
" STRIP TRAILING SPACES
"
nnoremap <silent> <leader>c :call <sid>StripTrailingWhitespaces()<cr>
function! <sid>StripTrailingWhitespaces()
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
%s/\s\+$//e
" Clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction
"
""""""""""""""""""""""""""""""""""""""""
"
" RENAME CURRENT BUFFER FILE
"
nnoremap <leader>mv :Rename %:p:h<tab>
command! -nargs=1 -complete=file Rename call <sid>Rename(<q-args>)
function! <sid>Rename(newfile)
let l:newfile = a:newfile
let l:oldfile = expand('%:p')
exe 'saveas! '.l:newfile
call system('rm '.shellescape(l:oldfile))
let l:lastbuf = bufnr(l:oldfile)
exe 'bd! '.l:lastbuf
endfunction
"
""""""""""""""""""""""""""""""""""""""""
"
" CREATE DIRECTORY FOR CURRENT BUFFER
"
function! <sid>MkdirsIfNotExists(directory)
if(!isdirectory(a:directory))
call system('mkdir -p '.shellescape(a:directory))
endif
endfunction
"
"+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
"|
"| > AUTOCMD
"|
"|
filetype on
filetype plugin on
filetype indent on
if ! has('gui_running')
set ttimeoutlen=10
augroup FastEscape
autocmd!
au InsertEnter * set timeoutlen=500
au InsertLeave * set timeoutlen=1000
augroup END
endif
if has('autocmd')
augroup GeneralConfig
autocmd!
au FocusLost silent! :wa
au FileType helpfile setlocal nonumber
augroup END
augroup FileTypes
autocmd!
au BufRead,BufNewFile *.php setlocal filetype=php iskeyword-=$
au BufRead,BufNewFile *.php inoremap <buffer> § $
au BufRead,BufNewFile *.php inoremap <buffer> ± ->
au BufRead,BufNewFile *.php inoremap <buffer> §§ $this->
au BufRead,BufNewFile *.twig setlocal filetype=jinja
au BufRead,BufNewFile *.html.twig setlocal filetype=htmljinja
au BufRead,BufNewFile *.js.twig setlocal filetype=javascript
au BufRead,BufNewFile *.ejs setlocal filetype=html
au BufRead,BufNewFile *.json setlocal filetype=javascript
au BufRead,BufNewFile *.pp setlocal filetype=ruby
augroup END
augroup TabsConfig
autocmd!
au BufRead,BufNewFile *.feature setlocal tabstop=2 shiftwidth=2 softtabstop=2
au BufRead,BufNewFile *.css setlocal tabstop=2 shiftwidth=2 softtabstop=2
au BufRead,BufNewFile *.scss setlocal tabstop=2 shiftwidth=2 softtabstop=2
au BufRead,BufNewFile *.less setlocal tabstop=2 shiftwidth=2 softtabstop=2
au BufRead,BufNewFile *.ruby setlocal tabstop=2 shiftwidth=2 softtabstop=2
au BufRead,BufNewFile *.js setlocal tabstop=2 shiftwidth=2 softtabstop=2
au BufRead,BufNewFile *.coffee setlocal tabstop=2 shiftwidth=2 softtabstop=2
au BufRead,BufNewFile *.jade setlocal tabstop=2 shiftwidth=2 softtabstop=2
augroup END
augroup Commands
autocmd!
au BufWrite *.php,*.js,*.feature,*.json :call <sid>StripTrailingWhitespaces()
au BufWrite * :call <sid>MkdirsIfNotExists(expand('<afile>:h'))
augroup END
endif