Mercurial > dotfiles
comparison vim/vimrc @ 386:b570ad9917c0
Add local pre-override for vimrc. Bunch of other vim tweaks.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 23 May 2017 13:56:28 -0700 |
parents | af7646eceddc |
children | c175fda4aa2e |
comparison
equal
deleted
inserted
replaced
382:c3a863440b1a | 386:b570ad9917c0 |
---|---|
29 endif | 29 endif |
30 | 30 |
31 " Get our vim directory. | 31 " Get our vim directory. |
32 let s:vim_home = expand("<sfile>:h") | 32 let s:vim_home = expand("<sfile>:h") |
33 | 33 |
34 " Local pre-override. | |
35 let s:local_vimrc_pre = s:vim_home.'/vimrc-local-pre' | |
36 if filereadable(s:local_vimrc_pre) | |
37 execute 'source' s:local_vimrc_pre | |
38 endif | |
39 | |
34 " Make sure `filetype` stuff is turned off before loading Pathogen. | 40 " Make sure `filetype` stuff is turned off before loading Pathogen. |
35 syntax off | 41 syntax off |
36 filetype off | 42 filetype off |
37 | 43 |
38 " Disable some plugins. | 44 " Disable some plugins. |
39 let g:pathogen_disabled = [] | 45 let g:pathogen_disabled = get(g:, 'pathogen_disabled', []) |
40 call add(g:pathogen_disabled, 'vimroom') | 46 call add(g:pathogen_disabled, 'vimroom') |
41 call add(g:pathogen_disabled, 'minibufexpl') | 47 call add(g:pathogen_disabled, 'minibufexpl') |
42 call add(g:pathogen_disabled, 'ragtag') | 48 call add(g:pathogen_disabled, 'ragtag') |
43 call add(g:pathogen_disabled, 'interestingwords') | 49 call add(g:pathogen_disabled, 'interestingwords') |
44 | 50 |
253 | 259 |
254 " Make Ctrl-P cache stuff in our temp directory. | 260 " Make Ctrl-P cache stuff in our temp directory. |
255 let g:ctrlp_cache_dir = s:vim_home.'/cache' | 261 let g:ctrlp_cache_dir = s:vim_home.'/cache' |
256 | 262 |
257 " Remember things. | 263 " Remember things. |
258 let g:ctrlp_clear_cache_on_ext = 0 | 264 let g:ctrlp_clear_cache_on_exit = 0 |
259 | 265 |
260 " Don't include some stuff in the most recently used list. | 266 " Don't include some stuff in the most recently used list. |
261 let g:ctrlp_mruf_exclude = 'hg\-editor\-\d+\.txt' | 267 let g:ctrlp_mruf_exclude = 'hg\-editor\-\d+\.txt' |
262 | 268 |
263 " Enable some cool extensions. | 269 " Enable some cool extensions. |
362 " Lightline {{{ | 368 " Lightline {{{ |
363 let g:lightline = { | 369 let g:lightline = { |
364 \'colorscheme': 'solarized', | 370 \'colorscheme': 'solarized', |
365 \'active': { | 371 \'active': { |
366 \ 'left': [ ['mode', 'paste'], | 372 \ 'left': [ ['mode', 'paste'], |
367 \ ['fugitive', 'lawrencium', 'readonly', 'filename'], | 373 \ ['fugitive', 'lawrencium', 'readonly', 'relativepath', 'modified'], |
368 \ ['ctrlpmark'] ], | 374 \ ['ctrlpmark'] ], |
369 \ 'right': [ ['lineinfo'], | 375 \ 'right': [ ['lineinfo'], |
370 \ ['percent'], | 376 \ ['percent'], |
371 \ ['fileformat', 'fileencoding', 'filetype'], | 377 \ ['fileformat', 'fileencoding', 'filetype'], |
372 \ ['gutentags', 'syntastic', 'ycm_errs', 'ycm_warns'] ] | 378 \ ['gutentags', 'syntastic', 'ycm_errs', 'ycm_warns'] ] |
428 let l:cnt = youcompleteme#GetWarningCount() | 434 let l:cnt = youcompleteme#GetWarningCount() |
429 return l:cnt > 0 ? string(l:cnt) : '' | 435 return l:cnt > 0 ? string(l:cnt) : '' |
430 endfunction | 436 endfunction |
431 " }}} | 437 " }}} |
432 | 438 |
439 " YouCompleteMe {{{ | |
440 | |
441 let g:ycm_always_populate_location_list = 1 | |
442 | |
443 " }}} | |
444 | |
433 " }}} | 445 " }}} |
434 | 446 |
435 " File-Specific Settings {{{ | 447 " File-Specific Settings {{{ |
436 | 448 |
437 augroup VimRCFileType_markdown | 449 augroup VimRCFileType_markdown |
452 autocmd FileType php setlocal matchpairs-=<:> | 464 autocmd FileType php setlocal matchpairs-=<:> |
453 augroup END | 465 augroup END |
454 | 466 |
455 augroup VimRCFileType_c | 467 augroup VimRCFileType_c |
456 au! | 468 au! |
457 autocmd FileType c,c++,cpp setlocal foldmethod=syntax | 469 autocmd FileType c,c++,cpp,cs setlocal foldmethod=syntax |
458 autocmd FileType c,c++,cpp setlocal colorcolumn=120 | 470 autocmd FileType c,c++,cpp,cs setlocal colorcolumn=120 |
459 augroup END | 471 augroup END |
460 | 472 |
461 augroup VimRCFileType_css | 473 augroup VimRCFileType_css |
462 au! | 474 au! |
463 autocmd BufNewFile,BufRead *.less setlocal filetype=less | 475 autocmd BufNewFile,BufRead *.less setlocal filetype=less |
570 nnoremap [e g;zz | 582 nnoremap [e g;zz |
571 nnoremap ]j <C-I> | 583 nnoremap ]j <C-I> |
572 nnoremap [j <C-O> | 584 nnoremap [j <C-O> |
573 | 585 |
574 " Copy the current buffer's info. | 586 " Copy the current buffer's info. |
575 nnoremap <leader>cp :let @+ = expand('%:p')<cr> | 587 nnoremap <leader>cp :let @+ = expand('%:p')<cr>:echo @+<cr> |
576 nnoremap <leader>cf :let @+ = expand('%:h')<cr> | 588 nnoremap <leader>cf :let @+ = expand('%:h')<cr>:echo @+<cr> |
589 nnoremap <leader>cw :let @+ = getcwd()<cr>:echo @+<cr> | |
577 | 590 |
578 " Make the diff navigation also center things. | 591 " Make the diff navigation also center things. |
579 nnoremap ]c ]czvzz | 592 nnoremap ]c ]czvzz |
580 nnoremap [c [czvzz | 593 nnoremap [c [czvzz |
581 | 594 |
606 " Keep search matches in the middle of the window. | 619 " Keep search matches in the middle of the window. |
607 nnoremap n nzvzz | 620 nnoremap n nzvzz |
608 nnoremap N Nzvzz | 621 nnoremap N Nzvzz |
609 | 622 |
610 " YCM mappings. | 623 " YCM mappings. |
611 nnoremap <Leader>jj :YcmCompleter GoToImprecise<cr> | 624 nnoremap <Leader>jj :YcmCompleter GoToImprecise<cr>zv |
612 nnoremap <Leader>jd :YcmCompleter GoToDefinition<cr> | 625 nnoremap <Leader>jd :YcmCompleter GoToDefinition<cr>zv |
613 nnoremap <Leader>jh :YcmCompleter GoToDeclaration<cr> | 626 nnoremap <Leader>jh :YcmCompleter GoToDeclaration<cr>zv |
614 nnoremap <Leader>ji :YcmCompleter GoToInclude<cr> | 627 nnoremap <Leader>ji :YcmCompleter GoToInclude<cr> |
615 nnoremap <Leader>jc :YcmCompleter GetDoc<cr> | 628 nnoremap <Leader>jc :YcmCompleter GetDoc<cr> |
616 | 629 |
617 " }}} | 630 " }}} |
618 | 631 |
619 " Folding {{{ | 632 " Folding {{{ |
620 | 633 |
621 " Start with one level of open. | 634 " Start with one level of open. |
622 set foldlevel=1 | 635 set foldlevel=1 |
636 | |
637 " Don't fold too much. | |
638 set foldnestmax=2 | |
623 | 639 |
624 " Folds are defined by markers in the text. | 640 " Folds are defined by markers in the text. |
625 set foldmethod=marker | 641 set foldmethod=marker |
626 | 642 |
627 " Toggle folds with <space>. | 643 " Toggle folds with <space>. |
668 function! s:FindInNERDTree() abort | 684 function! s:FindInNERDTree() abort |
669 NERDTreeFind | 685 NERDTreeFind |
670 normal zz | 686 normal zz |
671 endfunction | 687 endfunction |
672 | 688 |
673 function! s:AutoProjectRootCD() abort | |
674 if &buftype == '' | |
675 ProjectRootCD | |
676 endif | |
677 endfunction | |
678 autocmd BufEnter * call <SID>AutoProjectRootCD() | |
679 | |
680 " }}} | 689 " }}} |
681 | 690 |
682 " Local override {{{ | 691 " Local override {{{ |
683 | 692 |
684 let s:local_vimrc = s:vim_home.'/vimrc-local' | 693 let s:local_vimrc = s:vim_home.'/vimrc-local' |