comparison vim/vimrc @ 484:759ccf5befb2

Make lightline work when some other plugins are not enabled.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 24 Sep 2020 23:10:38 -0700
parents 1a54ffbc3b15
children 25bdfc963612
comparison
equal deleted inserted replaced
483:1a54ffbc3b15 484:759ccf5befb2
445 \ 'ycm_warns': 'warning', 445 \ 'ycm_warns': 'warning',
446 \ 'gutentags': 'warning', 446 \ 'gutentags': 'warning',
447 \ }, 447 \ },
448 \} 448 \}
449 449
450 function! _LightlineFugitive() 450 if s:HasPlugin('fugitive')
451 return fugitive#head() 451 function! _LightlineFugitive()
452 endfunction 452 return fugitive#head()
453 453 endfunction
454 function! _LightlineLawrencium() 454 else
455 return lawrencium#statusline() 455 function! _LightlineFugitive()
456 endfunction 456 endfunction
457 endif
458
459 if s:HasPlugin('lawrencium')
460 function! _LightlineLawrencium()
461 return lawrencium#statusline()
462 endfunction
463 else
464 function! _LightlineLawrencium()
465 endfunction
466 endif
457 467
458 function! _LightlineCtrlPMark() 468 function! _LightlineCtrlPMark()
459 if expand('%:t') =~ 'ControlP' && has_key(g:lightline, 'ctrlp_item') 469 if expand('%:t') =~ 'ControlP' && has_key(g:lightline, 'ctrlp_item')
460 call lightline#link('iR'[g:lightline.ctrlp_regex]) 470 call lightline#link('iR'[g:lightline.ctrlp_regex])
461 return lightline#concatenate( 471 return lightline#concatenate(
466 else 476 else
467 return '' 477 return ''
468 endif 478 endif
469 endfunction 479 endfunction
470 480
471 function! _LightlineGutentags() 481 if s:HasPlugin('gutentags')
472 return gutentags#statusline('', '', '♨') 482 function! _LightlineGutentags()
473 endfunction 483 return gutentags#statusline('', '', '♨')
484 endfunction
485 else
486 function! _LightlineGutentags()
487 endfunction
488 endif
474 489
475 if s:HasPlugin('syntastic') 490 if s:HasPlugin('syntastic')
476 function! _LightlineLinter() 491 function! _LightlineLinter()
477 return SyntasticStatuslineFlag() 492 return SyntasticStatuslineFlag()
478 endfunction 493 endfunction
489 \ all_errors 504 \ all_errors
490 \) 505 \)
491 endfunction 506 endfunction
492 endif 507 endif
493 508
494 function! _LightlineYcmErrors() 509 if s:HasPlugin('youcompleteme')
495 let l:cnt = youcompleteme#GetErrorCount() 510 function! _LightlineYcmErrors()
496 return l:cnt > 0 ? string(l:cnt) : '' 511 let l:cnt = youcompleteme#GetErrorCount()
497 endfunction 512 return l:cnt > 0 ? string(l:cnt) : ''
498 513 endfunction
499 function! _LightlineYcmWarnings() 514
500 let l:cnt = youcompleteme#GetWarningCount() 515 function! _LightlineYcmWarnings()
501 return l:cnt > 0 ? string(l:cnt) : '' 516 let l:cnt = youcompleteme#GetWarningCount()
502 endfunction 517 return l:cnt > 0 ? string(l:cnt) : ''
518 endfunction
519 else
520 function! _LightlineYcmErrors()
521 endfunction
522
523 function! _LightlineYcmWarnings()
524 endfunction
525 endif
503 " }}} 526 " }}}
504 527
505 " YouCompleteMe {{{ 528 " YouCompleteMe {{{
506 529
507 let g:ycm_always_populate_location_list = 1 530 let g:ycm_always_populate_location_list = 1