PageRenderTime 48ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/bundle/syntastic-master/README.markdown

https://gitlab.com/wwitzel3/vim-config
Markdown | 252 lines | 196 code | 56 blank | 0 comment | 0 complexity | 0c4b61f5dd11836ae1d26580f5db341e MD5 | raw file
  1. ,
  2. / \,,_ .'|
  3. ,{{| /}}}}/_.' _____________________________________________
  4. }}}}` '{{' '. / \
  5. {{{{{ _ ;, \ / Ladies and Gentlemen, \
  6. ,}}}}}} /o`\ ` ;) | |
  7. {{{{{{ / ( | this is ... |
  8. }}}}}} | \ | |
  9. {{{{{{{{ \ \ | |
  10. }}}}}}}}} '.__ _ | | _____ __ __ _ |
  11. {{{{{{{{ /`._ (_\ / | / ___/__ ______ / /_____ ______/ /_(_)____ |
  12. }}}}}}' | //___/ --=: \__ \/ / / / __ \/ __/ __ `/ ___/ __/ / ___/ |
  13. jgs `{{{{` | '--' | ___/ / /_/ / / / / /_/ /_/ (__ ) /_/ / /__ |
  14. }}}` | /____/\__, /_/ /_/\__/\__,_/____/\__/_/\___/ |
  15. | /____/ |
  16. | /
  17. \_____________________________________________/
  18. - - -
  19. 1\. [Introduction](#introduction)
  20. 2\. [Installation](#installation)
  21. 3\. [FAQ](#faq)
  22. 4\. [Other resources](#otherresources)
  23. - - -
  24. <a name="introduction"></a>
  25. ## 1\. Introduction
  26. Syntastic is a syntax checking plugin for Vim that runs files through external
  27. syntax checkers and displays any resulting errors to the user. This can be done
  28. on demand, or automatically as files are saved. If syntax errors are detected,
  29. the user is notified and is happy because they didn't have to compile their
  30. code or execute their script to find them.
  31. At the time of this writing, syntax checking plugins exist for ActionScript,
  32. Ada, AppleScript, AsciiDoc, ASM, BEMHTML, Bourne shell, C, C++, C#, Chef,
  33. CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, Elixir,
  34. Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe,
  35. Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP,
  36. LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, Objective-C++,
  37. OCaml, Perl, Perl POD, PHP, gettext Portable Object, Puppet, Python, Racket,
  38. reStructuredText, Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, Texinfo, Twig,
  39. TypeScript, Vala, Verilog, VHDL, VimL, xHtml, XML, XSLT, YACC, YAML, z80, Zope
  40. page templates, and zsh.
  41. Below is a screenshot showing the methods that Syntastic uses to display syntax
  42. errors. Note that, in practise, you will only have a subset of these methods
  43. enabled.
  44. ![Screenshot 1][0]
  45. 1. Errors are loaded into the location list for the corresponding window.
  46. 2. When the cursor is on a line containing an error, the error message is echoed in the command window.
  47. 3. Signs are placed beside lines with errors - note that warnings are displayed in a different color.
  48. 4. There is a configurable statusline flag you can include in your statusline config.
  49. 5. Hover the mouse over a line containing an error and the error message is displayed as a balloon.
  50. 6. (not shown) Highlighting errors with syntax highlighting. Erroneous parts of lines can be highlighted.
  51. <a name="installation"></a>
  52. ## 2\. Installation
  53. Installing syntastic is easy but first you need to have the [pathogen][1]
  54. plugin installed. If you already have [pathogen][1] working then skip
  55. [Step 1](#step1) and go to [Step 2](#step2).
  56. <a name="step1"></a>
  57. ### 2.1\. Step 1: Install pathogen.vim
  58. First I'll show you how to install Tim Pope's [pathogen][1] so that it's easy to
  59. install syntastic. Do this in your terminal so that you get the `pathogen.vim`
  60. file and the directories it needs:
  61. ```sh
  62. mkdir -p ~/.vim/autoload ~/.vim/bundle; \
  63. curl -so ~/.vim/autoload/pathogen.vim \
  64. https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim
  65. ```
  66. Next you *need* to add this to your `~/.vimrc`:
  67. ```vim
  68. execute pathogen#infect()
  69. ```
  70. <a name="step2"></a>
  71. ### 2.2\. Step 2: Install syntastic as a pathogen bundle
  72. You now have pathogen installed and can put syntastic into `~/.vim/bundle` like
  73. this:
  74. ```sh
  75. cd ~/.vim/bundle
  76. git clone https://github.com/scrooloose/syntastic.git
  77. ```
  78. Quit vim and start it back up to reload it, then type:
  79. ```vim
  80. :Helptags
  81. ```
  82. If you get an error when you do this, then you probably didn't install
  83. [pathogen][1] right. Go back to [Step 1](#step1) and make sure you did the following:
  84. 1. Created both the `~/.vim/autoload` and `~/.vim/bundle` directories.
  85. 2. Added the `call pathogen#infect()` line to your `~/.vimrc` file
  86. 3. Did the `git clone` of syntastic inside `~/.vim/bundle`
  87. 4. Have permissions to access all of these directories.
  88. <a name="faq"></a>
  89. ## 3\. FAQ
  90. __Q. I installed syntastic but it isn't reporting any errors...__
  91. A. The most likely reason is that none of the syntax checkers that it requires
  92. is installed. For example: by default, python requires either `flake8` or
  93. `pylint` to be installed and in your `$PATH`. To see which executables are
  94. supported, look at the [wiki][3]. Note that aliases do not work; the actual
  95. executables must be available in your `$PATH`. Symbolic links are okay though.
  96. You can see syntastic's idea of available checkers by running `:SyntasticInfo`.
  97. Another reason it could fail is that either the command line options or the
  98. error output for a syntax checker may have changed. In this case, make sure you
  99. have the latest version of the syntax checker installed. If it still fails then
  100. create an issue - or better yet, create a pull request.
  101. __Q. The `perl` checker has stopped working...__
  102. A. The `perl` checker runs `perl -c` against your file, which in turn
  103. __executes__ any `BEGIN`, `UNITCHECK`, and `CHECK` blocks, and any `use`
  104. statements in your file (cf. [perlrun][10]). This is probably fine if you
  105. wrote the file yourself, but it's a security problem if you're checking third
  106. party files. Since there is currently no way to disable this behaviour while
  107. still producing useful results, the checker is now disabled by default. To
  108. (re-)enable it, set `g:syntastic_enable_perl_checker` to 1 in your vimrc:
  109. ```vim
  110. let g:syntastic_enable_perl_checker = 1
  111. ```
  112. __Q. I run a checker and the location list is not updated...__
  113. A. By default the location list is changed only when you run the `:Errors`
  114. command, in order to minimise conflicts with other plugins. If you want the
  115. location list to always be updated when you run the checkers, add this line to
  116. your vimrc:
  117. ```vim
  118. let g:syntastic_always_populate_loc_list = 1
  119. ```
  120. __Q. How can I pass additional arguments to a checker?__
  121. A. Almost all syntax checkers use the `makeprgBuild()` function. Those checkers
  122. that do can be configured using global variables. The general form of the
  123. global `args` variables is `syntastic_<filetype>_<checker>_args`.
  124. So, If you wanted to pass "--my --args --here" to the ruby mri checker you
  125. would add this line to your vimrc:
  126. ```vim
  127. let g:syntastic_ruby_mri_args = "--my --args --here"
  128. ```
  129. See `:help syntastic-checker-options` for more information.
  130. __Q. Syntastic supports several checkers for my filetype - how do I tell it
  131. which one(s) to use?__
  132. A. Stick a line like this in your vimrc:
  133. ```vim
  134. let g:syntastic_<filetype>_checkers = ['<checker-name>']
  135. ```
  136. To see the list of supported checkers for your filetype look at the
  137. [wiki][3].
  138. e.g. Python has the following checkers, among others: `flake8`, `pyflakes`,
  139. `pylint` and a native `python` checker.
  140. To tell syntastic to use `pylint`, you would use this setting:
  141. ```vim
  142. let g:syntastic_python_checkers = ['pylint']
  143. ```
  144. Some filetypes, like PHP, have style checkers as well as syntax checkers. These
  145. can be chained together like this:
  146. ```vim
  147. let g:syntastic_php_checkers = ['php', 'phpcs', 'phpmd']
  148. ```
  149. This is telling syntastic to run the `php` checker first, and if no errors are
  150. found, run `phpcs`, and then `phpmd`.
  151. __Q. How can I jump between the different errors without using the location
  152. list at the bottom of the window?__
  153. A. Vim provides several built in commands for this. See `:help :lnext` and
  154. `:help :lprev`.
  155. If you use these commands a lot then you may want to add shortcut mappings to
  156. your vimrc, or install something like [unimpaired][2], which provides such
  157. mappings (among other things).
  158. __Q. A syntax checker is giving me unwanted/strange style tips?__
  159. A. Some filetypes (e.g. php) have style checkers as well as syntax
  160. checkers. You can usually configure the options that are passed to the style
  161. checkers, or just disable them. Take a look at the [wiki][3] to see what
  162. options are available.
  163. Alternatively, you can use `g:syntastic_quiet_messages` to filter out the
  164. messages you don't want to see. e.g. To turn off all style messages:
  165. ```vim
  166. let g:syntastic_quiet_messages = { "type": "style" }
  167. ```
  168. See `:help syntastic_quiet_messages` for details.
  169. __Q. The error window is closed automatically when I :quit the current buffer
  170. but not when I :bdelete it?__
  171. A. There is no safe way to handle that situation automatically, but you can
  172. work around it:
  173. ```vim
  174. nnoremap <silent> <C-d> :lclose<CR>:bdelete<CR>
  175. cabbrev <silent> bd lclose\|bdelete
  176. ```
  177. <a name="otherresources"></a>
  178. ## 4\. Other resources
  179. The preferred place for posting suggestions, reporting bugs, and general
  180. discussions related to syntastic is the [issue tracker at GitHub][4]. There
  181. are also a [google group][5], and a [syntastic tag at StackOverflow][6].
  182. Syntastic aims to provide a common interface to syntax checkers for as many
  183. languages as possible. For particular languages, there are, of course, other
  184. plugins that provide more functionality than syntastic. You might want to take
  185. a look at [jedi-vim][7], [python-mode][8], or [YouCompleteMe][9].
  186. [0]: https://github.com/scrooloose/syntastic/raw/master/_assets/screenshot_1.png
  187. [1]: https://github.com/tpope/vim-pathogen
  188. [2]: https://github.com/tpope/vim-unimpaired
  189. [3]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers
  190. [4]: https://github.com/scrooloose/syntastic/issues
  191. [5]: https://groups.google.com/group/vim-syntastic
  192. [6]: http://stackoverflow.com/questions/tagged/syntastic
  193. [7]: https://github.com/davidhalter/jedi-vim
  194. [8]: https://github.com/klen/python-mode
  195. [9]: https://github.com/Valloric/YouCompleteMe
  196. [10]: http://perldoc.perl.org/perlrun.html#*-c*