Finally add lint status to neovim status line

I refused for a long time but it is useful for large files and if you
are editing existing files.
This commit is contained in:
Daniel Siepmann 2024-02-14 10:00:39 +01:00
parent 437f87ba7c
commit 1fd0866d00
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4

View file

@ -1,9 +1,23 @@
function! AleLinterStatusLine() 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
set statusline=%h%w "Show modi, help, preview.
set statusline+=\ %f "Show file name
set statusline+=%= "Switch to right side.
set statusline+=%m "Show modification of file
set statusline+=%r "Show readonly mode of file
set statusline+=%*
set statusline+=%{AleLinterStatusLine()}
set statusline+=%y "Show filetype
set statusline+=[%{&fileencoding?&fileencoding:&encoding}] " Show encoding
set statusline+=[%{&ff}] "Show lineendings