1
0
Fork 0
mirror of synced 2024-11-25 10:15:35 -05:00
ultimate-vim/sources_non_forked/lightline-ale/README.md

123 lines
3.9 KiB
Markdown
Raw Normal View History

2018-06-14 06:31:12 -04:00
# lightline-ale
This plugin provides [ALE](https://github.com/w0rp/ale) indicator for the [lightline](https://github.com/itchyny/lightline.vim) vim plugin.
![screenshot](./screenshot.png)
## Table Of Contents
2021-05-05 04:25:00 -04:00
- [Installation](#installation)
- [Integration](#integration)
- [Configuration](#configuration)
- [License](#license)
2018-06-14 06:31:12 -04:00
## Installation
Install using a plugin manager of your choice, for example:
```viml
2021-06-23 05:57:12 -04:00
call dein#add('dense-analysis/ale') " Dependency: linter
2018-06-14 06:31:12 -04:00
call dein#add('itchyny/lightline.vim') " Dependency: status line
call dein#add('maximbaz/lightline-ale')
```
## Integration
1. Register the components:
```viml
let g:lightline = {}
let g:lightline.component_expand = {
\ 'linter_checking': 'lightline#ale#checking',
2020-01-28 21:07:36 -05:00
\ 'linter_infos': 'lightline#ale#infos',
2018-06-14 06:31:12 -04:00
\ 'linter_warnings': 'lightline#ale#warnings',
\ 'linter_errors': 'lightline#ale#errors',
\ 'linter_ok': 'lightline#ale#ok',
\ }
```
2. Set color to the components:
```viml
let g:lightline.component_type = {
2020-01-28 21:07:36 -05:00
\ 'linter_checking': 'right',
\ 'linter_infos': 'right',
2018-06-14 06:31:12 -04:00
\ 'linter_warnings': 'warning',
\ 'linter_errors': 'error',
2020-01-28 21:07:36 -05:00
\ 'linter_ok': 'right',
2018-06-14 06:31:12 -04:00
\ }
```
3. Add the components to the lightline, for example to the right side:
```viml
2020-01-28 21:07:36 -05:00
let g:lightline.active = { 'right': [[ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_infos', 'linter_ok' ]] }
2018-06-14 06:31:12 -04:00
```
2021-05-05 04:25:00 -04:00
3.1. Lineinfo, fileformat, etc. have to be added additionaly. Final example:
```viml
let g:lightline.active = {
\ 'right': [ [ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_infos', 'linter_ok' ],
\ [ 'lineinfo' ],
\ [ 'percent' ],
\ [ 'fileformat', 'fileencoding', 'filetype'] ] }
```
2018-06-14 06:31:12 -04:00
## Configuration
##### `g:lightline#ale#indicator_checking`
The indicator to use when ALE is in progress. Default is `Linting...`.
2020-01-28 21:07:36 -05:00
##### `g:lightline#ale#indicator_infos`
The indicator to use when there are infos. Default is `I:`.
2018-06-14 06:31:12 -04:00
##### `g:lightline#ale#indicator_warnings`
The indicator to use when there are warnings. Default is `W:`.
##### `g:lightline#ale#indicator_errors`
The indicator to use when there are errors. Default is `E:`.
##### `g:lightline#ale#indicator_ok`
The indicator to use when there are no warnings or errors. Default is `OK`.
### Using icons as indicators
If you would like to replace the default indicators with symbols like on the screenshot, then you'll need to ensure you have some "iconic fonts" installed, such as [Font Awesome](https://fontawesome.com). A common alternative is to replace your primary font with one of the [Patched Nerd Fonts](https://github.com/ryanoasis/nerd-fonts), which saves you from having to install multiple fonts.
The following icons from the Font Awesome font are used in the screenshot:
2021-05-05 04:25:00 -04:00
- Checking: [f110](https://fontawesome.com/icons/spinner)
- Infos: [f129](https://fontawesome.com/icons/info)
- Warnings: [f071](https://fontawesome.com/icons/exclamation-triangle)
- Errors: [f05e](https://fontawesome.com/icons/ban)
- OK: [f00c](https://fontawesome.com/icons/check) (although I prefer to disable this component)
2018-06-14 06:31:12 -04:00
To specify icons in the configuration, use their unicode codes as `"\uXXXX"` (make sure to wrap them in double quotes). Alternatively copy the icons from a font website, or type <kbd>\<C-v\>u\<4-digit-unicode\></kbd> or <kbd>\<C-v\>U\<8-digit-unicode\></kbd> to insert the literal characters.
See the code points here:
2021-05-05 04:25:00 -04:00
- Font Awesome: https://fontawesome.com/icons
- Nerd Fonts: https://github.com/ryanoasis/nerd-fonts#glyph-sets
2018-06-14 06:31:12 -04:00
Here's the configuration snippet used in the screenshot:
```viml
let g:lightline#ale#indicator_checking = "\uf110"
2020-01-28 21:07:36 -05:00
let g:lightline#ale#indicator_infos = "\uf129"
2018-06-14 06:31:12 -04:00
let g:lightline#ale#indicator_warnings = "\uf071"
let g:lightline#ale#indicator_errors = "\uf05e"
let g:lightline#ale#indicator_ok = "\uf00c"
```
## License
2021-05-05 04:25:00 -04:00
Released under the [ISC License](LICENSE)