diff options
author | Martin Tournoij <martin@arp242.net> | 2017-12-07 15:26:20 +0000 |
---|---|---|
committer | Martin Tournoij <martin@arp242.net> | 2017-12-07 16:14:20 +0000 |
commit | d6bf13502ad7a018a739b82bc068d299aacc5d26 (patch) | |
tree | bfffd7cb039527e17cbdf85f9d466799c0df698b /autoload | |
parent | e2a8f759d870ed7a1f0ee4698a73b65e9f36e54d (diff) | |
download | ale-d6bf13502ad7a018a739b82bc068d299aacc5d26.zip |
Add ALEStartLint autocmd
This grew out of my work in #1193; to ensure the statusline was being
updated I had to add:
fun! s:redraw(timer)
redrawstatus
endfun
augroup ALEProgress
autocmd!
autocmd BufWritePost * call timer_start(100, function('s:redraw'))
autocmd User ALELint redrawstatus
augroup end
Which kind of works, but is ugly. With this, I can replace the
`BufWritePost` with:
autocmd User ALEStartLint redrawstatus
Which is much better, IMHO.
Actually, this patch actually replaces adding a function, since you can
do:
augroup ALEProgress
autocmd!
autocmd User ALEStartLint hi Statusline ctermfg=darkgrey
autocmd User ALELint hi Statusline ctermfg=NONE
augroup end
or:
let s:ale_running = 0
let l:stl .= '%{s:ale_running ? "[linting]" : ""}'
augroup ALEProgress
autocmd!
autocmd User ALEStartLint let s:ale_running = 1 | redrawstatus
autocmd User ALELint let s:ale_running = 0 | redrawstatus
augroup end
Both seem to work very well in my testing.
No need to `ale#Statusline#IsRunning()` anymore, I think?
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/engine.vim | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim index 150b53c1..895544fe 100644 --- a/autoload/ale/engine.vim +++ b/autoload/ale/engine.vim @@ -556,6 +556,8 @@ function! s:RunJob(options) abort \ 'output': [], \ 'next_chain_index': l:next_chain_index, \} + + silent doautocmd <nomodeline> User ALEStartLint endif if g:ale_history_enabled |