neomake.vim 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. " MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
  2. " Plugin: https://github.com/neomake/neomake
  3. " vim: et ts=2 sts=2 sw=2
  4. if !exists(':Neomake')
  5. finish
  6. endif
  7. let s:error_symbol = get(g:, 'airline#extensions#neomake#error_symbol', 'E:')
  8. let s:warning_symbol = get(g:, 'airline#extensions#neomake#warning_symbol', 'W:')
  9. function! s:get_counts()
  10. let l:counts = neomake#statusline#LoclistCounts()
  11. if empty(l:counts)
  12. return neomake#statusline#QflistCounts()
  13. else
  14. return l:counts
  15. endif
  16. endfunction
  17. function! airline#extensions#neomake#get_warnings()
  18. let counts = s:get_counts()
  19. let warnings = get(counts, 'W', 0)
  20. return warnings ? s:warning_symbol.warnings : ''
  21. endfunction
  22. function! airline#extensions#neomake#get_errors()
  23. let counts = s:get_counts()
  24. let errors = get(counts, 'E', 0)
  25. return errors ? s:error_symbol.errors : ''
  26. endfunction
  27. function! airline#extensions#neomake#init(ext)
  28. call airline#parts#define_function('neomake_warning_count', 'airline#extensions#neomake#get_warnings')
  29. call airline#parts#define_function('neomake_error_count', 'airline#extensions#neomake#get_errors')
  30. endfunction