changeset 444:71d7734148ed

Add support for ALE.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 07 May 2018 22:14:56 -0700
parents 4ca0b1413199
children 05ab0353cd6e
files vim/vimrc
diffstat 1 files changed, 26 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/vim/vimrc	Sun May 06 21:56:43 2018 -0700
+++ b/vim/vimrc	Mon May 07 22:14:56 2018 -0700
@@ -330,6 +330,13 @@
 
 " }}}
 
+" ALE {{{
+
+let g:ale_sign_error = '✗'
+let g:ale_sign_warning = '⚠'
+
+" }}}
+
 " Supertab {{{
 
 let g:SuperTabDefaultCompletionType = "context"
@@ -411,7 +418,7 @@
       \    'ctrlpmark': '_LightlineCtrlPMark',
       \    },
       \'component_expand': {
-      \    'syntastic': '_LightlineSyntastic',
+      \    'syntastic': '_LightlineLinter',
       \    'ycm_errs': '_LightlineYcmErrors',
       \    'ycm_warns': '_LightlineYcmWarnings',
       \    'gutentags': '_LightlineGutentags',
@@ -449,9 +456,24 @@
     return gutentags#statusline('', '', '♨')
 endfunction
 
-function! _LightlineSyntastic()
-    return SyntasticStatuslineFlag()
-endfunction
+if s:HasPlugin('syntastic')
+    function! _LightlineLinter()
+        return SyntasticStatuslineFlag()
+    endfunction
+else
+    function! _LightlineLinter() abort
+        let l:counts = ale#statusline#Count(bufnr(''))
+
+        let l:all_errors = l:counts.error + l:counts.style_error
+        let l:all_non_errors = l:counts.total - l:all_errors
+
+        return l:counts.total == 0 ? 'OK' : printf(
+        \   '%dW %dE',
+        \   all_non_errors,
+        \   all_errors
+        \)
+    endfunction
+endif
 
 function! _LightlineYcmErrors()
     let l:cnt = youcompleteme#GetErrorCount()