Syntastic
Syntax checking hacks for vim
Install / Use
/learn @vim-syntastic/SyntasticREADME
,
/ \,,_ .'|
,{{| /}}}}/_.' _____________________________________________
}}}}` '{{' '. / \
{{{{{ _ ;, \ / Ladies and Gentlemen, \
,}}}}}} /o`\ ` ;) | |
{{{{{{ / ( | this is ... |
}}}}}} | \ | |
{{{{{{{{ \ \ | |
}}}}}}}}} '.__ _ | | _____ __ __ _ |
{{{{{{{{ /`._ (_\ / | / ___/__ ______ / /_____ ______/ /_(_)____ |
}}}}}}' | //___/ --=: \__ \/ / / / __ \/ __/ __ `/ ___/ __/ / ___/ |
jgs `{{{{` | '--' | ___/ / /_/ / / / / /_/ /_/ (__ ) /_/ / /__ |
}}}` | /____/\__, /_/ /_/\__/\__,_/____/\__/_/\___/ |
| /____/ |
| /
\_____________________________________________/
- Deprecation note
- Introduction
- Installation
3.1. Requirements
3.2. Installing syntastic with Pathogen - Recommended settings
- 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:lopenor:lwindowand 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:quitthe current buffer but not when I:bdeleteit?
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. Theperlchecker has stopped working...
5.14. What happened to therustcchecker?
5.15. What happened to thetscchecker?
5.16. What happened to thexcrunchecker?
5.17. What happened to thevalacchecker?
5.18. What happened to the Julialintchecker? - 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]
- Errors are loaded into the location list for the corresponding window.
- When the cursor is on a line containing an error, the error message is echoed in the command window.
- Signs are placed beside lines with errors - note that warnings are displayed in a different color.
- There is a configurable statusline flag you can include in your statusline config.
- Hover the mouse over a line containing an error and the error message is displayed as a balloon.
- (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:
- Created both the
~/.vim/autoloadand~/.vim/bundledirectories. - Added the
execute pathogen#infect()line to your~/.vimrcfile - Did the
git cloneof syntastic inside~/.vim/bundle - 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
node-connect
338.7kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
338.7kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.6kCommit, push, and open a PR
