SkillAgentSearch skills...

Syntastic

Syntax checking hacks for vim

Install / Use

/learn @vim-syntastic/Syntastic
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

               ,
              / \,,_  .'|
           ,{{| /}}}}/_.'            _____________________________________________
          }}}}` '{{'  '.            /                                             \
        {{{{{    _   ;, \          /            Ladies and Gentlemen,              \
     ,}}}}}}    /o`\  ` ;)        |                                                |
    {{{{{{   /           (        |                 this is ...                    |
    }}}}}}   |            \       |                                                |
   {{{{{{{{   \            \      |                                                |
   }}}}}}}}}   '.__      _  |     |    _____             __             __  _      |
   {{{{{{{{       /`._  (_\ /     |   / ___/__  ______  / /_____ ______/ /_(_)____ |
    }}}}}}'      |    //___/   --=:   \__ \/ / / / __ \/ __/ __ `/ ___/ __/ / ___/ |
jgs `{{{{`       |     '--'       |  ___/ / /_/ / / / / /_/ /_/ (__  ) /_/ / /__   |
     }}}`                         | /____/\__, /_/ /_/\__/\__,_/____/\__/_/\___/   |
                                  |      /____/                                    |
                                  |                                               /
                                   \_____________________________________________/

  1. Deprecation note
  2. Introduction
  3. Installation
    3.1. Requirements
    3.2. Installing syntastic with Pathogen
  4. Recommended settings
  5. FAQ
    5.1. I installed syntastic but it isn't reporting any errors...
    5.2. Syntastic supports several checkers for my filetype, how do I tell it which one(s) to use?
    5.3. How can I run checkers for "foreign" filetypes against the current file?
    5.4. I have enabled multiple checkers for the current filetype. How can I display all errors from all checkers together?
    5.5. How can I pass additional arguments to a checker?
    5.6. I run a checker and the location list is not updated...
    5.6. I run:lopen or :lwindow and the error window is empty...
    5.7. How can I jump between the different errors without using the location list at the bottom of the window?
    5.8. The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?
    5.9. My favourite checker needs to load a configuration file from the project's root rather than the current directory...
    5.10. What is the difference between syntax checkers and style checkers?
    5.11. How can I check scripts written for different versions of Python?
    5.12. How can I check scripts written for different versions of Ruby?
    5.13. The perl checker has stopped working...
    5.14. What happened to the rustc checker?
    5.15. What happened to the tsc checker?
    5.16. What happened to the xcrun checker?
    5.17. What happened to the valac checker?
    5.18. What happened to the Julia lint checker?
  6. Resources

<a name="deprecation"></a>

1. Deprecation note

This project is no longer maintained. If you need a syntax checking plugin for [Vim][vim] you might be interested in Syntastic's spiritual succesor, [ALE][ale]. Although it shares no code with syntastic and it takes a very different approach to design, [ALE][ale] can be considered a natural evolution of syntastic in terms of goals and functionality. Check it out, you probably won't be disappointed.

<a name="introduction"></a>

2. Introduction

Syntastic is a syntax checking plugin for [Vim][vim] created by [Martin Grenfell][scrooloose]. It runs files through external syntax checkers and displays any resulting errors to the user. This can be done on demand, or automatically as files are saved. If syntax errors are detected, the user is notified and is happy because they didn't have to compile their code or execute their script to find them.

At the time of this writing, syntastic has checking plugins for ACPI Source Language, ActionScript, Ada, Ansible configurations, API Blueprint, AppleScript, AsciiDoc, Assembly languages, BEMHTML, Bro, Bourne shell, C, C++, C#, Cabal, Chef, CMake, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dockerfile, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua, Markdown, MATLAB, Mercury, NASM, Nix, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Object, Raku, OS X and iOS property lists, Pug (formerly Jade), Puppet, Python, QML, R, Racket, RDF TriG, RDF Turtle, Relax NG, reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Solidity, Sphinx, SQL, Stylus, Tcl, TeX, Texinfo, Twig, TypeScript, Verilog, VHDL, Vim help, VimL, Vue.js, xHtml, XML, XSLT, XQuery, YACC, YAML, YANG data models, YARA rules, z80, Zope page templates, and Zsh. See the [manual][checkers] for details about the corresponding supported checkers (:help syntastic-checkers in Vim).

A number of third-party Vim plugins also provide checkers for syntastic, for example: [merlin][merlin], [omnisharp-vim][omnisharp], [rust.vim][rust], [syntastic-extras][myint], [syntastic-more][roktas], [tsuquyomi][tsuquyomi], [vim-crystal][crystal], [vim-eastwood][eastwood], and [vim-swift][swift].

Below is a screenshot showing the methods that Syntastic uses to display syntax errors. Note that, in practise, you will only have a subset of these methods enabled.

![Screenshot 1][screenshot]

  1. Errors are loaded into the location list for the corresponding window.
  2. When the cursor is on a line containing an error, the error message is echoed in the command window.
  3. Signs are placed beside lines with errors - note that warnings are displayed in a different color.
  4. There is a configurable statusline flag you can include in your statusline config.
  5. Hover the mouse over a line containing an error and the error message is displayed as a balloon.
  6. (not shown) Highlighting errors with syntax highlighting. Erroneous parts of lines can be highlighted.

<a name="installation"></a>

3. Installation

<a name="requirements"></a>

3.1. Requirements

Syntastic itself has rather relaxed requirements: it doesn't have any external dependencies, and it needs a version of [Vim][vim] compiled with a few common features: autocmd, eval, file_in_path, modify_fname, quickfix, reltime, statusline, and user_commands. Not all possible combinations of features that include the ones above make equal sense on all operating systems, but Vim version 7 or later with the "normal", "big", or "huge" feature sets should be fine.

Syntastic should work with any modern plugin managers for Vim, such as [NeoBundle][neobundle], [Pathogen][pathogen], [Vim-Addon-Manager][vam], [Vim-Plug][plug], or [Vundle][vundle]. Instructions for installing syntastic with [Pathogen][pathogen] are included below for completeness.

Starting with Vim version 7.4.1486 you can also load syntastic using the standard mechanism of packages, without the help of third-party plugin managers (see :help packages in Vim for details). Beware however that, while support for packages has been added in Vim 7.4.1384, the functionality needed by syntastic is present only in versions 7.4.1486 and later.

Last but not least: syntastic doesn't know how to do any syntax checks by itself. In order to get meaningful results you need to install external checkers corresponding to the types of files you use. Please consult the [manual][checkers] (:help syntastic-checkers in Vim) for a list of supported checkers.

<a name="installpathogen"></a>

3.2. Installing syntastic with Pathogen

If you already have [Pathogen][pathogen] working then skip Step 1 and go to Step 2.

<a name="step1"></a>

3.2.1. Step 1: Install pathogen.vim

First I'll show you how to install Tim Pope's [Pathogen][pathogen] so that it's easy to install syntastic. Do this in your terminal so that you get the pathogen.vim file and the directories it needs:

mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim

Next you need to add this to your ~/.vimrc:

execute pathogen#infect()

<a name="step2"></a>

3.2.2. Step 2: Install syntastic as a Pathogen bundle

You now have pathogen installed and can put syntastic into ~/.vim/bundle like this:

cd ~/.vim/bundle && \
git clone --depth=1 https://github.com/vim-syntastic/syntastic.git

Quit vim and start it back up to reload it, then type:

:Helptags

If you get an error when you do this, then you probably didn't install [Pathogen][pathogen] right. Go back to Step 1 and make sure you did the following:

  1. Created both the ~/.vim/autoload and ~/.vim/bundle directories.
  2. Added the execute pathogen#infect() line to your ~/.vimrc file
  3. Did the git clone of syntastic inside ~/.vim/bundle
  4. Have permissions to access all of these directories.

<a name="settings"></a>

4. Recommended settings

Syntastic has numerous options that can be configured, and the defaults are not particularly well suitable for new users. It is recommended that you start by adding the following lines to your vimrc file, and return to them after reading the manual (see :help syntastic in Vim):

set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check

Related Skills

View on GitHub
GitHub Stars11.2k
CategoryDevelopment
Updated1h ago
Forks1.1k

Languages

Vim script

Security Score

100/100

Audited on Mar 28, 2026

No findings