summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-05-24 10:38:20 +0100
committerw0rp <devw0rp@gmail.com>2017-05-24 10:38:20 +0100
commited8f79987d5a64c41f8b5c1c244243babde45d25 (patch)
tree61b83b45c2f7e069cc96d3c0c4d82386bd46b7c5 /README.md
parent92ade713f2c9c57bffa3b62550d2fbcd3f5d5d4a (diff)
downloadale-ed8f79987d5a64c41f8b5c1c244243babde45d25.zip
#323 Document how to output ALE statuses
Diffstat (limited to 'README.md')
-rw-r--r--README.md38
1 files changed, 23 insertions, 15 deletions
diff --git a/README.md b/README.md
index 06b3cdd4..316af2c6 100644
--- a/README.md
+++ b/README.md
@@ -296,28 +296,36 @@ highlight clear ALEWarningSign
### 5.iv. How can I show errors or warnings in my statusline?
-You can use `ALEGetStatusLine()` to integrate ALE into vim statusline.
-To enable it, you should have in your `statusline` settings
+[vim-airline](https://github.com/vim-airline/vim-airline) integrates with
+ALE for displaying error information in the status bar. If you want to see
+the status for ALE in a nice format, it is recommended to use vim-airline
+with ALE.
-```vim
-%{ALEGetStatusLine()}
-```
+ALE offers the ability to show some information in statuslines with no extra
+plugins. ALE provides a function for getting a summary with the number of
+problems detected, and you can implement your own function for your statusline.
-When errors are detected a string showing the number of errors will be shown.
-You can customize the output format using the global list `g:ale_statusline_format` where:
+Say you want to display all errors as one figure, and all non-errors as another
+figure. You can do the following:
-- The 1st element is for errors
-- The 2nd element is for warnings
-- The 3rd element is for when no errors are detected
+```vim
+function! LinterStatus() abort
+ let l:counts = ale#statusline#Count()
-e.g
+ let l:all_errors = l:counts.error + l:counts.style_error
+ let l:all_non_errors = l:counts.total - l:all_errors
-```vim
-let g:ale_statusline_format = ['⨉ %d', '⚠ %d', '⬥ ok']
+ return l:counts.total == 0 ? 'OK' : printf(
+ \ '%dW %dE',
+ \ all_non_errors,
+ \ all_errors
+ \)
+endfunction
+
+set statusline=%{LinterStatus()}
```
-![Statusline with issues](img/issues.png)
-![Statusline with no issues](img/no_issues.png)
+See `:help ale#statusline#Count()` for more information.
<a name="faq-echo-format"></a>