Vim has the ability to work with various linting systems. This page covers some strategies for working with linters.

The naive approachEdit

To understand why the methods described below are useful, we first describe the "naive" approach to linting. In this approach, the user is initially editing a file in Vim. To run the linter, the user might do one of the following:

  • Open a new terminal window and run the linting command there.
  • Hit CTRL-Z to send Vim to the background, run the linting command, then use fg to bring Vim back to the foreground.
  • Use :! in Vim to run the linting command. (See :help :!)
  • Open a new split window in tmux or similar programs and run the linting command there.

All the of the above approaches require (1) manually specifying the linting program and (2) manually reading the error messages to navigate to some place in the code (i.e. the place where the errors occur). It would be nice if these steps can be automated, so that the user need only think "lint this!" and be given a list of places to jump to.

Compiler pluginsEdit

In stock Vim, the way to work with linters is to load warnings and other messages from the linters into the quickfix list and jump to them using quickfix commands. See :help quickfix.txt for detailed documentation.

To let Vim know which linter to use, the 'makeprg' and 'errorformat' options can be set. Compiler plugins are special plugins in Vim that set these options to predefined values so that the user need only type :compiler {name} to use the intended compiler. After specifying the compiler once, the user can from that point just invoke :make.

Note that these are called "compiler" plugins because initially they were used exclusively with compilers and build systems such as make, gcc, and javac, but they can be used for any program that takes as inputs certain files (e.g. the current file) and outputs locations (e.g. the line and column of errors). In particular, compiler plugins can be used for linters.

Vim comes with numerous compiler plugins, which are stored in $VIMRUNTIME/compiler/. More information about compiler plugins can be found at :help write-compiler-plugin.

To use Pylint as an example:

" Set the compiler to pylint. This is local to the buffer.
:compiler pylint
" Set the compiler to pylint. This is global.
:compiler! pylint
" Set the compiler for Python files to pylint
autocmd FileType python compiler pylint
" Check the current file
:make %
" Check all Python files in the current directory
:make *.py


Tim Pope's dispatch.vim plugin eases the switching of compilers and also allows asynchronous linting.

:Dispatch pylint %


Syntastic is a popular syntax checking plugin.


Neomake is a recent plugin that uses the job control features of Vim 8 and Neovim to asynchronously run programs.

Asynchronous Lint Engine (ALE)Edit

ALE is a more recent plugin that uses the asynchronous jobs features of Vim 8 and Neovim to asynchronously run linting programs on the buffer. This means saving the buffer to the filesystem is not necessary. It comes bundled with support for numerous linting programs, so often the linting programs simply need to be installed somewhere sensible to start checking your code.

See alsoEdit

External linksEdit

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.