comparison vim/vimrc @ 504:015e94f44cc0

Merged changes.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 30 Sep 2020 21:17:47 -0700
parents b452486b97c5
children 232351531855
comparison
equal deleted inserted replaced
503:35094cf31de4 504:015e94f44cc0
160 set shiftwidth=4 160 set shiftwidth=4
161 set softtabstop=4 161 set softtabstop=4
162 set smarttab 162 set smarttab
163 set expandtab 163 set expandtab
164 164
165 " Auto-reload files that have changed outside of Vim (which is useful
166 " when reverting/syncing/whatever from the shell).
167 set autoread
168
165 " Default encoding 169 " Default encoding
166 set encoding=utf-8 170 set encoding=utf-8
167 171
168 " Clipboard buffer. 172 " Clipboard buffer.
169 set clipboard=unnamed 173 set clipboard=unnamed
206 else 210 else
207 set background=dark 211 set background=dark
208 let g:solarized_termcolors = 256 212 let g:solarized_termcolors = 256
209 let g:solarized_termtrans = 1 213 let g:solarized_termtrans = 1
210 endif 214 endif
211 colorscheme solarized 215 if ludo#platform() == "windows" && &term == "win32"
216 " Windows terminal sucks with colours, so pick an appropriate theme.
217 colorscheme xterm16
218 else
219 colorscheme solarized
220 endif
212 221
213 " Enable file type detection. 222 " Enable file type detection.
214 filetype indent plugin on 223 filetype indent plugin on
215 224
216 " }}} 225 " }}}
240 let g:ackprg = 'rg --vimgrep' 249 let g:ackprg = 'rg --vimgrep'
241 elseif executable('ag') 250 elseif executable('ag')
242 let g:ackprg = 'ag --vimgrep' 251 let g:ackprg = 'ag --vimgrep'
243 endif 252 endif
244 253
245 nnoremap <leader>a :Ack!<Space> 254 nnoremap <Leader>a :Ack!<Space>
246 nnoremap <leader>f :Ack! /<C-R><C-W>/ 255 nnoremap <Leader>f :Ack! <C-R><C-W> %:h<Tab>
247 vnoremap <leader>f "zy:Ack! /<C-R>z/ 256 vnoremap <Leader>f "zy:Ack! <C-R>z %:h<Tab>
248 257
249 " }}} 258 " }}}
250 259
251 " Ctrl-P {{{ 260 " Ctrl-P {{{
252 261
445 \ 'ycm_warns': 'warning', 454 \ 'ycm_warns': 'warning',
446 \ 'gutentags': 'warning', 455 \ 'gutentags': 'warning',
447 \ }, 456 \ },
448 \} 457 \}
449 458
450 function! _LightlineFugitive() 459 if s:HasPlugin('fugitive')
451 return fugitive#head() 460 function! _LightlineFugitive()
452 endfunction 461 return fugitive#head()
453 462 endfunction
454 function! _LightlineLawrencium() 463 else
455 return lawrencium#statusline() 464 function! _LightlineFugitive()
456 endfunction 465 endfunction
466 endif
467
468 if s:HasPlugin('lawrencium')
469 function! _LightlineLawrencium()
470 return lawrencium#statusline()
471 endfunction
472 else
473 function! _LightlineLawrencium()
474 endfunction
475 endif
457 476
458 function! _LightlineCtrlPMark() 477 function! _LightlineCtrlPMark()
459 if expand('%:t') =~ 'ControlP' && has_key(g:lightline, 'ctrlp_item') 478 if expand('%:t') =~ 'ControlP' && has_key(g:lightline, 'ctrlp_item')
460 call lightline#link('iR'[g:lightline.ctrlp_regex]) 479 call lightline#link('iR'[g:lightline.ctrlp_regex])
461 return lightline#concatenate( 480 return lightline#concatenate(
466 else 485 else
467 return '' 486 return ''
468 endif 487 endif
469 endfunction 488 endfunction
470 489
471 function! _LightlineGutentags() 490 if s:HasPlugin('gutentags')
472 return gutentags#statusline('', '', '♨') 491 function! _LightlineGutentags()
473 endfunction 492 return gutentags#statusline('', '', '♨')
493 endfunction
494 else
495 function! _LightlineGutentags()
496 endfunction
497 endif
474 498
475 if s:HasPlugin('syntastic') 499 if s:HasPlugin('syntastic')
476 function! _LightlineLinter() 500 function! _LightlineLinter()
477 return SyntasticStatuslineFlag() 501 return SyntasticStatuslineFlag()
478 endfunction 502 endfunction
489 \ all_errors 513 \ all_errors
490 \) 514 \)
491 endfunction 515 endfunction
492 endif 516 endif
493 517
494 function! _LightlineYcmErrors() 518 if s:HasPlugin('youcompleteme')
495 let l:cnt = youcompleteme#GetErrorCount() 519 function! _LightlineYcmErrors()
496 return l:cnt > 0 ? string(l:cnt) : '' 520 let l:cnt = youcompleteme#GetErrorCount()
497 endfunction 521 return l:cnt > 0 ? string(l:cnt) : ''
498 522 endfunction
499 function! _LightlineYcmWarnings() 523
500 let l:cnt = youcompleteme#GetWarningCount() 524 function! _LightlineYcmWarnings()
501 return l:cnt > 0 ? string(l:cnt) : '' 525 let l:cnt = youcompleteme#GetWarningCount()
502 endfunction 526 return l:cnt > 0 ? string(l:cnt) : ''
527 endfunction
528 else
529 function! _LightlineYcmErrors()
530 endfunction
531
532 function! _LightlineYcmWarnings()
533 endfunction
534 endif
503 " }}} 535 " }}}
504 536
505 " YouCompleteMe {{{ 537 " YouCompleteMe {{{
506 538
507 let g:ycm_always_populate_location_list = 1 539 let g:ycm_always_populate_location_list = 1
531 augroup END 563 augroup END
532 564
533 augroup VimRCFileType_c 565 augroup VimRCFileType_c
534 au! 566 au!
535 autocmd FileType c,c++,cpp setlocal foldmethod=syntax 567 autocmd FileType c,c++,cpp setlocal foldmethod=syntax
536 autocmd FileType c,c++,cpp setlocal colorcolumn=120 568 autocmd FileType c,c++,cpp setlocal colorcolumn=240
537 autocmd FileType c,c++,cpp setlocal synmaxcol=200 569 autocmd FileType c,c++,cpp setlocal synmaxcol=250
538 autocmd FileType c,c++,cpp nnoremap <buffer> <localleader>z :call <SID>ToggleCppFolding()<CR> 570 autocmd FileType c,c++,cpp nnoremap <buffer> <localleader>z :call <SID>ToggleCppFolding()<CR>
539 augroup END 571 augroup END
540 572
541 augroup VimRCFileType_csharp 573 augroup VimRCFileType_csharp
542 au! 574 au!
543 autocmd BufNewFile,BufRead *.xaml setlocal filetype=xml 575 autocmd BufNewFile,BufRead *.xaml setlocal filetype=xml
544 autocmd FileType cs setlocal foldmethod=syntax 576 autocmd FileType cs setlocal foldmethod=syntax
545 autocmd FileType cs setlocal colorcolumn=120 577 autocmd FileType cs setlocal colorcolumn=240
546 autocmd FileType cs setlocal synmaxcol=200 578 autocmd FileType cs setlocal synmaxcol=250
547 augroup END 579 augroup END
548 580
549 augroup VimRCFileType_css 581 augroup VimRCFileType_css
550 au! 582 au!
551 autocmd BufNewFile,BufRead *.less setlocal filetype=less 583 autocmd BufNewFile,BufRead *.less setlocal filetype=less
667 nnoremap ]q :cnext<cr>zvzz 699 nnoremap ]q :cnext<cr>zvzz
668 nnoremap [q :cprevious<cr>zvzz 700 nnoremap [q :cprevious<cr>zvzz
669 nnoremap ]l :lnext<cr>zvzz 701 nnoremap ]l :lnext<cr>zvzz
670 nnoremap [l :lprevious<cr>zvzz 702 nnoremap [l :lprevious<cr>zvzz
671 703
704 " Toggle quicklist.
705 nnoremap <F5> :call ludo#toggle_quicklist()<cr>
706
672 " Same with change and jump lists. 707 " Same with change and jump lists.
673 nnoremap ]e g,zz 708 nnoremap ]e g,zz
674 nnoremap [e g;zz 709 nnoremap [e g;zz
675 nnoremap ]j <C-I> 710 nnoremap ]j <C-I>
676 nnoremap [j <C-O> 711 nnoremap [j <C-O>
696 731
697 " Keep search matches in the middle of the window. 732 " Keep search matches in the middle of the window.
698 nnoremap n nzvzz 733 nnoremap n nzvzz
699 nnoremap N Nzvzz 734 nnoremap N Nzvzz
700 735
701 " Writing mode.
702 autocmd! User GoyoEnter nested call ludo#on_goyo_enter()
703 autocmd! User GoyoLeave nested call ludo#on_goyo_leave()
704 nmap <leader>p :call ludo#writingmode()<CR>
705
706 " YCM mappings. 736 " YCM mappings.
707 if s:HasPlugin('youcompleteme') 737 if s:HasPlugin('youcompleteme')
708 augroup VimRC_YouCompleteMe 738 augroup VimRC_YouCompleteMe
709 autocmd! 739 autocmd!
710 autocmd FileType cpp nnoremap <Leader>jj :YcmCompleter GoToImprecise<cr>zv 740 autocmd FileType cpp nnoremap <Leader>jj :YcmCompleter GoToImprecise<cr>zv
711 autocmd FileType cpp nnoremap <Leader>jd :YcmCompleter GoToDefinition<cr>zv 741 autocmd FileType cpp nnoremap <Leader>jd :YcmCompleter GoToDefinition<cr>zv
712 autocmd FileType cpp nnoremap <Leader>jh :YcmCompleter GoToDeclaration<cr>zv 742 autocmd FileType cpp nnoremap <Leader>jh :YcmCompleter GoToDeclaration<cr>zv
713 autocmd FileType cpp nnoremap <Leader>ji :YcmCompleter GoToInclude<cr> 743 autocmd FileType cpp nnoremap <Leader>ji :YcmCompleter GoToInclude<cr>
714 autocmd FileType cpp nnoremap <Leader>jc :YcmCompleter GetDoc<cr> 744 autocmd FileType cpp nnoremap <Leader>jc :YcmCompleter GetDoc<cr>
745 autocmd FileType cpp nnoremap <Leader>jt :YcmCompleter GetType<cr>
715 autocmd FileType cpp nnoremap <Leader>je :YcmShowDetailedDiagnostic<cr> 746 autocmd FileType cpp nnoremap <Leader>je :YcmShowDetailedDiagnostic<cr>
716 augroup END 747 augroup END
717 endif 748 endif
718 749
719 " OmniSharp mappings 750 " OmniSharp mappings