summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorMartin Tournoij <martin@arp242.net>2017-12-07 15:26:20 +0000
committerMartin Tournoij <martin@arp242.net>2017-12-07 16:14:20 +0000
commitd6bf13502ad7a018a739b82bc068d299aacc5d26 (patch)
treebfffd7cb039527e17cbdf85f9d466799c0df698b /README.md
parente2a8f759d870ed7a1f0ee4698a73b65e9f36e54d (diff)
downloadale-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 'README.md')
-rw-r--r--README.md10
1 files changed, 6 insertions, 4 deletions
diff --git a/README.md b/README.md
index 89bcc255..0292d52c 100644
--- a/README.md
+++ b/README.md
@@ -40,7 +40,7 @@ formatting tools, and some Language Server Protocol and `tsserver` features.
5. [How can I show errors or warnings in my statusline?](#faq-statusline)
6. [How can I show errors or warnings in my lightline?](#faq-lightline)
7. [How can I change the format for echo messages?](#faq-echo-format)
- 8. [How can I execute some code when ALE stops linting?](#faq-autocmd)
+ 8. [How can I execute some code when ALE starts or stops linting?](#faq-autocmd)
9. [How can I navigate between errors quickly?](#faq-navigation)
10. [How can I run linters only when I save files?](#faq-lint-on-save)
11. [How can I use the quickfix list instead of the loclist?](#faq-quickfix)
@@ -493,15 +493,17 @@ Will give you:
<a name="faq-autocmd"></a>
-### 5.viii. How can I execute some code when ALE stops linting?
+### 5.viii. How can I execute some code when ALE starts or stops linting?
ALE runs its own [autocmd](http://vimdoc.sourceforge.net/htmldoc/autocmd.html)
-event whenever has a linter has been successfully executed and processed. This
-autocmd event can be used to call arbitrary functions after ALE stops linting.
+events whenever has a linter is started and has been successfully executed and
+processed. This autocmd event can be used to call arbitrary functions before and
+after ALE stops linting.
```vim
augroup YourGroup
autocmd!
+ autocmd User ALEStartLint call YourFunction()
autocmd User ALELint call YourFunction()
augroup END
```