add vim-ale
[webi-installers/.git] / vim-ale / README.md
1 ---
2 title: vim-ale
3 homepage: https://github.com/dense-analysis/ale
4 tagline: |
5   ALE: allows you to lint while you type.
6 ---
7
8 To update (replacing the current version) run `webi vim-ale`.
9
10 ## Cheat Sheet
11
12 > ALE (Asynchronous Lint Engine) is a plugin providing linting (syntax checking
13 > and semantic errors) in NeoVim 0.2.0+ and Vim 8 while you edit your text
14 > files, and acts as a Vim Language Server Protocol client.
15
16 ALE is the spiritual successor to Syntastic.
17
18 This installer includes a few reasonable defaults.
19
20 ### How to install and configure manually
21
22 ```bash
23 git clone --depth=1 https://github.com/dense-analysis/ale.git ~/.vim/pack/plugins/start/ale
24 ```
25
26 `.vimrc`:
27
28 ```vim
29 " ALE: reasonable defaults from webinstall.dev/vim-ale
30 source ~/.vim/plugins/ale.vim
31 ```
32
33 `.vim/plugins/ale.vim`:
34
35 ```txt
36 " turn on the syntax checker
37 syntax on
38
39 " don't check syntax immediately on open or on quit
40 let g:ale_lint_on_enter = 0
41 let g:ale_lint_on_save = 1
42
43 " error symbol to use in sidebar
44 let g:ale_sign_error = '☢️'
45 let g:ale_sign_warning = '⚡'
46
47 " show number of errors
48 function! LinterStatus() abort
49     let l:counts = ale#statusline#Count(bufnr(''))
50     let l:all_errors = l:counts.error + l:counts.style_error
51     let l:all_non_errors = l:counts.total - l:all_errors
52     return l:counts.total == 0 ? 'OK' : printf(
53         \   '%d⨉ %d⚠ ',
54         \   all_non_errors,
55         \   all_errors
56         \)
57 endfunction
58 set statusline+=%=
59 set statusline+=\ %{LinterStatus()}
60
61 " format error strings
62 let g:ale_echo_msg_error_str = 'E'
63 let g:ale_echo_msg_warning_str = 'W'
64 let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
65 ```