summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2017-12-17 12:06:57 +0000
committerGitHub <noreply@github.com>2017-12-17 12:06:57 +0000
commitc8ee402ccefea822629970fb39b538eca95219c4 (patch)
treedd45ec06ec73748d1db57a18d291c582c101a108 /doc
parenta22def45b956e796fc676e94a5d169a5c059c1ce (diff)
parent4825cce1cc9ec729ea59ae90eb819f67239d335b (diff)
downloadale-c8ee402ccefea822629970fb39b538eca95219c4.zip
Merge pull request #1203 from Carpetsmoker/autocmd-start
Add ALEStartLint autocmd
Diffstat (limited to 'doc')
-rw-r--r--doc/ale.txt34
1 files changed, 23 insertions, 11 deletions
diff --git a/doc/ale.txt b/doc/ale.txt
index fc4a984f..b818f871 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -2051,7 +2051,7 @@ ale#linter#Define(filetype, linter) *ale#linter#Define()*
the file on disk, including |g:ale_lint_on_enter|
and |g:ale_lint_on_save|. Linters with this option
set to `1` will also be run when linters are run
- manually, per |ALELint-autocmd|.
+ manually, per |ALELintPost-autocmd|.
When this option is set to `1`, `read_buffer` will
be set automatically to `0`. The two options cannot
@@ -2185,20 +2185,32 @@ ale#statusline#Count(buffer) *ale#statusline#Count()*
`total` -> The total number of problems.
-ALELint *ALELint-autocmd*
+ALELintPre ALELintPost *ALELintPre-autocmd* *ALELintPost-autocmd*
- This |User| autocommand is triggered by ALE every time it completes a lint
- cycle. It can be used to update statuslines, send notifications, or
- complete any other operation that needs to be done after linting has been
- performed.
-
- For example, you can echo a message when linting is complete like so:
- >
- autocmd User ALELint unsilent echom 'ALE run!'
-<
+ These |User| autocommands are triggered before and after every lint cycle.
+ It can be used to update statuslines, send notifications, etc.
The autocmd commands are run with |:silent|, so |:unsilent| is required for
echoing messges.
+ For example to change the color of the statusline while the linter is
+ running:
+>
+ augroup ALEProgress
+ autocmd!
+ autocmd User ALELintPre hi Statusline ctermfg=darkgrey
+ autocmd User ALELintPOST hi Statusline ctermfg=NONE
+ augroup end
+<
+ Or to display the progress in the statusline:
+>
+ let s:ale_running = 0
+ let l:stl .= '%{s:ale_running ? "[linting]" : ""}'
+ augroup ALEProgress
+ autocmd!
+ autocmd User ALELintPre let s:ale_running = 1 | redrawstatus
+ autocmd User ALELintPost let s:ale_running = 0 | redrawstatus
+ augroup end
+<
===============================================================================
10. Special Thanks *ale-special-thanks*