2016-09-08 19:23:26 -04:00
|
|
|
# ALE - Asynchronous Lint Engine
|
|
|
|
|
|
|
|
ALE (Asynchronous Lint Engine) is a plugin for providing linting in NeoVim
|
|
|
|
and Vim 8 while you edit your text files.
|
|
|
|
|
|
|
|
ALE makes use of NeoVim and Vim 8 job control functions and timers to
|
|
|
|
run linters on the contents of text buffers and return errors as
|
|
|
|
text is changed in Vim. This allows for displaying warnings and
|
2016-09-13 18:18:52 -04:00
|
|
|
errors in files being edited in Vim before files have been saved
|
|
|
|
back to a filesystem.
|
|
|
|
|
|
|
|
In other words, this plugin allows you to lint while you type.
|
2016-09-08 19:23:26 -04:00
|
|
|
|
2016-09-19 17:19:21 -04:00
|
|
|
## Supported Languages and Tools
|
|
|
|
|
|
|
|
This plugin supports the following languages and tools. All available
|
|
|
|
tools will be run in combination, so they can be complementary.
|
|
|
|
|
|
|
|
<!--
|
|
|
|
Keep the table rows sorted alphabetically by the language name,
|
|
|
|
and the tools in the tools column sorted alphabetically by the tool
|
|
|
|
name. That seems to be the fairest way to arrange this table.
|
|
|
|
-->
|
|
|
|
|
|
|
|
| Language | Tools |
|
|
|
|
| -------- | ----- |
|
|
|
|
| Bash | [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set) |
|
2016-10-03 08:18:27 -04:00
|
|
|
| Bourne Shell | [-n flag](http://linux.die.net/man/1/sh), [shellcheck](https://www.shellcheck.net/) |
|
2016-09-19 17:19:21 -04:00
|
|
|
| C | [gcc](https://gcc.gnu.org/) |
|
2016-10-02 03:39:21 -04:00
|
|
|
| CoffeeScript | [coffeelint](https://www.npmjs.com/package/coffeelint) |
|
2016-10-03 13:05:58 -04:00
|
|
|
| CSS | [csslint](http://csslint.net/)^ |
|
2016-09-19 17:19:21 -04:00
|
|
|
| D | [dmd](https://dlang.org/dmd-linux.html)^ |
|
|
|
|
| Fortran | [gcc](https://gcc.gnu.org/) |
|
|
|
|
| Haskell | [ghc](https://www.haskell.org/ghc/)^ |
|
|
|
|
| JavaScript | [eslint](http://eslint.org/), [jscs](http://jscs.info/), [jshint](http://jshint.com/) |
|
|
|
|
| Python | [flake8](http://flake8.pycqa.org/en/latest/) |
|
|
|
|
| Ruby | [rubocop](https://github.com/bbatsov/rubocop) |
|
2016-10-03 14:02:21 -04:00
|
|
|
| SASS/SCSS | [sass-lint](https://www.npmjs.com/package/sass-lint) |
|
2016-10-03 14:04:57 -04:00
|
|
|
| TypeScript | [tslint](https://github.com/palantir/tslint)^ |
|
2016-10-03 12:40:30 -04:00
|
|
|
| Vim | [vint](https://github.com/Kuniwak/vint)^ |
|
2016-09-19 17:19:21 -04:00
|
|
|
|
|
|
|
*^ Supported only on Unix machines via a wrapper script.*
|
|
|
|
|
|
|
|
If you would like to see support for more languages and tools, please
|
|
|
|
[create an issue](https://github.com/w0rp/ale/issues)
|
|
|
|
or [create a pull request](https://github.com/w0rp/ale/pulls).
|
|
|
|
If your tool can read from stdin or you have code to suggest which is good,
|
|
|
|
support can be happily added for more tools.
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
Once this plugin is installed, while editing your files in supported
|
|
|
|
languages and tools which have been correctly installed,
|
|
|
|
this plugin will send the contents of your text buffers to a variety of
|
|
|
|
programs for checking the syntax and semantics of your programs. By default,
|
|
|
|
linters will be re-run in the background to check your syntax when you open
|
|
|
|
new buffers or as you make edits to your files.
|
|
|
|
|
|
|
|
This plugin offers a variety of global flags for turning options on or off,
|
|
|
|
all of which are given defaults and described in the [flags](plugin/ale/aaflags.vim)
|
|
|
|
file. Linting on open, setting of signs, populating the loclist, and so forth may
|
|
|
|
all be configured as desired.
|
|
|
|
|
|
|
|
### Selecting Particular Linters
|
|
|
|
|
|
|
|
By default, all available tools for all supported languages will be run.
|
|
|
|
If you want to only select a subset of the tools, simply create a
|
|
|
|
`g:ale_linters` dictionary in your vimrc file mapping filetypes
|
|
|
|
to lists of linters to run.
|
|
|
|
|
|
|
|
```vim
|
|
|
|
let g:ale_linters = {
|
|
|
|
\ 'javascript': ['eslint'],
|
|
|
|
\}
|
|
|
|
```
|
|
|
|
|
|
|
|
For all languages unspecified in the dictionary, all possible linters will
|
|
|
|
be run for those languages, just as when the dictionary is not defined.
|
|
|
|
Running many linters should not typically obstruct editing in Vim,
|
|
|
|
as they will all be executed in separate processes simultaneously.
|
|
|
|
|
|
|
|
This plugin will look for linters in the [`ale_linters`](ale_linters) directory.
|
|
|
|
Each directory within corresponds to a particular filetype in Vim, and each file
|
|
|
|
in each directory corresponds to the name of a particular linter.
|
|
|
|
|
2016-09-26 10:55:26 -04:00
|
|
|
### Always showing gutter
|
2016-10-02 04:22:24 -04:00
|
|
|
|
2016-09-26 11:41:22 -04:00
|
|
|
You can keep the sign gutter open at all times by setting the g:ale_sign_column_always to 1
|
2016-09-26 10:55:26 -04:00
|
|
|
|
|
|
|
```vim
|
|
|
|
let g:ale_sign_column_always = 1
|
|
|
|
```
|
|
|
|
|
2016-10-02 04:22:24 -04:00
|
|
|
### Customize signs
|
|
|
|
|
|
|
|
Use these options to specify what text should be used for signs:
|
|
|
|
|
|
|
|
```vim
|
|
|
|
let g:ale_sign_error = '>>'
|
|
|
|
let g:ale_sign_warning = '--'
|
|
|
|
```
|
|
|
|
|
2016-09-26 10:55:26 -04:00
|
|
|
|
2016-09-19 17:04:11 -04:00
|
|
|
## Installation
|
|
|
|
|
|
|
|
To install this plugin, you should use one of the following methods.
|
|
|
|
For Windows users, replace usage of the Unix `~/.vim` directory with
|
|
|
|
`%USERPROFILE%\_vim`, or another directory if you have configured
|
|
|
|
Vim differently. On Windows, your `~/.vimrc` file will be similarly
|
|
|
|
stored in `%USERPROFILE%\_vimrc`.
|
|
|
|
|
|
|
|
### Installation with Pathogen
|
|
|
|
|
|
|
|
To install this module with [Pathogen](https://github.com/tpope/vim-pathogen),
|
|
|
|
you should clone this repository to your bundle directory, and ensure
|
|
|
|
you have the line `execute pathogen#infect()` in your `~/.vimrc` file.
|
|
|
|
You can run the following commands in your terminal to do so:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
cd ~/.vim/bundle
|
|
|
|
git clone https://github.com/w0rp/ale.git
|
|
|
|
```
|
|
|
|
|
|
|
|
### Installation with Vundle
|
|
|
|
|
|
|
|
You can install this plugin using [Vundle](https://github.com/VundleVim/Vundle.vim)
|
2016-09-26 16:44:23 -04:00
|
|
|
by using the path on GitHub for this repository.
|
2016-09-19 17:04:11 -04:00
|
|
|
|
|
|
|
```vim
|
2016-09-23 08:15:28 -04:00
|
|
|
Plugin 'w0rp/ale'
|
2016-09-19 17:04:11 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
See the Vundle documentation for more information.
|
|
|
|
|
2016-09-19 17:19:21 -04:00
|
|
|
### Manual Installation
|
2016-09-19 17:04:11 -04:00
|
|
|
|
|
|
|
For installation without a package manager, you can clone this git repository
|
|
|
|
into a bundle directory as with pathogen, and add the repository to your
|
|
|
|
runtime path yourself. First clone the repository.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
cd ~/.vim/bundle
|
|
|
|
git clone https://github.com/w0rp/ale.git
|
|
|
|
```
|
|
|
|
|
|
|
|
Then, modify your `~/.vimrc` file to add this plugin to your runtime path.
|
|
|
|
|
|
|
|
```vim
|
|
|
|
set nocompatible
|
|
|
|
filetype off
|
|
|
|
|
|
|
|
let &runtimepath.=',~/.vim/bundle/ale'
|
|
|
|
|
|
|
|
filetype plugin on
|
|
|
|
```
|
|
|
|
|
|
|
|
Because the author of this plugin is a weird nerd, this is his preferred
|
|
|
|
installation method.
|