1
0

syntastic.txt 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956
  1. *syntastic.txt* Syntax checking on the fly has never been so pimp.
  2. *syntastic*
  3. It's a bird! It's a plane! ZOMG It's ... ~
  4. _____ __ __ _ ~
  5. / ___/__ ______ / /_____ ______/ /_(_)____ ~
  6. \__ \/ / / / __ \/ __/ __ `/ ___/ __/ / ___/ ~
  7. ___/ / /_/ / / / / /_/ /_/ (__ ) /_/ / /__ ~
  8. /____/\__, /_/ /_/\__/\__,_/____/\__/_/\___/ ~
  9. /____/ ~
  10. Reference Manual~
  11. ==============================================================================
  12. CONTENTS *syntastic-contents*
  13. 1.Intro........................................|syntastic-intro|
  14. 1.1.Quick start............................|syntastic-quickstart|
  15. 1.2.Recommended settings...................|syntastic-recommended|
  16. 2.Functionality provided.......................|syntastic-functionality|
  17. 2.1.The statusline flag....................|syntastic-statusline-flag|
  18. 2.2.Error signs............................|syntastic-error-signs|
  19. 2.3.Error window...........................|syntastic-error-window|
  20. 2.4.Error highlighting.....................|syntastic-highlighting|
  21. 2.5.Aggregating errors.....................|syntastic-aggregating-errors|
  22. 2.6.Filtering errors.......................|syntastic-filtering-errors|
  23. 3.Commands.....................................|syntastic-commands|
  24. 4.Global Options...............................|syntastic-global-options|
  25. 5.Checker Options..............................|syntastic-checker-options|
  26. 5.1.Choosing which checkers to use.........|syntastic-filetype-checkers|
  27. 5.2.Choosing the executable................|syntastic-config-exec|
  28. 5.3.Configuring specific checkers..........|syntastic-config-makeprg|
  29. 5.4.Sorting errors.........................|syntastic-config-sort|
  30. 6.Notes........................................|syntastic-notes|
  31. 6.1.Handling of composite filetypes........|syntastic-composite|
  32. 6.2.Editing files over network.............|syntastic-netrw|
  33. 6.3.The 'shellslash' option................|syntastic-shellslash|
  34. 7.Compatibility with other software............|syntastic-compatibility|
  35. 7.1.The csh and tcsh shells................|syntastic-csh|
  36. 7.2.Eclim..................................|syntastic-eclim|
  37. 7.3.The fish shell.........................|syntastic-fish|
  38. 7.4.The fizsh shell........................|syntastic-fizsh|
  39. 7.5.powerline..............................|syntastic-powerline|
  40. 7.6.The PowerShell shell...................|syntastic-powershell|
  41. 7.7.python-mode............................|syntastic-pymode|
  42. 7.8.vim-auto-save..........................|syntastic-vim-auto-save|
  43. 7.9.vim-go.................................|syntastic-vim-go|
  44. 7.10.vim-virtualenv........................|syntastic-vim-virtualenv|
  45. 7.11.YouCompleteMe.........................|syntastic-ycm|
  46. 8.About........................................|syntastic-about|
  47. 9.License......................................|syntastic-license|
  48. ==============================================================================
  49. 1. Intro *syntastic-intro*
  50. Syntastic is a syntax checking plugin that runs files through external syntax
  51. checkers. This can be done on demand, or automatically as files are saved and
  52. opened. If syntax errors are detected, the user is notified and is happy
  53. because they didn't have to compile their code or execute their script to find
  54. them.
  55. Syntastic comes in two parts: the syntax checker plugins, and the core. The
  56. syntax checker plugins are defined on a per-filetype basis where each one wraps
  57. up an external syntax checking program. The core script delegates off to these
  58. plugins and uses their output to provide the syntastic functionality.
  59. Take a look at the wiki for a list of supported filetypes and checkers:
  60. https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers
  61. Note: This doc only deals with using syntastic. To learn how to write syntax
  62. checker integrations, see the guide on the GitHub wiki:
  63. https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide
  64. ------------------------------------------------------------------------------
  65. 1.1. Quick start *syntastic-quickstart*
  66. Syntastic comes preconfigured with a default list of enabled checkers per
  67. filetype. This list is kept reasonably short to prevent slowing down Vim or
  68. trying to use conflicting checkers.
  69. You can see the list of checkers available for the current filetype with the
  70. |:SyntasticInfo| command.
  71. You probably want to override the configured list of checkers for the
  72. filetypes you use, and also change the arguments passed to specific checkers
  73. to suit your needs. See |syntastic-checker-options| below for details.
  74. Use |:SyntasticCheck| to manually check right now. Use |:Errors| to open the
  75. |location-list| window, and |:lclose| to close it. You can clear the error
  76. list with |:SyntasticReset|, and you can use |:SyntasticToggleMode| to switch
  77. between active (checking on writing the buffer) and passive (manual) checking.
  78. You don't have to switch focus to the |location-list| window to jump to the
  79. different errors. Vim provides several built-in commands for this, for
  80. example |:lnext| and |:lprevious|. You may want to add shortcut mappings for
  81. these commands, or perhaps install a plugin such as Tim Pope's 'unimpaired'
  82. (see https://github.com/tpope/vim-unimpaired) that provides such mappings.
  83. ------------------------------------------------------------------------------
  84. 1.2. Recommended settings *syntastic-recommended*
  85. Syntastic has a large number of options that can be configured, and the
  86. defaults are not particularly well suitable for new users. It is recommended
  87. that you start by adding the following lines to your vimrc, and return to them
  88. later as needed: >
  89. set statusline+=%#warningmsg#
  90. set statusline+=%{SyntasticStatuslineFlag()}
  91. set statusline+=%*
  92. let g:syntastic_always_populate_loc_list = 1
  93. let g:syntastic_auto_loc_list = 1
  94. let g:syntastic_check_on_open = 1
  95. let g:syntastic_check_on_wq = 0
  96. <
  97. ==============================================================================
  98. 2. Functionality provided *syntastic-functionality*
  99. Syntax checking can be done automatically or on demand (see
  100. |'syntastic_mode_map'| and |:SyntasticToggleMode| for configuring this).
  101. When syntax checking is done, the features below can be used to notify the
  102. user of errors. See |syntastic-global-options| for how to configure and
  103. activate/deactivate these features.
  104. * A statusline flag
  105. * Signs beside lines with errors
  106. * The |location-list| can be populated with the errors for the associated
  107. buffer
  108. * Erroneous parts of lines can be highlighted (this functionality is only
  109. provided by some syntax checkers)
  110. * Balloons (if the |+balloon_eval| feature is compiled in) can be used to
  111. display error messages for erroneous lines when hovering the mouse over
  112. them
  113. * Error messages from multiple checkers can be aggregated in a single list
  114. ------------------------------------------------------------------------------
  115. 2.1. The statusline flag *syntastic-statusline-flag*
  116. To use the statusline flag, this must appear in your |'statusline'| setting >
  117. %{SyntasticStatuslineFlag()}
  118. <
  119. Something like this could be more useful: >
  120. set statusline+=%#warningmsg#
  121. set statusline+=%{SyntasticStatuslineFlag()}
  122. set statusline+=%*
  123. <
  124. When syntax errors are detected a flag will be shown. The content of the flag
  125. is derived from the |syntastic_stl_format| option.
  126. ------------------------------------------------------------------------------
  127. 2.2. Error signs *syntastic-error-signs*
  128. Syntastic uses the |:sign| commands to mark lines with errors and warnings in
  129. the sign column. To enable this feature, use the |'syntastic_enable_signs'|
  130. option.
  131. Signs are colored using the Error and Todo syntax highlight groups by default.
  132. If you wish to customize the colors for the signs, you can use the following
  133. groups:
  134. SyntasticErrorSign - For syntax errors, links to 'error' by default
  135. SyntasticWarningSign - For syntax warnings, links to 'todo' by default
  136. SyntasticStyleErrorSign - For style errors, links to 'SyntasticErrorSign'
  137. by default
  138. SyntasticStyleWarningSign - For style warnings, links to
  139. 'SyntasticWarningSign' by default
  140. Example: >
  141. highlight SyntasticErrorSign guifg=white guibg=red
  142. <
  143. To set up highlighting for the line where a sign resides, you can use the
  144. following highlight groups:
  145. SyntasticErrorLine
  146. SyntasticWarningLine
  147. SyntasticStyleErrorLine - Links to 'SyntasticErrorLine' by default
  148. SyntasticStyleWarningLine - Links to 'SyntasticWarningLine' by default
  149. Example: >
  150. highlight SyntasticErrorLine guibg=#2f0000
  151. <
  152. ------------------------------------------------------------------------------
  153. 2.3. The error window *syntastic-error-window*
  154. You can use the |:Errors| command to display the errors for the current buffer
  155. in the |location-list|.
  156. Note that when you use |:Errors| the current location list is overwritten with
  157. Syntastic's own location list. The location list is also overwritten when
  158. |syntastic_auto_jump| is non-zero and the cursor has to jump to an issue.
  159. By default syntastic doesn't fill the |location-list| with the errors found by
  160. the checkers, in order to reduce clashes with other plugins. Consequently, if
  161. you run |:lopen| or |:lwindow| rather than |:Errors| to open the error window you
  162. wouldn't see syntastic's list of errors. If you insist on using |:lopen| or
  163. |:lwindow| you should either run |:SyntasticSetLoclist| after running the checks,
  164. or set |syntastic_always_populate_loc_list| which tells syntastic to update the
  165. |location-list| automatically.
  166. ------------------------------------------------------------------------------
  167. 2.4. Error highlighting *syntastic-highlighting*
  168. Some checkers provide enough information for syntastic to be able to highlight
  169. errors. By default the SpellBad syntax highlight group is used to color errors,
  170. and the SpellCap group is used for warnings. If you wish to customize the
  171. colors for highlighting you can use the following groups:
  172. SyntasticError - Links to 'SpellBad' by default
  173. SyntasticWarning - Links to 'SpellCap' by default
  174. SyntasticStyleError - Links to SyntasticError by default
  175. SyntasticStyleWarning - Links to SyntasticWarning by default
  176. Example: >
  177. highlight SyntasticError guibg=#2f0000
  178. <
  179. ------------------------------------------------------------------------------
  180. 2.5. Aggregating errors *syntastic-aggregating-errors*
  181. By default, namely if |'syntastic_aggregate_errors'| is unset, syntastic runs
  182. in turn the checkers corresponding to the filetype of the current file (see
  183. |syntastic-filetype-checkers|), and stops as soon as a checker reports any
  184. errors. It then notifies you of the errors using the notification mechanisms
  185. above. In this mode error lists are always produced by a single checker, and,
  186. if you open the error window, the name of the checker that generated the errors
  187. is shown on the statusline of the error window.
  188. If |'syntastic_aggregate_errors'| is set, syntastic runs all checkers that
  189. apply (still cf. |syntastic-filetype-checkers|), then aggregates errors found
  190. by all checkers in a single list, and notifies you. In this mode each error
  191. message is labeled with the name of the checker that generated it, but you can
  192. disable generation of these labels by turning off '|syntastic_id_checkers|'.
  193. If |'syntastic_sort_aggregated_errors'| is set (which is the default), messages
  194. in the aggregated list are grouped by file, then sorted by line number, then
  195. type, then column number. Otherwise messages produced by the same checker are
  196. grouped together, and sorting within each group is decided by the variables
  197. |'syntastic_<filetype>_<checker>_sort'|.
  198. ------------------------------------------------------------------------------
  199. 2.6 Filtering errors *syntastic-filtering-errors*
  200. You can selectively disable some of the errors found by checkers either
  201. using |'syntastic_quiet_messages'|, or by specifying a list of patterns in
  202. |'syntastic_ignore_files'|.
  203. See also: |'syntastic_<filetype>_<checker>_quiet_messages'|.
  204. ==============================================================================
  205. 3. Commands *syntastic-commands*
  206. :Errors *:Errors*
  207. When errors have been detected, use this command to pop up the |location-list|
  208. and display the error messages.
  209. Please note that the |:Errors| command overwrites the current location list with
  210. syntastic's own location list.
  211. :SyntasticToggleMode *:SyntasticToggleMode*
  212. Toggles syntastic between active and passive mode. See |'syntastic_mode_map'|
  213. for more info.
  214. :SyntasticCheck *:SyntasticCheck*
  215. Manually cause a syntax check to be done. By default the checkers in the
  216. |'g:syntastic_<filetype>_checkers'| or |'b:syntastic_checkers'| lists are run,
  217. cf. |syntastic-filetype-checkers|. If |syntastic_aggregate_errors| is unset
  218. (which is the default), checking stops the first time a checker reports any
  219. errors; if |syntastic_aggregate_errors| is set, all checkers that apply are run
  220. in turn, and all errors found are aggregated in a single list.
  221. The command may be followed by a (space separated) list of checkers. In this
  222. case |'g:syntastic_<filetype>_checkers'| and |'b:syntastic_checkers'| are
  223. ignored, and the checkers named by the command's arguments are run instead, in
  224. the order specified. The rules of |syntastic_aggregate_errors| still apply.
  225. Example: >
  226. :SyntasticCheck flake8 pylint
  227. <
  228. :SyntasticInfo *:SyntasticInfo*
  229. The command takes an optional argument, and outputs information about the
  230. checkers available for the filetype named by said argument, or for the current
  231. filetype if no argument was provided.
  232. :SyntasticReset *:SyntasticReset*
  233. Resets the list of errors and turns off all error notifiers.
  234. :SyntasticSetLoclist *:SyntasticSetLoclist*
  235. If |'syntastic_always_populate_loc_list'| is not set, the |location-list| is
  236. not filled in automatically with the list of errors detected by the checkers.
  237. This is useful if you run syntastic along with other plugins that use location
  238. lists. The |:SyntasticSetLoclist| command allows you to stick the errors into
  239. the location list explicitly.
  240. ==============================================================================
  241. 4. Global Options *syntastic-global-options*
  242. *'syntastic_check_on_open'*
  243. Default: 0
  244. If enabled, syntastic will do syntax checks when buffers are first loaded as
  245. well as on saving >
  246. let g:syntastic_check_on_open = 1
  247. <
  248. *'syntastic_check_on_wq'*
  249. Default: 1
  250. Normally syntastic runs syntax checks whenever buffers are written to disk.
  251. If you want to skip these checks when you issue |:wq|, |:x|, and |:ZZ|, set this
  252. variable to 0. >
  253. let g:syntastic_check_on_wq = 0
  254. <
  255. *'syntastic_aggregate_errors'*
  256. Default: 0
  257. When enabled, syntastic runs all checkers that apply to the current filetype,
  258. then aggregates errors found by all checkers and displays them. When disabled,
  259. syntastic runs each checker in turn, and stops to display the results the first
  260. time a checker finds any errors. >
  261. let g:syntastic_aggregate_errors = 1
  262. <
  263. *'syntastic_id_checkers'*
  264. Default: 1
  265. When results from multiple checkers are aggregated in a single error list
  266. (that is either when |syntastic_aggregate_errors| is enabled, or when checking
  267. a file with a composite filetype), it might not be immediately obvious which
  268. checker has produced a given error message. This variable instructs syntastic
  269. to label error messages with the names of the checkers that created them. >
  270. let g:syntastic_id_checkers = 0
  271. <
  272. *'syntastic_sort_aggregated_errors'*
  273. Default: 1
  274. By default, when results from multiple checkers are aggregated in a single
  275. error list (that is either when |syntastic_aggregate_errors| is enabled, or
  276. when checking a file with a composite filetype), errors are grouped by file,
  277. then sorted by line number, then grouped by type (namely errors take precedence
  278. over warnings), then they are sorted by column number. If you want to leave
  279. messages grouped by checker output, set this variable to 0. >
  280. let g:syntastic_sort_aggregated_errors = 0
  281. <
  282. *'syntastic_echo_current_error'*
  283. Default: 1
  284. If enabled, syntastic will echo current error to the command window. If
  285. multiple errors are found on the same line, |syntastic_cursor_columns| is used
  286. to decide which one is shown. >
  287. let g:syntastic_echo_current_error = 1
  288. <
  289. *'syntastic_cursor_columns'*
  290. Default: 1
  291. This option controls which errors are echoed to the command window if
  292. |syntastic_echo_current_error| is set and multiple errors are found on the same
  293. line. When the option is enabled, the first error corresponding to the current
  294. column is show. Otherwise, the first error on the current line is echoed,
  295. regardless of the cursor position on the current line.
  296. When dealing with very large lists of errors, disabling this option can speed
  297. up navigation significantly: >
  298. let g:syntastic_cursor_column = 0
  299. <
  300. *'syntastic_enable_signs'*
  301. Default: 1
  302. Use this option to tell syntastic whether to use the |:sign| interface to mark
  303. syntax errors: >
  304. let g:syntastic_enable_signs = 1
  305. <
  306. *'syntastic_error_symbol'* *'syntastic_style_error_symbol'*
  307. *'syntastic_warning_symbol'* *'syntastic_style_warning_symbol'*
  308. Use this option to control what the syntastic |:sign| text contains. Several
  309. error symbols can be customized:
  310. syntastic_error_symbol - For syntax errors, defaults to '>>'
  311. syntastic_style_error_symbol - For style errors, defaults to 'S>'
  312. syntastic_warning_symbol - For syntax warnings, defaults to '>>'
  313. syntastic_style_warning_symbol - For style warnings, defaults to 'S>'
  314. Example: >
  315. let g:syntastic_error_symbol = "✗"
  316. let g:syntastic_warning_symbol = "⚠"
  317. <
  318. *'syntastic_enable_balloons'*
  319. Default: 1
  320. Use this option to tell syntastic whether to display error messages in balloons
  321. when the mouse is hovered over erroneous lines: >
  322. let g:syntastic_enable_balloons = 1
  323. <
  324. Note that Vim must be compiled with |+balloon_eval|.
  325. *'syntastic_enable_highlighting'*
  326. Default: 1
  327. Use this option to tell syntastic whether to use syntax highlighting to mark
  328. errors (where possible). Highlighting can be turned off with the following >
  329. let g:syntastic_enable_highlighting = 0
  330. <
  331. *'syntastic_always_populate_loc_list'*
  332. Default: 0
  333. Enable this option to tell syntastic to always stick any detected errors into
  334. the |location-list|: >
  335. let g:syntastic_always_populate_loc_list = 1
  336. <
  337. *'syntastic_auto_jump'*
  338. Default: 0
  339. Enable this option if you want the cursor to jump to the first detected issue
  340. when saving or opening a file.
  341. When set to 0 the cursor won't jump automatically. >
  342. let g:syntastic_auto_jump = 0
  343. <
  344. When set to 1 the cursor will always jump to the first issue detected,
  345. regardless of type. >
  346. let g:syntastic_auto_jump = 1
  347. <
  348. When set to 2 the cursor will jump to the first issue detected, but only if
  349. this issue is an error. >
  350. let g:syntastic_auto_jump = 2
  351. <
  352. When set to 3 the cursor will jump to the first error detected, if any. If
  353. all issues detected are warnings, the cursor won't jump. >
  354. let g:syntastic_auto_jump = 3
  355. <
  356. *'syntastic_auto_loc_list'*
  357. Default: 2
  358. Use this option to tell syntastic to automatically open and/or close the
  359. |location-list| (see |syntastic-error-window|).
  360. When set to 0 the error window will not be opened or closed automatically. >
  361. let g:syntastic_auto_loc_list = 0
  362. <
  363. When set to 1 the error window will be automatically opened when errors are
  364. detected, and closed when none are detected. >
  365. let g:syntastic_auto_loc_list = 1
  366. <
  367. When set to 2 the error window will be automatically closed when no errors are
  368. detected, but not opened automatically. >
  369. let g:syntastic_auto_loc_list = 2
  370. <
  371. *'syntastic_loc_list_height'*
  372. Default: 10
  373. Use this option to specify the height of the location lists that syntastic
  374. opens. >
  375. let g:syntastic_loc_list_height = 5
  376. <
  377. *'syntastic_ignore_files'*
  378. Default: []
  379. Use this option to specify files that syntastic should never check. It's a
  380. list of |regular-expression| patterns. The full paths of files (see |::p|) are
  381. matched against these patterns, and the matches are case sensitive. Use |\c|
  382. to specify case insensitive patterns. Example: >
  383. let g:syntastic_ignore_files = ['\m^/usr/include/', '\m\c\.h$']
  384. <
  385. *'syntastic_filetype_map'*
  386. Default: {}
  387. Use this option to map non-standard filetypes to standard ones. Corresponding
  388. checkers are mapped accordingly, which allows syntastic to check files with
  389. non-standard filetypes: >
  390. let g:syntastic_filetype_map = {
  391. \ "latex": "tex",
  392. \ "gentoo-metadata": "xml" }
  393. <
  394. Composite filetypes can also be mapped to simple types, which disables the
  395. default behaviour of running both checkers against the input file: >
  396. let g:syntastic_filetype_map = { "handlebars.html": "handlebars" }
  397. <
  398. *'syntastic_mode_map'*
  399. Default: { "mode": "active",
  400. "active_filetypes": [],
  401. "passive_filetypes": [] }
  402. Use this option to fine tune when automatic syntax checking is done (or not
  403. done).
  404. The option should be set to something like: >
  405. let g:syntastic_mode_map = {
  406. \ "mode": "active",
  407. \ "active_filetypes": ["ruby", "php"],
  408. \ "passive_filetypes": ["puppet"] }
  409. <
  410. "mode" can be mapped to one of two values - "active" or "passive". When set
  411. to "active", syntastic does automatic checking whenever a buffer is saved or
  412. initially opened. When set to "passive" syntastic only checks when the user
  413. calls |:SyntasticCheck|.
  414. The exceptions to these rules are defined with "active_filetypes" and
  415. "passive_filetypes". In passive mode, automatic checks are still done for
  416. filetypes in the "active_filetypes" array (and "passive_filetypes" is
  417. ignored). In active mode, automatic checks are not done for any filetypes in
  418. the "passive_filetypes" array ("active_filetypes" is ignored).
  419. If any of "mode", "active_filetypes", or "passive_filetypes" are left
  420. unspecified, they default to values above.
  421. If local variable |'b:syntastic_mode'| is defined its value takes precedence
  422. over all calculations involving |'syntastic_mode_map'| for the corresponding
  423. buffer.
  424. At runtime, the |:SyntasticToggleMode| command can be used to switch between
  425. active and passive modes.
  426. *'b:syntastic_mode'*
  427. Default: unset
  428. Only the local form |'b:syntastic_mode'| is used. When set to either "active"
  429. or "passive", it takes precedence over |'syntastic_mode_map'| when deciding
  430. whether the corresponding buffer should be checked automatically.
  431. *'syntastic_quiet_messages'*
  432. Default: {}
  433. Use this option to filter out some of the messages produced by checkers. The
  434. option should be set to something like: >
  435. let g:syntastic_quiet_messages = {
  436. \ "!level": "errors",
  437. \ "type": "style",
  438. \ "regex": '\m\[C03\d\d\]',
  439. \ "file:p": ['\m^/usr/include/', '\m\c\.h$'] }
  440. <
  441. Each element turns off messages matching the patterns specified by the
  442. corresponding value. Values are lists, but if a list consist of a single
  443. element you may omit the brackets (e.g. you may write "style" instead of
  444. ["style"]). Elements with values [] or '' are ignored (this is useful for
  445. overriding filters, cf. |filter-overrides|).
  446. "level" - takes one of two values, "warnings" or "errors"
  447. "type" - can be either "syntax" or "style"
  448. "regex" - is matched against the messages' text as a case insensitive
  449. |regular-expression|
  450. "file" - is matched against the filenames the messages refer to, as a
  451. case sensitive |regular-expression|.
  452. If a key is prefixed by an exclamation mark "!", the corresponding filter is
  453. negated (i.e. the above example silences all messages that are NOT errors).
  454. The "file" key may be followed by one or more filename modifiers (see
  455. |filename-modifiers|). The modifiers are applied to the filenames the messages
  456. refer to before matching against the value (i.e. in the above example the full
  457. path of the issues are matched against '\m^/usr/include/' and '\m\c\.h$').
  458. If |'syntastic_id_checkers'| is set, filters are applied before error messages
  459. are labeled with the names of the checkers that created them.
  460. There are also checker-specific variants of this option, providing finer
  461. control. They are named |'syntastic_<filetype>_<checker>_quiet_messages'|.
  462. For a particular checker, if both a |'syntastic_quiet_messages'| filter and
  463. a checker-specific filter are present, they are both applied (to the list of
  464. errors produced by the said checker). In case of conflicting values for the
  465. same keys, the values of the checker-specific filters take precedence.
  466. *filter-overrides*
  467. Since filter elements with values [] or '' are ignored, you can disable global
  468. filters for particular checkers, by setting the values of the corresponding
  469. elements in |'syntastic_<filetype>_<checker>_quiet_messages'| to [] or ''. For
  470. example, the following setting will silence all warnings, except for the
  471. ones produced by "pylint": >
  472. let g:syntastic_quiet_messages = { "level": "warnings" }
  473. let g:syntastic_python_pylint_quiet_messages = { "level" : [] }
  474. <
  475. *'syntastic_stl_format'*
  476. Default: [Syntax: line:%F (%t)]
  477. Use this option to control what the syntastic statusline text contains. Several
  478. magic flags are available to insert information:
  479. %e - number of errors
  480. %w - number of warnings
  481. %t - total number of warnings and errors
  482. %fe - line number of first error
  483. %fw - line number of first warning
  484. %F - line number of first warning or error
  485. Several additional flags are available to hide text under certain conditions:
  486. %E{...} - hide the text in the brackets unless there are errors
  487. %W{...} - hide the text in the brackets unless there are warnings
  488. %B{...} - hide the text in the brackets unless there are both warnings AND
  489. errors
  490. These flags can't be nested.
  491. Example: >
  492. let g:syntastic_stl_format = '[%E{Err: %fe #%e}%B{, }%W{Warn: %fw #%w}]'
  493. <
  494. If this format is used and the current buffer has 5 errors and 1 warning
  495. starting on lines 20 and 10 respectively then this would appear on the
  496. statusline: >
  497. [Err: 20 #5, Warn: 10 #1]
  498. <
  499. If the buffer had 2 warnings, starting on line 5 then this would appear: >
  500. [Warn: 5 #2]
  501. <
  502. *'b:syntastic_skip_checks'*
  503. Default: unset
  504. Only the local form |'b:syntastic_skip_checks'| is used. When set to a true
  505. value, no checks are run against the corresponding buffer. Example: >
  506. let b:syntastic_skip_checks = 1
  507. <
  508. *'syntastic_full_redraws'*
  509. Default: 0 in GUI Vim and MacVim, 1 otherwise
  510. Controls whether syntastic calls |:redraw| or |:redraw!| for screen redraws.
  511. Changing it can in principle make screen redraws smoother, but it can also
  512. cause screen to flicker, or cause ghost characters. Leaving it to the default
  513. should be safe.
  514. *'syntastic_exit_checks'*
  515. Default: 0 when running under "cmd.exe" on Windows, 1 otherwise
  516. Syntastic attempts to catch abnormal termination conditions from checkers by
  517. looking at their exit codes. The "cmd.exe" shell on Windows make these checks
  518. meaningless, by returning 1 to Vim when the checkers exit with non-zero codes.
  519. The above variable can be used to disable exit code checks in syntastic.
  520. *'syntastic_shell'*
  521. Default: Vim's 'shell'
  522. This is the (full path to) the shell syntastic will use to run the checkers.
  523. On UNIX and Mac OS-X this shell must accept Bourne-compatible syntax for
  524. file "stdout" and "stderr" redirections ">file" and "2>file". Examples of
  525. compatible shells are "zsh", "bash", "ksh", and of course the original Bourne
  526. "sh".
  527. This shell is independent of Vim's 'shell', and it isn't used for interactive
  528. operations. It must take care to initialize all environment variables needed
  529. by the checkers you're using. Example: >
  530. let g:syntastic_shell = "/bin/sh"
  531. <
  532. *'syntastic_debug'*
  533. Default: 0
  534. Set this to the sum of one or more of the following flags to enable
  535. debugging:
  536. 1 - trace general workflow
  537. 2 - dump location lists
  538. 4 - trace notifiers
  539. 8 - trace autocommands
  540. 16 - dump options
  541. 32 - trace running of specific checkers
  542. Example: >
  543. let g:syntastic_debug = 1
  544. <
  545. Syntastic will then add debugging messages to Vim's |message-history|. You can
  546. examine these messages with |:mes|.
  547. *'syntastic_debug_file'*
  548. Default: unset
  549. When set, debugging messages are written to the file named by its value, in
  550. addition to being added to Vim's |message-history|: >
  551. let g:syntastic_debug_file = '~/syntastic.log'
  552. <
  553. *'syntastic_extra_filetypes'*
  554. Default: []
  555. List of filetypes handled by checkers external to syntastic. If you have a Vim
  556. plugin that adds a checker for syntastic, and if the said checker deals with a
  557. filetype that is unknown to syntastic, you might consider adding that filetype
  558. to this list: >
  559. let g:syntastic_extra_filetypes = [ "make", "gitcommit" ]
  560. <
  561. This will allow |:SyntasticInfo| to do proper tab completion for the new
  562. filetypes.
  563. ==============================================================================
  564. 5. Checker Options *syntastic-checker-options*
  565. ------------------------------------------------------------------------------
  566. 5.1 Choosing which checkers to use *syntastic-filetype-checkers*
  567. *'g:syntastic_<filetype>_checkers'*
  568. You can tell syntastic which checkers to run for a given filetype by setting a
  569. variable 'g:syntastic_<filetype>_checkers' to a list of checkers, e.g. >
  570. let g:syntastic_php_checkers = ["php", "phpcs", "phpmd"]
  571. <
  572. *'b:syntastic_checkers'*
  573. There is also a per-buffer version of this setting, 'b:syntastic_checkers'.
  574. When set, it takes precedence over |'g:syntastic_<filetype>_checkers'|. You can
  575. use this in an autocmd to configure specific checkers for particular paths: >
  576. autocmd FileType python if stridx(expand("%:p"), "/some/path/") == 0 |
  577. \ let b:syntastic_checkers = ["pylint"] | endif
  578. <
  579. If neither |'g:syntastic_<filetype>_checkers'| nor |'b:syntastic_checkers'|
  580. is set, a default list of checker is used. Beware however that this list
  581. deliberately kept minimal, for performance reasons.
  582. Take a look at the wiki to find out what checkers and filetypes are supported
  583. by syntastic:
  584. https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers
  585. Use |:SyntasticInfo| to see which checkers are available for a given filetype.
  586. ------------------------------------------------------------------------------
  587. 5.2 Choosing the executable *syntastic-config-exec*
  588. *'syntastic_<filetype>_<checker>_exec'*
  589. The executable run by a checker is normally defined automatically, when the
  590. checker is registered. You can however override it, by setting the variable
  591. 'g:syntastic_<filetype>_<checker>_exec': >
  592. let g:syntastic_ruby_mri_exec = '~/bin/ruby2'
  593. <
  594. This variable has a local version, 'b:syntastic_<filetype>_<checker>_exec',
  595. which takes precedence over the global one in the corresponding buffer.
  596. *'b:syntastic_<checker>_exec'*
  597. And there is also a local variable named 'b:syntastic_<checker>_exec', which
  598. takes precedence over both 'b:syntastic_<filetype>_<checker>_exec' and
  599. 'g:syntastic_<filetype>_<checker>_exec' in the buffers where it is defined.
  600. ------------------------------------------------------------------------------
  601. 5.3 Configuring specific checkers *syntastic-config-makeprg*
  602. Most checkers use the 'makeprgBuild()' function and provide many options by
  603. default - in fact you can customise every part of the command that gets called.
  604. *'syntastic_<filetype>_<checker>_<option>'*
  605. Checkers that use 'makeprgBuild()' construct a 'makeprg' like this: >
  606. let makeprg = self.makeprgBuild({
  607. \ "exe": self.getExec(),
  608. \ "args": "-a -b -c",
  609. \ "post_args": "--more --args",
  610. \ "tail": "2>/dev/null" })
  611. <
  612. The result is a 'makeprg' of the form: >
  613. <exe> <args> <fname> <post_args> <tail>
  614. <
  615. All arguments above are optional, and can be overridden by setting global
  616. variables 'g:syntastic_<filetype>_<checker-name>_<option-name>' - even
  617. parameters not specified in the call to makeprgBuild(). These variables also
  618. have local versions 'b:syntastic_<filetype>_<checker-name>_<option-name>',
  619. which take precedence over the global ones in the corresponding buffers.
  620. If one of these variables has a non-empty default and you want it to be empty,
  621. you can set it to an empty string, e.g.: >
  622. let g:syntastic_javascript_jslint_args = ""
  623. <
  624. *'syntastic_<filetype>_<checker>_exe'*
  625. The 'exe' is normally the same as the 'exec' attribute described above, in
  626. which case it may be omitted. However, you can use it to add environment
  627. variables, or to change the way the checker is run. For example this setup
  628. allows you to run PC-Lint under Wine emulation on Linux: >
  629. let g:syntastic_c_pc_lint_exec = "wine"
  630. let g:syntastic_c_pc_lint_exe = "wine c:/path/to/lint-nt.exe"
  631. <
  632. To override the args and the tail: >
  633. let g:syntastic_c_pc_lint_args = "-w5 -Iz:/usr/include/linux"
  634. let g:syntastic_c_pc_lint_tail = "2>/dev/null"
  635. <
  636. The general form of the override options is: >
  637. syntastic_<filetype>_<checker>_<option-name>
  638. <
  639. For checkers that do not use the 'makeprgBuild()' function you will have to
  640. look at the source code of the checker in question. If there are specific
  641. options that can be set, these are usually documented in the wiki:
  642. https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers
  643. *'syntastic_<filetype>_<checker>_quiet_messages'*
  644. In the same vein, 'g:syntastic_<filetype>_<checker-name>_quiet_messages' can
  645. be used to restrict message filters to messages produced by specific checkers.
  646. Example: >
  647. let g:syntastic_python_pylama_quiet_messages = {
  648. \ "type": "style",
  649. \ "regex": '\m\[C03\d\d\]' }
  650. <
  651. See |syntastic_quiet_messages| for the syntax.
  652. ------------------------------------------------------------------------------
  653. 5.4 Sorting errors *syntastic-config-sort*
  654. *'syntastic_<filetype>_<checker>_sort'*
  655. Syntastic may decide to group the errors produced by some checkers by file,
  656. then sort them by line number, then by type, then by column number. If you'd
  657. prefer to see the errors in the order in which they are output by the external
  658. checker you can set the variable |'g:syntastic_<filetype>_<checker>_sort'| to 0.
  659. Alternatively, if syntastic doesn't reorder the errors produced by a checker
  660. but you'd like it to sort them, you can set the same variable to 1.
  661. There is also a local version |'b:syntastic_<filetype>_<checker>_sort'| of
  662. this variable, that takes precedence over it in the buffers where it is
  663. defined.
  664. For aggregated lists (see |syntastic-aggregating-errors|) these variables are
  665. ignored if |syntastic_sort_aggregated_errors| is set (which is the default).
  666. ==============================================================================
  667. 6. Notes *syntastic-notes*
  668. ------------------------------------------------------------------------------
  669. 6.1. Handling of composite filetypes *syntastic-composite*
  670. Some Vim plugins use composite filetypes, such as "django.python" or
  671. "handlebars.html". Normally, syntastic deals with this situation by splitting
  672. the filetype in its simple components, and calling all checkers that apply.
  673. If this behaviour is not desirable, you can disable it by mapping the
  674. composite filetypes to a simple ones using |syntastic_filetype_map|, e.g.: >
  675. let g:syntastic_filetype_map = { "handlebars.html": "handlebars" }
  676. <
  677. ------------------------------------------------------------------------------
  678. 6.2 Editing files over network *syntastic-netrw*
  679. The standard plugin |netrw| allows Vim to transparently edit files over
  680. network and inside archives. Currently syntastic doesn't support this mode
  681. of operation. It can only check files that can be accessed directly by local
  682. checkers, without any translation or conversion.
  683. ------------------------------------------------------------------------------
  684. 6.3 The 'shellslash' option *syntastic-shellslash*
  685. The 'shellslash' option is relevant only on Windows systems. This option
  686. determines (among other things) the rules for quoting command lines, and there
  687. is no easy way for syntastic to make sure its state is appropriate for your
  688. shell. It should be turned off if your 'shell' (or |g:syntastic_shell|) is
  689. "cmd.exe", and on for shells that expect an UNIX-like syntax, such as Cygwin's
  690. "sh". Most checkers will stop working if 'shellslash' is set to the wrong
  691. value.
  692. ==============================================================================
  693. 7. Compatibility with other software *syntastic-compatibility*
  694. ------------------------------------------------------------------------------
  695. 7.1 The csh and tcsh shells *syntastic-csh*
  696. The "csh" and "tcsh" shells are mostly compatible with syntastic. However,
  697. some checkers assume Bourne shell syntax for redirecting "stderr". For this
  698. reason, you should point |g:syntastic_shell| to a Bourne-compatible shell,
  699. such as "zsh", "bash", "ksh", or even the original Bourne "sh": >
  700. let g:syntastic_shell = "/bin/sh"
  701. <
  702. ------------------------------------------------------------------------------
  703. 7.2. Eclim *syntastic-eclim*
  704. Syntastic can be used together with "Eclim" (see http://eclim.org/). However,
  705. by default Eclim disables syntastic's checks for the filetypes it supports, in
  706. order to run its own validation. If you'd prefer to use Eclim but still run
  707. syntastic's checks, set |g:EclimFileTypeValidate| to 0: >
  708. let g:EclimFileTypeValidate = 0
  709. <
  710. It is also possible to re-enable syntastic checks only for some filetypes, and
  711. run Eclim's validation for others. Please consult Eclim's documentation for
  712. details.
  713. ------------------------------------------------------------------------------
  714. 7.3 The fish shell *syntastic-fish*
  715. At the time of this writing the "fish" shell (see http://fishshell.com/)
  716. doesn't support the standard UNIX syntax for file redirections, and thus it
  717. can't be used together with syntastic. You can however set |g:syntastic_shell|
  718. to a more traditional shell, such as "zsh", "bash", "ksh", or even the
  719. original Bourne "sh": >
  720. let g:syntastic_shell = "/bin/sh"
  721. <
  722. ------------------------------------------------------------------------------
  723. 7.4. The fizsh shell *syntastic-fizsh*
  724. Using syntastic with the "fizsh" shell (see https://github.com/zsh-users/fizsh)
  725. is possible, but potentially problematic. In order to do it you'll need to set
  726. 'shellredir' like this: >
  727. set shellredir=>%s\ 2>&1
  728. <
  729. Please keep in mind however that Vim can't take advantage of any of the
  730. interactive features of "fizsh". Using a more traditional shell such as "zsh",
  731. "bash", "ksh", or the original Bourne "sh" might be a better choice: >
  732. let g:syntastic_shell = "/bin/sh"
  733. <
  734. ------------------------------------------------------------------------------
  735. 7.5. powerline *syntastic-powerline*
  736. The "powerline" Vim plugin (https://github.com/powerline/powerline) comes
  737. packaged with a syntastic segment. To customize this segment create a file
  738. ~/.config/powerline/themes/vim/default.json, with a content like this: >
  739. {
  740. "segment_data" : {
  741. "powerline.segments.vim.plugin.syntastic.syntastic" : {
  742. "args" : {
  743. "err_format" : "Err: {first_line} #{num} ",
  744. "warn_format" : "Warn: {first_line} #{num} "
  745. }
  746. }
  747. }
  748. }
  749. <
  750. ------------------------------------------------------------------------------
  751. 7.6. The PowerShell shell *syntastic-powershell*
  752. At the time of this writing, syntastic is not compatible with using "Windows
  753. PowerShell" (http://technet.microsoft.com/en-us/library/bb978526.aspx) as Vim's
  754. 'shell'. You may still run Vim from 'PowerShell', but you do have to point
  755. Vim's 'shell' to a more traditional program, such as "cmd.exe": >
  756. set shell=cmd.exe
  757. <
  758. ------------------------------------------------------------------------------
  759. 7.7 python-mode *syntastic-pymode*
  760. Syntastic can be used along with the "python-mode" Vim plugin (see
  761. https://github.com/klen/python-mode). However, they both run syntax checks by
  762. default when you save buffers to disk, and this is probably not what you want.
  763. To avoid both plugins opening error windows, you can either set passive mode
  764. for python in syntastic (see |syntastic_mode_map|), or disable lint checks in
  765. "python-mode", by setting |pymode_lint_write| to 0. E.g.: >
  766. let g:pymode_lint_write = 0
  767. <
  768. ------------------------------------------------------------------------------
  769. 7.8. vim-auto-save *syntastic-vim-auto-save*
  770. Syntastic can be used together with the "vim-auto-save" Vim plugin (see
  771. https://github.com/907th/vim-auto-save). However, syntastic checks in active
  772. mode only work with "vim-auto-save" version 0.1.7 or later.
  773. ------------------------------------------------------------------------------
  774. 7.9. vim-go *syntastic-vim-go*
  775. The "vim-go" Vim plugin (https://github.com/fatih/vim-go) uses |quickfix|
  776. lists, and thus doesn't conflict with syntastic (which uses |location-list|
  777. lists). However, both "vim-go" and syntastic run syntax checks by default
  778. when you save buffers to disk, and this can have confusing results. To
  779. avoid both plugins opening error windows, you can either set passive
  780. mode for go in syntastic (see |syntastic_mode_map|), or prevent "vim-go"
  781. from showing a quickfix window when |g:go_fmt_command| fails, by setting
  782. |g:go_fmt_fail_silently| to 1. E.g.: >
  783. let g:go_fmt_fail_silently = 1
  784. <
  785. ------------------------------------------------------------------------------
  786. 7.10. vim-virtualenv *syntastic-vim-virtualenv*
  787. At the time of this writing, syntastic can't run checkers installed
  788. in Python virtual environments activated by "vim-virtualenv" (see
  789. https://github.com/jmcantrell/vim-virtualenv). This is a limitation of
  790. "vim-virtualenv".
  791. ------------------------------------------------------------------------------
  792. 7.11 YouCompleteMe *syntastic-ycm*
  793. Syntastic can be used together with the "YouCompleteMe" Vim plugin (see
  794. http://valloric.github.io/YouCompleteMe/). However, by default "YouCompleteMe"
  795. disables syntastic's checkers for the "c", "cpp", "objc", and "objcpp"
  796. filetypes, in order to allow its own checkers to run. If you want to use YCM's
  797. identifier completer but still run syntastic's checkers for those filetypes you
  798. have to set |ycm_show_diagnostics_ui| to 0. E.g.: >
  799. let g:ycm_show_diagnostics_ui = 0
  800. <
  801. ==============================================================================
  802. 8. About *syntastic-about*
  803. The core maintainers of syntastic are:
  804. Martin Grenfell (GitHub: scrooloose)
  805. Gregor Uhlenheuer (GitHub: kongo2002)
  806. LCD 047 (GitHub: lcd047)
  807. Find the latest version of syntastic at:
  808. http://github.com/scrooloose/syntastic
  809. ==============================================================================
  810. 9. License *syntastic-license*
  811. Syntastic is released under the WTFPL.
  812. See http://sam.zoy.org/wtfpl/COPYING.
  813. vim:tw=78:sw=4:ft=help:norl: