Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 589 lines (483 sloc) 22.386 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588
*syntastic.txt* Syntax checking on the fly has never been so pimp.
*syntastic*


                    It's a bird! It's a plane! ZOMG It's ... ~

                   _____ __ __ _ ~
                  / ___/__ ______ / /_____ ______/ /_(_)____ ~
                  \__ \/ / / / __ \/ __/ __ `/ ___/ __/ / ___/ ~
                 ___/ / /_/ / / / / /_/ /_/ (__ ) /_/ / /__ ~
                /____/\__, /_/ /_/\__/\__,_/____/\__/_/\___/ ~
                     /____/ ~



                              Reference Manual~


==============================================================================
CONTENTS *syntastic-contents*

    1.Intro...................................|syntastic-intro|
    2.Functionality provided..................|syntastic-functionality|
        2.1.The statusline flag...............|syntastic-statusline-flag|
        2.2.Error signs.......................|syntastic-error-signs|
        2.3.Error window......................|syntastic-error-window|
    3.Commands................................|syntastic-commands|
    4.Options.................................|syntastic-options|
    5.Writing syntax checkers.................|syntastic-syntax-checkers|
    6.About...................................|syntastic-about|
    7.Changelog...............................|syntastic-changelog|
    8.Credits.................................|syntastic-credits|
    9.License.................................|syntastic-license|


==============================================================================
1. Intro *syntastic-intro*

Syntastic is a syntax checking plugin that runs files through external syntax
checkers. This can be done on demand, or automatically as files are saved and
opened. 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.

Syntastic comes in two parts: the syntax checker plugins, and the core script
(i.e. syntastic.vim). The syntax checker plugins are defined on a per-filetype
basis where each one wraps up an external syntax checking program. The core
script delegates off to these plugins and uses their output to provide the
syntastic functionality. At the time of this writing, syntax checking plugins
exist for c, coffee, cpp, css, cucumber, cuda, docbk, erlang, eruby, fortran,
go, haml, haskell, html, javascript, less, lua, matlab, perl, php, puppet,
python, ruby, sass/scss, sh, tcl, tex, vala, xhtml, xml, xslt, zpt

Take a look in the syntax_checkers directory for the most up to date list.

If your language is not supported then see |syntastic-syntax-checkers| for
details on how to implement a syntax checking plugin, and be sure to send me a
patch ;-)

This plugin is currently only recommended for *nix users. It is functional on
Windows, but since the syntax checking plugins shell out, the command window
briefly appears whenever one is executed.


==============================================================================
2. Functionality provided *syntastic-functionality*

Syntax checking can be done automatically or on demand (see
|'syntastic_mode_map'| for configuring this).

When syntax checking is done, the features below can be used to notify the
user of errors. See |syntastic-options| for how to configure and
activate/deactivate these features.

    * A configurable statusline flag
    * Lines with errors can have |signs| placed beside them - where a different
      sign is used for errors and warnings.
    * A |location-list| can be displayed with error messages for erroneous
      buffers.
    * Offending parts of lines can be highlighted (this functionality is only
      provided by some syntax checkers).
    * Balloons (if compiled in) can be used to display error messages for
      erroneous lines when hovering the mouse over them.


Note: This functionality is only available if a syntax checker plugin is
present for the filetype of the buffer in question. See
|syntastic-syntax-checkers| for details.

------------------------------------------------------------------------------
2.1. The statusline flag *syntastic-statusline-flag*

To use the statusline flag, this must appear in your |'statusline'| setting >
    %{SyntasticStatuslineFlag()}
<
Something like this could be more useful: >
    set statusline+=%#warningmsg#
    set statusline+=%{SyntasticStatuslineFlag()}
    set statusline+=%*
<
When syntax errors are detected a flag will be shown. The content of the flag
is derived from the |syntastic_stl_format| option
------------------------------------------------------------------------------
2.2. Error signs *syntastic-error-signs*

Syntastic uses the |:sign| commands to mark lines with errors and warnings in
the sign column. To enable this feature, use the |'syntastic_enable_signs'|
option.

------------------------------------------------------------------------------
2.3. The error window *:Errors* *syntastic-error-window*

You can use the :Errors command to display the errors for the current buffer
in the |location-list|.

Note that when you use :Errors, the current location list is overwritten with
Syntastic's own location list.


==============================================================================
3. Commands *syntastic-commands*

:Errors *:SyntasticErrors*

When errors have been detected, use this command to pop up the |location-list|
and display the error messages.


:SyntasticToggleMode *:SyntasticToggleMode*

Toggles syntastic between active and passive mode. See |'syntastic_mode_map'|
for more info.


:SyntasticCheck *:SyntasticCheck*

Manually cause a syntax check to be done. Useful in passive mode, or if the
current filetype is set to passive. See |'syntastic_mode_map'| for more info.


==============================================================================
4. Options *syntastic-options*


                                                   *'syntastic_check_on_open'*
Default: 0
If enabled, syntastic will do syntax checks when buffers are first loaded as
well as on saving >
    let g:syntastic_check_on_open=1
<

                                              *'syntastic_echo_current_error'*
Default: 1
If enabled, syntastic will error message associated with the current line to
the command window. If multiple errors are found, the first will be used. >
    let g:syntastic_echo_current_error=1
<

                                                    *'syntastic_enable_signs'*
Default: 1
Use this option to tell syntastic whether to use the |:sign| interface to mark
syntax errors: >
    let g:syntastic_enable_signs=1
<

                   *'syntastic_error_symbol'* *'syntastic_style_error_symbol'*
               *'syntastic_warning_symbol'* *'syntastic_style_warning_symbol'*
Use this option to control what the syntastic |:sign| text contains. Several
error symobls can be customized:
    syntastic_error_symbol - For syntax errors, defaults to '>>'
    syntastic_style_error_symbol - For style errors, defaults to 'S>'
    syntastic_warning_symbol - For syntax warnings, defaults to '>>'
    syntastic_style_warning_symbol - For style warnings, defaults to 'S>'

Example: >
    let g:syntastic_error_symbol='✗'
    let g:syntastic_warning_symbol='⚠'
<

                                                 *'syntastic_enable_balloons'*
Default: 1
Use this option to tell syntastic whether to display error messages in balloons
when the mouse is hovered over erroneous lines: >
    let g:syntastic_enable_balloons = 1
<
Note that vim must be compiled with |+balloon_eval|.

                                            *'syntastic_enable_highlighting'*
Default: 1
Use this option to tell syntastic whether to use syntax highlighting to mark
errors (where possible). Highlighting can be turned off with the following >
    let g:syntastic_enable_highlighting = 0
<

                                                       *'syntastic_auto_jump'*
Default: 0
Enable this option if you want the cursor to jump to the first detected error
when saving or opening a file: >
    let g:syntastic_auto_jump=1
<

                                                   *'syntastic_auto_loc_list'*
Default: 2
Use this option to tell syntastic to automatically open and/or close the
|location-list| (see |syntastic-error-window|).

When set to 0 the error window will not be opened or closed automatically. >
    let g:syntastic_auto_loc_list=0
<

When set to 1 the error window will be automatically opened when errors are
detected, and closed when none are detected. >
    let g:syntastic_auto_loc_list=1
<
When set to 2 the error window will be automatically closed when no errors are
detected, but not opened automatically. >
    let g:syntastic_auto_loc_list=2
<

                                                 *'syntastic_loc_list_height'*
Default: 10
Use this option to specify the height of the location lists that syntastic
opens. >
    let g:syntastic_loc_list_height=5
<


                                                        *'syntastic_mode_map'*
Default: { "mode": "active",
           "active_filetypes": [],
           "passive_filetypes": [] }

Use this option to fine tune when automatic syntax checking is done (or not
done).

The option should be set to something like: >

    let g:syntastic_mode_map = { 'mode': 'active',
                               \ 'active_filetypes': ['ruby', 'php'],
                               \ 'passive_filetypes': ['puppet'] }
<

"mode" can be mapped to one of two values - "active" or "passive". When set to
active, syntastic does automatic checking whenever a buffer is saved or
initially opened. When set to "passive" syntastic only checks when the user
calls :SyntasticCheck.

The exceptions to these rules are defined with "active_filetypes" and
"passive_filetypes". In passive mode, automatic checks are still done
for all filetypes in the "active_filetypes" array. In active mode,
automatic checks are not done for any filetypes in the
"passive_filetypes" array.

At runtime, the |:SyntasticToggleMode| command can be used to switch between
active and passive mode.

If any of "mode", "active_filetypes", or "passive_filetypes" are not specified
then they will default to their default value as above.

                                                  *'syntastic_quiet_warnings'*

Use this option if you only care about syntax errors, not warnings. When set,
this option has the following effects:
    * no |signs| appear unless there is at least one error, whereupon both
      errors and warnings are displayed
    * the |'syntastic_auto_loc_list'| option only pops up the error window if
      there's at least one error, whereupon both errors and warnings are
      displayed
>
    let g:syntastic_quiet_warnings=1
<

                                                      *'syntastic_stl_format'*

Default: [Syntax: line:%F (%t)]
Use this option to control what the syntastic statusline text contains. Several
magic flags are availble to insert information:
    %e - number of errors
    %w - number of warnings
    %t - total number of warnings and errors
    %fe - line number of first error
    %fw - line number of first warning
    %F - line number of first warning or error

Several additional flags are available to hide text under certain conditions:
    %E{...} - hide the text in the brackets unless there are errors
    %W{...} - hide the text in the brackets unless there are warnings
    %B{...} - hide the text in the brackets unless there are both warnings AND
              errors
These flags cant be nested.

Example: >
    let g:syntastic_stl_format = '[%E{Err: %fe #%e}%B{, }%W{Warn: %fw #%w}]'
<
If this format is used and the current buffer has 5 errors and 1 warning
starting on lines 20 and 10 respectively then this would appear on the
statusline: >
    [Err: 20 #5, Warn: 10 #1]
<
If the buffer had 2 warnings, starting on line 5 then this would appear: >
    [Warn: 5 #2]
<


==============================================================================
5. Writing syntax checkers *syntastic-syntax-checkers*


A syntax checker plugin is really nothing more than a single function. You
should define them in ~/.vim/syntax_checkers/<filetype>.vim, but this is
purely for convenience; Syntastic doesn't actually care where these functions
are defined.

A syntax checker plugin must define a function of the form:
>
    SyntaxCheckers_<filetype>_GetLocList()
<
The output of this function must be of the same format as that returned by
the |getloclist()| function. See |getloclist()| and |getqflist()| for
details.

To achieve this, the function should call |SyntasticMake()| or shell out to a
syntax checker, parse the output and munge it into the format.

There are several syntax checker plugins provided with this plugin. The ruby
one is a good example of |SyntasticMake()|, while the haml one is a good
example of how to create the data structure manually.


SyntasticMake({options}) *SyntasticMake()*
    {options} must be a dictionary. It can contain "makeprg" and "errorformat"
    as keys (both optional).

    SyntasticMake will run |:lmake| with the given |'makeprg'| and
    |'errorformat'| (using the current settings if none are supplied). It will
    store the resulting error list and use it to provide all of the
    |syntastic-functionality|. The previous makeprg and errorformat settings
    will then be restored, as well as the location list for the window. From
    the user's perspective, it will be as though |:lmake| was never run.

    Note that the given "makeprg" and "errorformat" will be set using |:let-&|,
    so you should not escape spaces.


==============================================================================
6. About *syntastic-about*

The author of syntastic is a mighty wild stallion, hear him roar! >
     _ _ _____ _____ ___ ___ ___ ____ _ _ _
    | \ | | ____| ____|_ _|_ _|_ _/ ___| | | | |
    | \| | _| | _| | | | | | | | _| |_| | |
    | |\ | |___| |___ | | | | | | |_| | _ |_|
    |_| \_|_____|_____|___|___|___\____|_| |_(_)

<
He likes to trot around in the back yard reading his emails and sipping a
scalding hot cup of Earl Grey. Email him at martin.grenfell at gmail dot com.
He can also be found trolling the #vim channel on the freenode IRC network as
scrooloose.

Bug reports, feedback, suggestions etc are welcomed.


The latest official releases will be on vim.org at some point.

The latest dev versions are on github
    http://github.com/scrooloose/syntastic

==============================================================================
7. Changelog *syntastic-changelog*

2.3.0
    - Add syntastic_loc_list_height option
    - Allow errors to have a "subtype" that is signed differently to standard
      errors. Currently geared towards differentiating style errors from
      syntax errors. Currently implemented for phpcs (technosophos).
    - New checkers for:
        - yaml
        - haxe (davidB)
        - ocaml (edwintorok)
        - pylint (parantapa)
        - rust (cjab)

    - Updates to existing checkers:
        - jslint
        - jshint (gillesruppert)
        - fortran (bmattern)
        - sass
        - html (darcyparker)
        - coffee (darcyparker)
        - docbk (darcyparker)
        - xml
        - xslt
        - less (irrationalfab)
        - php (AD7six, technosophos)
        - cuda
        - python (mitchellh, pneff)
        - perl (Anthony Carapetis)
        - c (naoina, zsprackett)
        - puppet (frimik)

2.2.0
    - only do syntax checks when files are saved (not when first opened) - add
      g:syntastic_check_on_open option to get the old behavior back
    - bug fix with echoing error messages; fixes incompatability with cmd-t (datanoise)
    - dont allow warnings to mask errors when signing/echoing errors (ashikase)
    - auto close location list when leaving buffer. (millermedeiros)
    - update errors appropriately when :SyntasticToggleMode is called
    - updates/fixes to existing checkers:
        - javascript/jshint (millermedeiros)
        - javascript/jslint
        - c (kongo2002)
    - Support for new filetypes:
        - JSON (millermedeiros, tocer)
        - rst (reStructuredText files) (JNRowe)
        - gentoo-metadata (JNRowe)


2.1.0
    - when the cursor is on a line containing an error, echo the
      error msg (kevinw)
    - various bug fixes and refactoring
    - updates/fixes to existing checkers:
        - html (millermedeiros)
        - erlang
        - coffeescript
        - javascript
        - sh
        - php (add support for phpcs - technosophos)
    - add an applescript checker (Zhai Cai)
    - add support for hyphenated filetypes (JNRowe)

2.0.0
    - Add support for highlighting the erroneous parts of lines (kstep)
    - Add support for displaying errors via balloons (kstep)
    - Add syntastic_mode_map option to give more control over when checking
      should be done.
    - Add :SyntasticCheck command to force a syntax check - useful in passive
      mode (justone).
    - Add the option to automatically close the location list, but not
      automatically open it (milkypostman)
    - Add syntastic_auto_jump option to automatically jump to the first
      error (milkypostman)
    - Only source syntax checkers as needed - instead of loading all of them
      when vim starts

    - Support for new filetypes:
        - less (julienXX)
        - docbook (tpope)
        - matlab (jasongraham)
        - go (dtjm)
        - puppet (uggedal, roman, zsprackett)
        - haskell (baldo, roman)
        - tcl (et)
        - vala (kstep)
        - cuda (temporaer)
        - css (oryband, sitedyno)
        - fortran (Karl Yngve Lervåg)
        - xml (kusnier)
        - xslt (kusnier)
        - erlang (kTT)
        - zpt (claytron)

    - updates to existing checkers:
        - javascript (mogren, bryanforbes, cjab, ajduncan)
        - sass/scss (tmm1, atourino, dlee, epeli)
        - ruby (changa)
        - perl (harleypig)
        - haml (bmihelac)
        - php (kstep, docteurklein)
        - python (kstep, soli)
        - lua (kstep)
        - html (kstep)
        - xhtml (kstep)
        - c (kongo2002, brandonw)
        - cpp (kongo2002)
        - coffee (industrial)
        - eruby (sergevm)

1.2.0
    - New syntax checkers from github:kongo2002
      - c (thanks also to github:jperras)
      - cpp
      - lua
      - sh (thanks also to github:jmcantrell)
    - add coffee syntax checked by github:lstoll
    - add tex syntax checker
    - make html checker play nicer with html5, thanks to github:enaeseth
    - escape filenames properly when invoking syntax checkers, thanks to
      github:jmcantrell
    - adjust the ruby syntax checker to avoid some common annoying warnings,
      thanks to github:robertwahler

1.1.0 [codenamed: tpimp]
    - Dont load rubygems for ruby/eruby syntax checkers. Thanks tpope.
    - Improve the javascript syntax checker to catch some warnings that were
      getting missed. Thanks tpope.
    - Dont automatically focus the error window. Thanks tpope.
    - Add support for cucumber [tpope], haskell & perl [Anthony Carapetis],
      and xhtml
    - Add commands to enable/disable syntax checking at runtime. See :help
      syntastic-commands.
    - Add an option to specifiy syntax checkers that should be disabled by
      default. See :help syntastic_disabled_filetypes.
    - Dont use :signs if vim wasnt compiled with support for them.
)

==============================================================================
8. Credits *syntastic-credits*

Thanks to the following people for testing, bug reports, patches etc. They own,
hard.

    Mikael Fridh (frimik)
    Patrice Neff (pneff )
    Gilles Ruppert (gillesruppert)
    Naoya INADA (naoina)
    Mitchell Hashimoto (mitchellh)
    irrationalfab
    Andy Dawson (AD7six)
    Parantapa Bhattacharya (parantapa)
    edwintorok
    Darcy Parker (darcyparker)
    bmattern
    David Bernard (davidB)
    Aleksey V. Zapparov (ixti)
    Benji Fisher (benjifisher)
    Lance Fetters (ashikase)
    datanoise
    Giuseppe Rota (grota)
    tocer
    James Rowe (JNRowe)
    Zhai Cai
    Matt Butcher (technosophos)
    Kevin Watters (kevinw)
    Miller Medeiros (millermedeiros)
    Pawel Salata (kTT)
    Fjölnir Ásgeirsson (aptiva)
    Clayton Parker (claytron)
    S. Zachariah Sprackett (zsprackett)
    Sylvain Soliman (soli)
    Ricardo Catalinas Jiménez (jimenezrick)
    kusnier
    Klein Florian (docteurklein)
    sitedyno
    Matthew Batema (mlb-)
    Nate Jones (justone)
    sergevm
    Karl Yngve Lervåg
    Pavel Argentov (argent-smith)
    Andy Duncan (ajduncan)
    Antonio Touriño (atourino)
    Chad Jablonski (cjab)
    Roman Gonzalez (roman)
    Tom Wieland (industrial)
    Ory Band (oryband)
    Esa-Matti Suuronen (epeli)
    Brandon Waskiewicz (brandonw)
    dlee
    temporaer
    Jason Graham (jasongraham)
    Sam Nguyen (dtjm)
    Claes Mogren (mogren)
    Eivind Uggedal (uggedal)
    kstep
    Andreas Baldeau (baldo)
    Eric Thomas (et)
    Brian Donovan (eventualbuddha)
    Bryan Forbes (bryanforbes)
    Aman Gupta (tmm1)
    Donald Ephraim Curtis (milkypostman)
    Dominique Rose-Rosette (changa)
    Harley Pig (harleypig)
    bmihelac
    Julien Blanchard (julienXX)
    Gregor Uhlenheuer (kongo2002)
    Lincoln Stoll
    Tim Carey-Smith (halorgium)
    Tim Pope (tpope)
    Travis Jeffery
    Anthony Carapetis


==============================================================================
9. License *syntastic-license*

Syntastic is released under the wtfpl.
See http://sam.zoy.org/wtfpl/COPYING.
Something went wrong with that request. Please try again.