1 *syntastic.txt* Syntax checking on the fly has never been so pimp.
5 It's a bird! It's a plane! ZOMG It's ... ~
8 / ___/__ ______ / /_____ ______/ /_(_)____ ~
9 \__ \/ / / / __ \/ __/ __ `/ ___/ __/ / ___/ ~
10 ___/ / /_/ / / / / /_/ /_/ (__ ) /_/ / /__ ~
11 /____/\__, /_/ /_/\__/\__,_/____/\__/_/\___/ ~
19 ==============================================================================
20 CONTENTS *syntastic-contents*
22 1.Intro...................................|syntastic-intro|
23 2.Functionality provided..................|syntastic-functionality|
24 2.1.The statusline flag...............|syntastic-statusline-flag|
25 2.2.Error signs.......................|syntastic-error-signs|
26 2.3.Error window......................|syntastic-error-window|
27 3.Commands................................|syntastic-commands|
28 4.Options.................................|syntastic-options|
29 5.Writing syntax checkers.................|syntastic-syntax-checkers|
30 6.About...................................|syntastic-about|
31 7.Changelog...............................|syntastic-changelog|
32 8.Credits.................................|syntastic-credits|
33 9.License.................................|syntastic-license|
36 ==============================================================================
37 1. Intro *syntastic-intro*
39 Syntastic is a syntax checking plugin that runs files through external syntax
40 checkers. This can be done on demand, or automatically as files are saved and
41 opened. If syntax errors are detected, the user is notified and is happy
42 because they didn't have to compile their code or execute their script to find
45 Syntastic comes in two parts: the syntax checker plugins, and the core script
46 (i.e. syntastic.vim). The syntax checker plugins are defined on a per-filetype
47 basis where each one wraps up an external syntax checking program. The core
48 script delegates off to these plugins and uses their output to provide the
49 syntastic functionality. At the time of this writing, syntax checking plugins
50 exist for c, coffee, cpp, css, cucumber, cuda, docbk, erlang, eruby, fortran,
51 go, haml, haskell, html, javascript, less, lua, matlab, perl, php, puppet,
52 python, ruby, sass/scss, sh, tcl, tex, vala, xhtml, xml, xslt, zpt
54 Take a look in the syntax_checkers directory for the most up to date list.
56 If your language is not supported then see |syntastic-syntax-checkers| for
57 details on how to implement a syntax checking plugin, and be sure to send me a
60 This plugin is currently only recommended for *nix users. It is functional on
61 Windows, but since the syntax checking plugins shell out, the command window
62 briefly appears whenever one is executed.
65 ==============================================================================
66 2. Functionality provided *syntastic-functionality*
68 Syntax checking can be done automatically or on demand (see
69 |'syntastic_mode_map'| for configuring this).
71 When syntax checking is done, the features below can be used to notify the
72 user of errors. See |syntastic-options| for how to configure and
73 activate/deactivate these features.
75 * A configurable statusline flag
76 * Lines with errors can have |signs| placed beside them - where a different
77 sign is used for errors and warnings.
78 * A |location-list| can be displayed with error messages for erroneous
80 * Offending parts of lines can be highlighted (this functionality is only
81 provided by some syntax checkers).
82 * Balloons (if compiled in) can be used to display error messages for
83 erroneous lines when hovering the mouse over them.
86 Note: This functionality is only available if a syntax checker plugin is
87 present for the filetype of the buffer in question. See
88 |syntastic-syntax-checkers| for details.
90 ------------------------------------------------------------------------------
91 2.1. The statusline flag *syntastic-statusline-flag*
93 To use the statusline flag, this must appear in your |'statusline'| setting >
94 %{SyntasticStatuslineFlag()}
96 Something like this could be more useful: >
97 set statusline+=%#warningmsg#
98 set statusline+=%{SyntasticStatuslineFlag()}
101 When syntax errors are detected a flag will be shown. The content of the flag
102 is derived from the |syntastic_stl_format| option
103 ------------------------------------------------------------------------------
104 2.2. Error signs *syntastic-error-signs*
106 Syntastic uses the |:sign| commands to mark lines with errors and warnings in
107 the sign column. To enable this feature, use the |'syntastic_enable_signs'|
110 ------------------------------------------------------------------------------
111 2.3. The error window *:Errors* *syntastic-error-window*
113 You can use the :Errors command to display the errors for the current buffer
114 in the |location-list|.
116 Note that when you use :Errors, the current location list is overwritten with
117 Syntastic's own location list.
120 ==============================================================================
121 3. Commands *syntastic-commands*
123 :Errors *:SyntasticErrors*
125 When errors have been detected, use this command to pop up the |location-list|
126 and display the error messages.
129 :SyntasticToggleMode *:SyntasticToggleMode*
131 Toggles syntastic between active and passive mode. See |'syntastic_mode_map'|
135 :SyntasticCheck *:SyntasticCheck*
137 Manually cause a syntax check to be done. Useful in passive mode, or if the
138 current filetype is set to passive. See |'syntastic_mode_map'| for more info.
141 ==============================================================================
142 4. Options *syntastic-options*
145 *'syntastic_check_on_open'*
147 If enabled, syntastic will do syntax checks when buffers are first loaded as
149 let g:syntastic_check_on_open=1
152 *'syntastic_echo_current_error'*
154 If enabled, syntastic will error message associated with the current line to
155 the command window. If multiple errors are found, the first will be used. >
156 let g:syntastic_echo_current_error=1
159 *'syntastic_enable_signs'*
161 Use this option to tell syntastic whether to use the |:sign| interface to mark
163 let g:syntastic_enable_signs=1
166 *'syntastic_enable_balloons'*
168 Use this option to tell syntastic whether to display error messages in balloons
169 when the mouse is hovered over erroneous lines: >
170 let g:syntastic_enable_balloons = 1
172 Note that vim must be compiled with |+balloon_eval|.
174 *'syntastic_enable_highlighting'*
176 Use this option to tell syntastic whether to use syntax highlighting to mark
177 errors (where possible). Highlighting can be turned off with the following >
178 let g:syntastic_enable_highlighting = 0
181 *'syntastic_auto_jump'*
183 Enable this option if you want the cursor to jump to the first detected error
184 when saving or opening a file: >
185 let g:syntastic_auto_jump=1
188 *'syntastic_auto_loc_list'*
190 Use this option to tell syntastic to automatically open and/or close the
191 |location-list| (see |syntastic-error-window|).
193 When set to 0 the error window will not be opened or closed automatically. >
194 let g:syntastic_auto_loc_list=0
197 When set to 1 the error window will be automatically opened when errors are
198 detected, and closed when none are detected. >
199 let g:syntastic_auto_loc_list=1
201 When set to 2 the error window will be automatically closed when no errors are
202 detected, but not opened automatically. >
203 let g:syntastic_auto_loc_list=2
206 *'syntastic_loc_list_height'*
208 Use this option to specify the height of the location lists that syntastic
210 let g:syntastic_loc_list_height=5
214 *'syntastic_mode_map'*
215 Default: { "mode": "active",
216 "active_filetypes": [],
217 "passive_filetypes": [] }
219 Use this option to fine tune when automatic syntax checking is done (or not
222 The option should be set to something like: >
224 let g:syntastic_mode_map = { 'mode': 'active',
225 \ 'active_filetypes': ['ruby', 'php'],
226 \ 'passive_filetypes': ['puppet'] }
229 "mode" can be mapped to one of two values - "active" or "passive". When set to
230 active, syntastic does automatic checking whenever a buffer is saved or
231 initially opened. When set to "passive" syntastic only checks when the user
232 calls :SyntasticCheck.
234 The exceptions to these rules are defined with "active_filetypes" and
235 "passive_filetypes". In passive mode, automatic checks are still done
236 for all filetypes in the "active_filetypes" array. In active mode,
237 automatic checks are not done for any filetypes in the
238 "passive_filetypes" array.
240 At runtime, the |:SyntasticToggleMode| command can be used to switch between
241 active and passive mode.
243 If any of "mode", "active_filetypes", or "passive_filetypes" are not specified
244 then they will default to their default value as above.
246 *'syntastic_quiet_warnings'*
248 Use this option if you only care about syntax errors, not warnings. When set,
249 this option has the following effects:
250 * no |signs| appear unless there is at least one error, whereupon both
251 errors and warnings are displayed
252 * the |'syntastic_auto_loc_list'| option only pops up the error window if
253 there's at least one error, whereupon both errors and warnings are
256 let g:syntastic_quiet_warnings=1
259 *'syntastic_stl_format'*
261 Default: [Syntax: line:%F (%t)]
262 Use this option to control what the syntastic statusline text contains. Several
263 magic flags are availble to insert information:
264 %e - number of errors
265 %w - number of warnings
266 %t - total number of warnings and errors
267 %fe - line number of first error
268 %fw - line number of first warning
269 %F - line number of first warning or error
271 Several additional flags are available to hide text under certain conditions:
272 %E{...} - hide the text in the brackets unless there are errors
273 %W{...} - hide the text in the brackets unless there are warnings
274 %B{...} - hide the text in the brackets unless there are both warnings AND
276 These flags cant be nested.
279 let g:syntastic_stl_format = '[%E{Err: %fe #%e}%B{, }%W{Warn: %fw #%w}]'
281 If this format is used and the current buffer has 5 errors and 1 warning
282 starting on lines 20 and 10 respectively then this would appear on the
284 [Err: 20 #5, Warn: 10 #1]
286 If the buffer had 2 warnings, starting on line 5 then this would appear: >
291 ==============================================================================
292 5. Writing syntax checkers *syntastic-syntax-checkers*
295 A syntax checker plugin is really nothing more than a single function. You
296 should define them in ~/.vim/syntax_checkers/<filetype>.vim, but this is
297 purely for convenience; Syntastic doesn't actually care where these functions
300 A syntax checker plugin must define a function of the form:
302 SyntaxCheckers_<filetype>_GetLocList()
304 The output of this function must be of the same format as that returned by
305 the |getloclist()| function. See |getloclist()| and |getqflist()| for
308 To achieve this, the function should call |SyntasticMake()| or shell out to a
309 syntax checker, parse the output and munge it into the format.
311 There are several syntax checker plugins provided with this plugin. The ruby
312 one is a good example of |SyntasticMake()|, while the haml one is a good
313 example of how to create the data structure manually.
316 SyntasticMake({options}) *SyntasticMake()*
317 {options} must be a dictionary. It can contain "makeprg" and "errorformat"
318 as keys (both optional).
320 SyntasticMake will run |:lmake| with the given |'makeprg'| and
321 |'errorformat'| (using the current settings if none are supplied). It will
322 store the resulting error list and use it to provide all of the
323 |syntastic-functionality|. The previous makeprg and errorformat settings
324 will then be restored, as well as the location list for the window. From
325 the user's perspective, it will be as though |:lmake| was never run.
327 Note that the given "makeprg" and "errorformat" will be set using |:let-&|,
328 so you should not escape spaces.
331 ==============================================================================
332 6. About *syntastic-about*
334 The author of syntastic is a mighty wild stallion, hear him roar! >
335 _ _ _____ _____ ___ ___ ___ ____ _ _ _
336 | \ | | ____| ____|_ _|_ _|_ _/ ___| | | | |
337 | \| | _| | _| | | | | | | | _| |_| | |
338 | |\ | |___| |___ | | | | | | |_| | _ |_|
339 |_| \_|_____|_____|___|___|___\____|_| |_(_)
342 He likes to trot around in the back yard reading his emails and sipping a
343 scolding hot cup of Earl Grey. Email him at martin.grenfell at gmail dot com.
344 He can also be found trolling the #vim channel on the freenode IRC network as
347 Bug reports, feedback, suggestions etc are welcomed.
350 The latest official releases will be on vim.org at some point.
352 The latest dev versions are on github
353 http://github.com/scrooloose/syntastic
355 ==============================================================================
356 7. Changelog *syntastic-changelog*
359 - Add syntastic_loc_list_height option
360 - Allow errors to have a "subtype" that is signed differently to standard
361 errors. Currently geared towards differentiating style errors from
362 syntax errors. Currently implemented for phpcs (technosophos).
370 - Updates to existing checkers:
372 - jshint (gillesruppert)
376 - coffee (darcyparker)
377 - docbk (darcyparker)
380 - less (irrationalfab)
381 - php (AD7six, technosophos)
383 - python (mitchellh, pneff)
384 - perl (Anthony Carapetis)
385 - c (naoina, zsprackett)
389 - only do syntax checks when files are saved (not when first opened) - add
390 g:syntastic_check_on_open option to get the old behavior back
391 - bug fix with echoing error messages; fixes incompatability with cmd-t (datanoise)
392 - dont allow warnings to mask errors when signing/echoing errors (ashikase)
393 - auto close location list when leaving buffer. (millermedeiros)
394 - update errors appropriately when :SyntasticToggleMode is called
395 - updates/fixes to existing checkers:
396 - javascript/jshint (millermedeiros)
399 - Support for new filetypes:
400 - JSON (millermedeiros, tocer)
401 - rst (reStructuredText files) (JNRowe)
402 - gentoo-metadata (JNRowe)
406 - when the cursor is on a line containing an error, echo the
408 - various bug fixes and refactoring
409 - updates/fixes to existing checkers:
410 - html (millermedeiros)
415 - php (add support for phpcs - technosophos)
416 - add an applescript checker (Zhai Cai)
417 - add support for hyphenated filetypes (JNRowe)
420 - Add support for highlighting the erroneous parts of lines (kstep)
421 - Add support for displaying errors via balloons (kstep)
422 - Add syntastic_mode_map option to give more control over when checking
424 - Add :SyntasticCheck command to force a syntax check - useful in passive
426 - Add the option to automatically close the location list, but not
427 automatically open it (milkypostman)
428 - Add syntastic_auto_jump option to automatically jump to the first
430 - Only source syntax checkers as needed - instead of loading all of them
433 - Support for new filetypes:
436 - matlab (jasongraham)
438 - puppet (uggedal, roman, zsprackett)
439 - haskell (baldo, roman)
443 - css (oryband, sitedyno)
444 - fortran (Karl Yngve Lervåg)
450 - updates to existing checkers:
451 - javascript (mogren, bryanforbes, cjab, ajduncan)
452 - sass/scss (tmm1, atourino, dlee, epeli)
456 - php (kstep, docteurklein)
457 - python (kstep, soli)
461 - c (kongo2002, brandonw)
463 - coffee (industrial)
467 - New syntax checkers from github:kongo2002
468 - c (thanks also to github:jperras)
471 - sh (thanks also to github:jmcantrell)
472 - add coffee syntax checked by github:lstoll
473 - add tex syntax checker
474 - make html checker play nicer with html5, thanks to github:enaeseth
475 - escape filenames properly when invoking syntax checkers, thanks to
477 - adjust the ruby syntax checker to avoid some common annoying warnings,
478 thanks to github:robertwahler
480 1.1.0 [codenamed: tpimp]
481 - Dont load rubygems for ruby/eruby syntax checkers. Thanks tpope.
482 - Improve the javascript syntax checker to catch some warnings that were
483 getting missed. Thanks tpope.
484 - Dont automatically focus the error window. Thanks tpope.
485 - Add support for cucumber [tpope], haskell & perl [Anthony Carapetis],
487 - Add commands to enable/disable syntax checking at runtime. See :help
489 - Add an option to specifiy syntax checkers that should be disabled by
490 default. See :help syntastic_disabled_filetypes.
491 - Dont use :signs if vim wasnt compiled with support for them.
494 ==============================================================================
495 8. Credits *syntastic-credits*
497 Thanks to the following people for testing, bug reports, patches etc. They own,
500 Mikael Fridh (frimik)
501 Patrice Neff (pneff )
502 Gilles Ruppert (gillesruppert)
504 Mitchell Hashimoto (mitchellh)
507 Parantapa Bhattacharya (parantapa)
509 Darcy Parker (darcyparker)
511 David Bernard (davidB)
512 Aleksey V. Zapparov (ixti)
513 Benji Fisher (benjifisher)
514 Lance Fetters (ashikase)
516 Giuseppe Rota (grota)
520 Matt Butcher (technosophos)
521 Kevin Watters (kevinw)
522 Miller Medeiros (millermedeiros)
524 Fjölnir Ásgeirsson (aptiva)
525 Clayton Parker (claytron)
526 S. Zachariah Sprackett (zsprackett)
527 Sylvain Soliman (soli)
528 Ricardo Catalinas Jiménez (jimenezrick)
530 Klein Florian (docteurklein)
532 Matthew Batema (mlb-)
536 Pavel Argentov (argent-smith)
537 Andy Duncan (ajduncan)
538 Antonio Touriño (atourino)
539 Chad Jablonski (cjab)
540 Roman Gonzalez (roman)
541 Tom Wieland (industrial)
543 Esa-Matti Suuronen (epeli)
544 Brandon Waskiewicz (brandonw)
547 Jason Graham (jasongraham)
549 Claes Mogren (mogren)
550 Eivind Uggedal (uggedal)
552 Andreas Baldeau (baldo)
554 Brian Donovan (eventualbuddha)
555 Bryan Forbes (bryanforbes)
557 Donald Ephraim Curtis (milkypostman)
558 Dominique Rose-Rosette (changa)
559 Harley Pig (harleypig)
561 Julien Blanchard (julienXX)
562 Gregor Uhlenheuer (kongo2002)
564 Tim Carey-Smith (halorgium)
570 ==============================================================================
571 9. License *syntastic-license*
573 Syntastic is released under the wtfpl.
574 See http://sam.zoy.org/wtfpl/COPYING.