ycm.vim 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. " MIT License. Copyright (c) 2015-2021 Evgeny Firsov et al.
  2. " Plugin: https://github.com/ycm-core/YouCompleteMe
  3. " vim: et ts=2 sts=2 sw=2
  4. scriptencoding utf-8
  5. if !get(g:, 'loaded_youcompleteme', 0)
  6. finish
  7. endif
  8. let s:spc = g:airline_symbols.space
  9. let s:error_symbol = get(g:, 'airline#extensions#ycm#error_symbol', 'E:')
  10. let s:warning_symbol = get(g:, 'airline#extensions#ycm#warning_symbol', 'W:')
  11. function! airline#extensions#ycm#init(ext)
  12. call airline#parts#define_function('ycm_error_count', 'airline#extensions#ycm#get_error_count')
  13. call airline#parts#define_function('ycm_warning_count', 'airline#extensions#ycm#get_warning_count')
  14. endfunction
  15. function! airline#extensions#ycm#get_error_count() abort
  16. if exists("*youcompleteme#GetErrorCount")
  17. let cnt = youcompleteme#GetErrorCount()
  18. if cnt != 0
  19. return s:error_symbol.cnt
  20. endif
  21. endif
  22. return ''
  23. endfunction
  24. function! airline#extensions#ycm#get_warning_count()
  25. if exists("*youcompleteme#GetWarningCount")
  26. let cnt = youcompleteme#GetWarningCount()
  27. if cnt != 0
  28. return s:warning_symbol.cnt.s:spc
  29. endif
  30. endif
  31. return ''
  32. endfunction