Git Product home page Git Product logo

syntastic's Introduction

               ,
              / \,,_  .'|
           ,{{| /}}}}/_.'            _____________________________________________
          }}}}` '{{'  '.            /                                             \
        {{{{{    _   ;, \          /            Ladies and Gentlemen,              \
     ,}}}}}}    /o`\  ` ;)        |                                                |
    {{{{{{   /           (        |                 this is ...                    |
    }}}}}}   |            \       |                                                |
   {{{{{{{{   \            \      |                                                |
   }}}}}}}}}   '.__      _  |     |    _____             __             __  _      |
   {{{{{{{{       /`._  (_\ /     |   / ___/__  ______  / /_____ ______/ /_(_)____ |
    }}}}}}'      |    //___/   --=:   \__ \/ / / / __ \/ __/ __ `/ ___/ __/ / ___/ |
jgs `{{{{`       |     '--'       |  ___/ / /_/ / / / / /_/ /_/ (__  ) /_/ / /__   |
     }}}`                         | /____/\__, /_/ /_/\__/\__,_/____/\__/_/\___/   |
                                  |      /____/                                    |
                                  |                                               /
                                   \_____________________________________________/

  1. Deprecation note
  2. Introduction
  3. Installation
    3.1. Requirements
    3.2. Installing syntastic with Pathogen
  4. Recommended settings
  5. FAQ
    5.1. I installed syntastic but it isn't reporting any errors...
    5.2. Syntastic supports several checkers for my filetype, how do I tell it which one(s) to use?
    5.3. How can I run checkers for "foreign" filetypes against the current file?
    5.4. I have enabled multiple checkers for the current filetype. How can I display all errors from all checkers together?
    5.5. How can I pass additional arguments to a checker?
    5.6. I run a checker and the location list is not updated...
    5.6. I run:lopen or :lwindow and the error window is empty...
    5.7. How can I jump between the different errors without using the location list at the bottom of the window?
    5.8. The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?
    5.9. My favourite checker needs to load a configuration file from the project's root rather than the current directory...
    5.10. What is the difference between syntax checkers and style checkers?
    5.11. How can I check scripts written for different versions of Python?
    5.12. How can I check scripts written for different versions of Ruby?
    5.13. The perl checker has stopped working...
    5.14. What happened to the rustc checker?
    5.15. What happened to the tsc checker?
    5.16. What happened to the xcrun checker?
    5.17. What happened to the valac checker?
    5.18. What happened to the Julia lint checker?
  6. Resources

1. Deprecation note

This project is no longer maintained. If you need a syntax checking plugin for Vim you might be interested in Syntastic's spiritual succesor, ALE. Although it shares no code with syntastic and it takes a very different approach to design, ALE can be considered a natural evolution of syntastic in terms of goals and functionality. Check it out, you probably won't be disappointed.

2. Introduction

Syntastic is a syntax checking plugin for Vim created by Martin Grenfell. It runs files through external syntax checkers and displays any resulting errors to the user. This can be done on demand, or automatically as files are saved. If syntax errors are detected, the user is notified and is happy because they didn't have to compile their code or execute their script to find them.

At the time of this writing, syntastic has checking plugins for ACPI Source Language, ActionScript, Ada, Ansible configurations, API Blueprint, AppleScript, AsciiDoc, Assembly languages, BEMHTML, Bro, Bourne shell, C, C++, C#, Cabal, Chef, CMake, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dockerfile, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua, Markdown, MATLAB, Mercury, NASM, Nix, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Object, Raku, OS X and iOS property lists, Pug (formerly Jade), Puppet, Python, QML, R, Racket, RDF TriG, RDF Turtle, Relax NG, reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Solidity, Sphinx, SQL, Stylus, Tcl, TeX, Texinfo, Twig, TypeScript, Verilog, VHDL, Vim help, VimL, Vue.js, xHtml, XML, XSLT, XQuery, YACC, YAML, YANG data models, YARA rules, z80, Zope page templates, and Zsh. See the manual for details about the corresponding supported checkers (:help syntastic-checkers in Vim).

A number of third-party Vim plugins also provide checkers for syntastic, for example: merlin, omnisharp-vim, rust.vim, syntastic-extras, syntastic-more, tsuquyomi, vim-crystal, vim-eastwood, and vim-swift.

Below is a screenshot showing the methods that Syntastic uses to display syntax errors. Note that, in practise, you will only have a subset of these methods enabled.

Screenshot 1

  1. Errors are loaded into the location list for the corresponding window.
  2. When the cursor is on a line containing an error, the error message is echoed in the command window.
  3. Signs are placed beside lines with errors - note that warnings are displayed in a different color.
  4. There is a configurable statusline flag you can include in your statusline config.
  5. Hover the mouse over a line containing an error and the error message is displayed as a balloon.
  6. (not shown) Highlighting errors with syntax highlighting. Erroneous parts of lines can be highlighted.

3. Installation

3.1. Requirements

Syntastic itself has rather relaxed requirements: it doesn't have any external dependencies, and it needs a version of Vim compiled with a few common features: autocmd, eval, file_in_path, modify_fname, quickfix, reltime, statusline, and user_commands. Not all possible combinations of features that include the ones above make equal sense on all operating systems, but Vim version 7 or later with the "normal", "big", or "huge" feature sets should be fine.

Syntastic should work with any modern plugin managers for Vim, such as NeoBundle, Pathogen, Vim-Addon-Manager, Vim-Plug, or Vundle. Instructions for installing syntastic with Pathogen are included below for completeness.

Starting with Vim version 7.4.1486 you can also load syntastic using the standard mechanism of packages, without the help of third-party plugin managers (see :help packages in Vim for details). Beware however that, while support for packages has been added in Vim 7.4.1384, the functionality needed by syntastic is present only in versions 7.4.1486 and later.

Last but not least: syntastic doesn't know how to do any syntax checks by itself. In order to get meaningful results you need to install external checkers corresponding to the types of files you use. Please consult the manual (:help syntastic-checkers in Vim) for a list of supported checkers.

3.2. Installing syntastic with Pathogen

If you already have Pathogen working then skip Step 1 and go to Step 2.

3.2.1. Step 1: Install pathogen.vim

First I'll show you how to install Tim Pope's Pathogen so that it's easy to install syntastic. Do this in your terminal so that you get the pathogen.vim file and the directories it needs:

mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim

Next you need to add this to your ~/.vimrc:

execute pathogen#infect()

3.2.2. Step 2: Install syntastic as a Pathogen bundle

You now have pathogen installed and can put syntastic into ~/.vim/bundle like this:

cd ~/.vim/bundle && \
git clone --depth=1 https://github.com/vim-syntastic/syntastic.git

Quit vim and start it back up to reload it, then type:

:Helptags

If you get an error when you do this, then you probably didn't install Pathogen right. Go back to Step 1 and make sure you did the following:

  1. Created both the ~/.vim/autoload and ~/.vim/bundle directories.
  2. Added the execute pathogen#infect() line to your ~/.vimrc file
  3. Did the git clone of syntastic inside ~/.vim/bundle
  4. Have permissions to access all of these directories.

4. Recommended settings

Syntastic has numerous options that can be configured, and the defaults are not particularly well suitable for new users. It is recommended that you start by adding the following lines to your vimrc file, and return to them after reading the manual (see :help syntastic in Vim):

set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0

5. FAQ

5.1. Q. I installed syntastic but it isn't reporting any errors...

A. The most likely reason is that none of the syntax checkers that it requires are installed. For example: by default, python requires either flake8 or pylint to be installed and in your $PATH. Read the manual (:help syntastic-checkers in Vim) to find out what executables are supported. Note that aliases do not work; the actual executables must be available in your $PATH. Symbolic links are okay though. You can see syntastic's idea of available checkers by running :SyntasticInfo.

A second probable reason is that none of the available checkers are enabled. Syntastic comes preconfigured with a default list of enabled checkers per filetype, but this list is kept short in order to prevent slowing down Vim or trying to run conflicting checks. The command :SyntasticInfo will show you which checkers are enabled. You can tell syntastic which checkers (among the available ones) you want to run by setting g:syntastic_<filetype>_checkers in your vimrc (see below).

A third possible reason is that the $PATH seen by syntastic might not be same as the $PATH in your login shell. Syntastic runs checkers using the shell pointed to by Vim's shell (or by g:syntastic_shell, if set), and that's the shell you need to configure to set the proper $PATH and environment variables for your checkers. You can see syntastic's idea of $PATH by running

:echo syntastic#util#system('echo "$PATH"')

on UNIX and Mac OS-X systems, or

:echo syntastic#util#system('echo %PATH%')

on Windows.

Finally, another reason it could fail is that either the command line options or the error output for a syntax checker may have changed. In this case, make sure you have the latest version of the syntax checker installed. If it still fails then post an issue - or better yet, create a pull request.

5.2. Q. Syntastic supports several checkers for my filetype, how do I tell it which one(s) to use?

A. Add a line like this to your vimrc:

let g:syntastic_<filetype>_checkers = ['<checker-name>']

To see the list of supported checkers for your filetype read the manual (:help syntastic-checkers in Vim).

For example, Python has the following checkers, among others: flake8, pyflakes, pylint and a native python checker. To tell syntastic to use pylint, you would use this setting:

let g:syntastic_python_checkers = ['pylint']

Checkers can be chained together like this:

let g:syntastic_php_checkers = ['php', 'phpcs', 'phpmd']

This is telling syntastic to run the php checker first, and if no errors are found, run phpcs, and then phpmd.

You can also run checkers explicitly by calling :SyntasticCheck <checker>. For example to run phpcs and phpmd:

:SyntasticCheck phpcs phpmd

This works for any checkers available for the current filetype, even if they aren't listed in g:syntastic_<filetype>_checkers.

5.3. Q. How can I run checkers for "foreign" filetypes against the current file?

A. You need to qualify the name of the "foreign" checker with the name of its filetype. For example to check tex files with the checker language_check (which normally acts only on files of type text), you can add text/language_check to the list fo checkers for tex:

let g:syntastic_tex_checkers = ['lacheck', 'text/language_check']

This also works with :SyntasticCheck, e.g. the following command runs text/language_check against the current file regardless of the current filetype:

:SyntasticCheck text/language_check

Of course, the checkers specified this way need to be known to syntastic, and they need to be shown as available when you run :SyntasticInfo. You can't just make up a combination of a filetype and a program name and expect it to work as a checker.

5.4. Q. I have enabled multiple checkers for the current filetype. How can I display all errors from all checkers together?

A. Set g:syntastic_aggregate_errors to 1 in your vimrc:

let g:syntastic_aggregate_errors = 1

See :help syntastic-aggregating-errors for more details.

5.5. Q. How can I pass additional arguments to a checker?

A. In most cases a command line is constructed using an internal function named makeprgBuild(), which provides a number of options that allow you to customise every part of the command that gets run. You can set these options using global variables.

The general form of the global args variable is syntastic_<filetype>_<checker>_args. Thus if you wanted to pass --my --args --here to the Ruby mri checker you would add this line to your vimrc:

let g:syntastic_ruby_mri_args = "--my --args --here"

See :help syntastic-checker-options for more information.

A number of checkers don't use the makeprgBuild() function mentioned above, or have additional options that can be configured. For these checkers the exact list of options should be included in the manual (:help syntastic-checkers in Vim).

5.6. Q. I run a checker and the location list is not updated...
5.6. Q. I run:lopen or :lwindow and the error window is empty...

A. By default the location list is changed only when you run the :Errors command, in order to minimise conflicts with other plugins. If you want the location list to always be updated when you run the checkers, add this line to your vimrc:

let g:syntastic_always_populate_loc_list = 1

5.7. Q. How can I jump between the different errors without using the location list at the bottom of the window?

A. Vim provides several built-in commands for this. See :help :lnext and :help :lprevious.

If you use these commands a lot then you may want to add shortcut mappings to your vimrc, or install something like unimpaired, which provides such mappings (among other things).

5.8. Q. The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?

A. There is no safe way to handle that situation automatically, but you can work around it:

nnoremap <silent> <C-d> :lclose<CR>:bdelete<CR>
cabbrev <silent> bd <C-r>=(getcmdtype()==#':' && getcmdpos()==1 ? 'lclose\|bdelete' : 'bd')<CR>

5.9. My favourite checker needs to load a configuration file from the project's root rather than the current directory...

A. You can set up an autocmd to search for the configuration file in the current directory and upwards, and add it to the checker's options when found. For example for jscs:

function! FindConfig(prefix, what, where)
    let cfg = findfile(a:what, escape(a:where, ' ') . ';')
    return cfg !=# '' ? ' ' . a:prefix . ' ' . shellescape(cfg) : ''
endfunction

autocmd FileType javascript let b:syntastic_javascript_jscs_args =
    \ get(g:, 'syntastic_javascript_jscs_args', '') .
    \ FindConfig('-c', '.jscsrc', expand('<afile>:p:h', 1))

5.10. Q. What is the difference between syntax checkers and style checkers?

A. The errors and warnings they produce are highlighted differently and can be filtered by different rules, but otherwise the distinction is pretty much arbitrary. There is an ongoing effort to keep things consistent, so you can generally expect messages produced by syntax checkers to be mostly related to syntax, and messages produced by style checkers to be mostly about style. But there can be no formal guarantee that, say, a style checker that runs into a syntax error wouldn't die with a fatal message, nor that a syntax checker wouldn't give you warnings against using some constructs as being bad practice. There is also no guarantee that messages marked as style are less severe than the ones marked as syntax (whatever that might mean). And there are even a few Frankenstein checkers (for example flake8 and pylama) that, by their nature, produce both kinds of messages. Syntastic is not smart enough to be able to sort out these things by itself.

Generally it's more useful to look at this from the perspective of filtering unwanted messages, rather than as an indicator of severity levels. The distinction between syntax and style is orthogonal to the distinction between errors and warnings, and thus you can turn off messages based on level, on type, or both.

e.g. To disable all style messages:

let g:syntastic_quiet_messages = { "type": "style" }

See :help syntastic_quiet_messages for more information.

5.11. Q. How can I check scripts written for different versions of Python?

A. Install a Python version manager such as virtualenv or pyenv, activate the environment for the relevant version of Python, and install in it the checkers you want to use. Set g:syntastic_python_checkers accordingly in your vimrc, and run Vim from the virtual environment.

If you're starting Vim from a desktop manager rather than from a terminal you might need to write wrapper scripts around your checkers, to activate the virtual environment before running the actual checks. Then you'll need to point the relevant g:syntastic_python_<checker>_exec variables to the wrapper scripts.

5.12. Q. How can I check scripts written for different versions of Ruby?

A. Install a Ruby version manager such as rvm or rbenv, activate the relevant version of Ruby, and install in it the checkers you want to use. Set g:syntastic_ruby_checkers accordingly in your vimrc, and run Vim under the relevant Ruby version.

If you're starting Vim from a desktop manager rather than from a terminal and depending on the version manager you use you might need to write wrapper scripts around your checkers, to activate the relevant version of Ruby before running the actual checks. Then you'll need to point the relevant g:syntastic_ruby_<checker>_exec variables to the wrapper scripts.

5.13. Q. The perl checker has stopped working...

A. The perl checker runs perl -c against your file, which in turn executes any BEGIN, UNITCHECK, and CHECK blocks, and any use statements in your file (cf. perlrun). This is probably fine if you wrote the file yourself, but it's a security problem if you're checking third-party files. Since there is currently no way to disable this behaviour while still producing useful results, the checker is now disabled by default. To (re-)enable it, make sure the g:syntastic_perl_checkers list includes perl, and set g:syntastic_enable_perl_checker to 1 in your vimrc:

let g:syntastic_enable_perl_checker = 1

5.14. Q. What happened to the rustc checker?

A. It is now part of the rust.vim plugin. If you install this plugin the checker should be picked up automatically by syntastic.

5.15. Q. What happened to the tsc checker?

A. It didn't meet people's expectations and it has been removed. The plugin tsuquyomi comes packaged with a checker for TypeScript. If you install this plugin the checker should be picked up automatically by syntastic.

5.16. Q. What happened to the xcrun checker?

A. The xcrun checker used to have a security problem and it has been removed. A better checker for Swift is part of the vim-swift plugin. If you install this plugin the checker should be picked up automatically by syntastic.

5.17. Q. What happened to the valac checker?

A. It is now part of the vala.vim plugin. If you install this plugin the checker should be picked up automatically by syntastic.

5.18. Q. What happened to the Julia lint checker?

A. It was removed, since the Lint.jl package has been deprecated and no longer works with recent Julia versions.

6. Resources

The preferred place for posting suggestions, reporting bugs, and general discussions related to syntastic is the issue tracker at GitHub. A guide for writing syntax checkers can be found in the wiki. There are also a dedicated google group, and a syntastic tag at StackOverflow.

Syntastic aims to provide a common interface to syntax checkers for as many languages as possible. For particular languages, there are, of course, other plugins that provide more functionality than syntastic. You might want to take a look at ghcmod-vim, jedi-vim, python-mode, vim-go, or YouCompleteMe.

syntastic's People

Contributors

aswna avatar cehoffman avatar cholewa1992 avatar daniel-walker avatar darcyparker avatar dbarnett avatar edwintorok avatar erszcz avatar euoia avatar jdonaldson avatar jrahm avatar julienxx avatar kaleb avatar kisielk avatar kongo2002 avatar kstep avatar lcd047 avatar mbedna avatar millermedeiros avatar mootoh avatar oryband avatar pixelastic avatar powerman avatar rbrown avatar scrooloose avatar technosophos avatar tomfogg avatar tpope avatar troydm avatar zenzike avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

syntastic's Issues

Problem with erlang_check_file.erl location if not using pathogen

Problem makeing erlang_check_file.erl in line 32 or 35 when syntastic is invoked in a Erlang type file and Syntastic was not installed in the bundle/syntastic that Pathogen requires but just dropped in .vim file.

Some check must be implemented to see where the syntastic package was installed and then use that path to find erlang_check_file.erl.

Consistent use of highlighting

I noticed that SpellBad highlighting has been implemented, and standardized, for several languages, but not all of them. It should be made consistent, but there should also be an option to disable it -- I'm currently using the signs support because highlighting is not used in the Javascript checker, and I like it actually, I'll probably stick with it for awhile (ideally with the cursor-following messages of #46, though). But in a Python file, for instance, currently I see both signs and highlighting and it's overly noisy.

Unknown function: syntastic#HighlightErrors

vim is compiled without +balloon_eval, so syntastic#HighlightErrors (in autoload/syntastic.vim) will never be defined. But in some syntax checkers syntastic#HighlightErrors is called directly, without any protection.

Not working?

Hello, i installed plugin, but i can't use it. :echo g:syntastic_enable_signs return 1, but there is no errors (al least in sh and php)
How i can debug it and provide more info?

Strange problem in Vim after installing syntastic: &lines get unexpectedly reset from 999 to 24.

I have just added Syntastic to my plugins, and experience a very strange thing. I have set lines=999 in my .vimrc (inside a if has("gui")). This will make my vim-window fill the screen (vertically) when I use the gui.

Somehow, after I installed Syntastic, this setting gets destroyed when I start vim with gvim or vim -g from my shell. It works as usual if I start it with my hotkey -v set through Compiz.

I have done some debugging on my own, and I have found the the variable &lines is correct until line 23 in .../plugin/syntastic.vim, which is:

22 if !s:running_windows
23     let s:uname = system('uname')
24 endif

Before line 23, &lines = 999 as it should be. After line 23 though, &lines = 24. I have no idea what is happening, and I don't know where to begin to find a solution. I have also verified that the problem dissapears if I remove Syntastic, but since this is a very good plugin I want to keep it.

I hope someone either knows what is wrong or can help me to discover it.

Findability of syntastic

What's with one (old) version of syntastic being on vimscripts (first in google), with no link here. And grey's fork being second place, and your version oh so hidden? The world must know.

Macvim jslint issue?

Hi,

Syntastic came installed as part of janus (https://github.com/carlhuda/janus), and at this stage i've basically tried everything I can think of to get it working.

Here is the .vimrc.local file:
https://gist.github.com/1205877

The janus vimrc file is:
https://github.com/carlhuda/janus/blob/master/vimrc

I also have jslint installed

$which jslint
/usr/local/bin/jslint

Not sure if this helps, but:
:echo SyntaxCheckers_javascript_GetLocList()

returns []

Does this mean that somehow jslint is not being picked up?

errors when saving html.erb files

I'm on windows xp and I get this everytime I try to save a html.erb file
Im kinda newbie so I don't know how to be specific, I'm here if you need more info

Error detected while processing function 64_UpdateErrors..64_CacheErrors..SyntaxCheckers_eruby_GetLocList
..SyntasticMake:
line 20:
E40: Can't open errorfile C:\DOCUME1\ADMINI1\CONFIG~1\Temp\VIe3CF.tmp

sass syntax checker slows down vim startup

sass syntax checker slows down vim startup because it calls compass. This is especially if your compass command is via jruby, since jruby has slow startup times.

If anything, SyntaxCheckers_sass_GetLocList() should cache g:syntastic_sass_imports instead of calling it on script load.

sass syntax error in included files misinterpretted as error in current file

The output of sass syntax check is:

WARNING on line 2 of app/stylesheets/_theme.sass:
This selector doesn't have any properties and will not be rendered.
Syntax error: Invalid CSS after "": expected expression (e.g. 1px, bold), was "!blueprint_font..."
        on line 7 of app/stylesheets/_theme.sass
        from line 3 of app/stylesheets/_base.sass
        from line 5 of app/stylesheets/page.sass
  Use --trace for backtrace.

Syntastic thinks that line 7 of page.sass is broken.

fix ruby symbols syntax

Ruby symbols can be written in two ways:

tradicional: :symbol => 'value'
second way: symbol: 'value'

The secound way throws an error.

Bye

Not working

I clone the repo cd to the directory run rake to install the plugin.

Have the following statusline setup:

set statusline=%f

set statusline+=%#warningmsg#
set statusline+=%{&ff!='unix'?'['.&ff.']':''}
set statusline+=%*

set statusline+=%#warningmsg#
set statusline+=%{(&fenc!='utf-8'&&&fenc!='')?'['.&fenc.']':''}
set statusline+=%*

set statusline+=%h
set statusline+=%y
set statusline+=%r
set statusline+=%m

set statusline+=%#error#
set statusline+=%{StatuslineTabWarning()}
set statusline+=%*

set statusline+=%{StatuslineTrailingSpaceWarning()}

set statusline+=%#StatusLineNC#\ Git\ %#ErrorMsg#\ %{GitBranchInfoTokens()[0]}\ %#StatusLine#

set statusline+=%#error#
set statusline+=%{&paste?'[paste]':''}
set statusline+=%*

set statusline+=%=
set statusline+=%{StatuslineCurrentHighlight()}\ \
set statusline+=%c,
set statusline+=%l/%L
set statusline+=\ %P

set statusline+=%{StatuslineLongLineWarning()}

set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

Open up a file like hello.js or hello.python and write garbage and nothing changes,
I tried saving the file and running :Errors and nothing changed.

And I set the following additional vars in my vimrc:

let g:syntastic_enable_signs=1
let g:syntastic_auto_loc_list=1

Unknown sign: SyntasticWarning

I'm getting strange errors when saving.

Error detected while processing function <SNR>13_UpdateErrors..<SNR>13_RefreshSigns..<SNR>13_SignErrors:
line   12:
E155: Unknown sign: SyntasticWarning
E155: Unknown sign: SyntasticWarning

Ideas?

No such file or directory

Hello,

I just updated to the latest master and everytime I save a ruby (.rb) file I get:

ruby: No such file or directory -- path/to/file.rb

When I try to do

:!ruby -c path/to/file.rb

everything is fine. The path in the plugin must be wrong. Any clue?

CoffeScript: Not getting all errors

I was trying the coffescript syntax checker and I found out that not syntax errors are beign captured.

To reproduce it write 'function' on any coffee file

Here is the generated error by 'coffee':

SyntaxError: In simpleMapComponent.js.coffee, Reserved word "function" on line 10
 at SyntaxError (unknown source)
 at Lexer.identifierError (/usr/lib/node_modules/coffee-script/lib/lexer.js:458:13)
 at Lexer.identifierToken (/usr/lib/node_modules/coffee-script/lib/lexer.js:80:16)
 at Lexer.tokenize (/usr/lib/node_modules/coffee-script/lib/lexer.js:31:19)
 at Object.compile (/usr/lib/node_modules/coffee-script/lib/coffee-script.js:29:34)
 at /usr/lib/node_modules/coffee-script/lib/command.js:149:33
 at /usr/lib/node_modules/coffee-script/lib/command.js:115:26
 at [object Object].<anonymous> (fs.js:107:5)
 at [object Object].emit (events.js:61:17)
 at afterRead (fs.js:878:12)

[Bug] Undefined variable b:syntastic_loclist

When trying to open a ruby file I am getting the following error:

Error detected while processing function <SNR>56_UpdateErrors:
line 11:
E121: Undefined variable: b:syntastic_loclist

Syntastic not working for me

I have cloned the git repo to my bundle directory and added the lines to my status. But when I save nothing to seems to happen even when I type garbage in. I have my interpretors installed, both ruby and php. but none seem to work. Is there any way for me to debug the problem?

Framework for underlining

I think Syntastic is absolutely great. In fact, I want to use it for all of my syntax checking needs, replacing the current separate plugins I have for matlab and jslint.

There's only one thing stopping me: the lack of SpellCheck-style underlining for errors if specific column numbers or ranges are given. By browsing the pull requests and issues, I'm sure I'm not the only one who would like this feature.

However, I want to do it right. The thing that's so great about Syntastic is that it's a framework, for which anyone can quickly write specific plugins. I want to work out a generic way for these plugins to easily specify the syntax of the column number or range of the error, (perhaps automatically with error format) and let Syntastic automatically highlight those ranges.

I would be more than happy to fork and make some pull requests, but before I do so, I'd like to know if this idea is actually within your vision for the project. If it's not, I won't bother you with the pull requests. If you've already started thinking about this and have found it either futile or have made some progress, that would also be nice to know.

Thanks again for this great plugin!

'File to import not found' when using @import without extension in Sass/Rails

If I create two sass files, import one into another and don't state the extension explicitly, I get errors from syntastic.

// app/assets/stylesheets/style1.css.sass
$variable: 42
// app/assets/stylesheets/style2.css.sass

// Syntastic does not like this even though it's correct and actually works in my application...
@import "style1"

// ...but has no problem with this
@import "style1.css.sass"

The error messages I get:

style2.css.sass|| File to import not found or unreadable: style1. Load paths:
style2.css.sass|| /e/projects/sunrise/esirnus/app/assets/stylesheets
style2.css.sass|| /e/projects/sunrise/esirnus/app/assets/stylesheets/sass
style2.css.sass|| /usr/local/rvm/gems/ruby-1.9.2-p290-loadpatch/gems/compass-0.11.4/frameworks/blueprint/stylesheets
style2.css.sass|| /usr/local/rvm/gems/ruby-1.9.2-p290-loadpatch/gems/compass-0.11.4/frameworks/compass/stylesheets
style2.css.sass|| Compass::SpriteImporter
style2.css.sass|| on line 4 of style2.css.sass
style2.css.sass|| Use --trace for backtrace.

It's a problem if you have a mix of .sass and .scss files and don't want to hard-code requirement for one or the other syntax in every import.

I am using Rails 3.1, Sass 3.1.7, vim 7.3.294 (on Arch Linux) and latest syntastic from master branch (master, last updated today).

Location List locations contain the line number in them

When using the C syntax checker with syntastic, if I create an error and go to any error in the location list, instead of navigating to the file at the correct line, it creates a new file of the format:

filename:line#

So it erroneously adds the line number to the file name, which of course means it creates a new file.

I'm not sure what I might have changed to cause this to happen. I was fixing my status line and hadn't tested it in a while, but I also have been updating the plugin itself. I have the most recent version as of now, and the error still occurs.

Is there any easy way of diagnosing whether this is a problem on my side or not?

Thanks,
Brandon

ERuby unexpected ')'

I keep getting errors when building form_for in rails 3. They look like this
app/views/clients/_form.html.erb|4 col 35 error| unexpected ')'

When I delete the = sign from here <%= form_for @client do |f| %>
The error goes away.

PyLint

Has anyone successfully managed to set up PyLint with syntastic? Thanks

HTML 5 attributes throws errors

the following HTML 5 document throws errors and it validates using this HTML5 validator.

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Test</title>
        <link rel="stylesheet" href="css/main.css">
    </head>
    <body>
        <section data-some-value="foo">
            Lorem Ipsum
        </section>
        <script data-main="js/main.js" src="js/bar.js"></script>
    </body>
</html>

Errors:

test.html|4 col 9 warning| <meta> proprietary attribute "charset"
test.html|4 col 9 warning| <meta> lacks "content" attribute
test.html|6 col 9 warning| <link> inserting "type" attribute
test.html|12 col 9 warning| <script> proprietary attribute "data-main"
test.html|12 col 9 warning| <script> inserting "type" attribute

couldn't find an option on HTML tidy that would make it behave properly yet.

Duplicate values of HTML-id is wrongfully allowed

<h1 id="logo">

and

<p id="logo">

in the same view should yield an error. I know that coding view files != the rendered result, but this hint should still be valuable.

Thanks for a great plugin

//Carl

Netrw files (scp)

Is there some way to use syntastic on files access with netrw/scp? If there is not, then could this feature somehow be added?

RUBYOPT is not recognized as a command

For some reason i'm having shown [syntax:0(2)] and :Errors show the following message:
|| 'RUBYOPT' is not recognized as an internal or external command,
|| operable program or batch file.

Why does it run RUBYOPT, which should be just an env variable?

I'm using gvim 7.2 on Windows with Ruby 1.8.

error with less ft

when I open a *.less file I get

"lib/bootstrap.less" 26L, 602C                                                                          
Error detected while processing function <SNR>28_UpdateErrors..<SNR>28_CacheErrors..SyntaxCheckers_less_GetLocList:                                                                                             
line    3:                                                                                              
E720: Missing colon in Dictionary: {'bufnr': bufnr(""), 'text': "Syntax error"} })                      
E116: Invalid arguments for function SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'de
faults' {'bufnr': bufnr(""), 'text': "Syntax error"} })                                                 E15: Invalid expression: SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults' {'bufnr': bufnr(""), 'text': "Syntax error"} })                                                             
Error detected while processing function <SnNR>28_UpdateErrors..<SNR>28_CacheErrors:                    line    6:                                                                                              E712: Argument of extend() must be a List or Dictionary                                                 
E706: Variable type mismatch for: b:syntastic_loclist    

any suggestion ?

Add option to disable syntastic in general (for all filetypes) by default

I think that it can be useful to disable syntastic by default, and enable it when you want to use it (via SyntasticEnable).

Currently you can only disable it using g:syntastic_disabled_filetypes, which expects a list of filetypes to exclude.

I see two options:

  1. allow "*" (for "all") in the list of filetypes to disable (and remove it once one of them gets enabled)
  2. add a new option to disable syntastic altogether (and which SyntasticEnable would toggle).

bash/sh checking fails

Running :Errors on bash and sh scripts fail with the following message.

Error detected while processing function <SNR>14_ShowLocList:
line    3:
E776: No location list

support for less

less and scss is almost the same, any support for less?

since i haven't really look into sass, not sure if sass has the @arg part as less
eg:
.coolthings (@widthVar: 5px, @somethingelse: 5px) {
width: @widthVar;
#border > .round (@somethingelse);
}

a {
.coolthings ( 10px, @radiusSharp)
}

nevertheless, it is similar so is there support for less?

HAML Issues

This is related to Janus repo - I don't know what the conflict is but it's being caused by syntastic.

Whenever opening up a HAML File VIM errors out and it also asks to rewrite the file you're working on when you try to save it.

carlhuda/janus#210

Issue with HAML checker

Given HAML checker and source code below with invalid syntax (in this code '#' part should be on first line), syntax checker produce E474 error and make it vim start behaving weird and impossible to work without restarting. I have tested and there are same result on OSX and Ubuntu.

=link_to(
  '#',
  'link',
  :class => "a")

versions:
VIM - Vi IMproved 7.3
Haml/Sass 3.0.24 (Classy Cassidy)

Problems with input and paths in tex documents

I'm using the following in my latex documents:

\newcommand{\home}{../../../styles}

%% style
\input{\home/style_bill.tex}

and syntastic is complaining that it Could not open "\home/style_bill.tex". I set the path correctly and my documents are compiling. Is this a bug or to I have to configure my .vimrc to get rid of this message.

Matthias Guenther

Incompatibility with http://github.com/nathanaelkane/vim-indent-guides

I'm posting this here but I'm not an expert in vimscript so the problem could be with vim-indent-guides.
The fact is, as soon as a buffer is saved, syntastic does its syntaxing stuff, but also clears the indent highlights set by vim-indent-guides.
Upon re-enabling vim-indent-guides on the same buffer, there's an error

Error detected while processing function 26_IndentGuidesToggle..indent_guides#toggle..indent_guides#disable..indent_guides#clear_matches:
line    5:
E803: ID not found: 468
E803: ID not found: 469
E803: ID not found: 470
E803: ID not found: 471
...
...

Now, a quick glimpse at https://github.com/nathanaelkane/vim-indent-guides/blob/master/autoload/indent_guides.vim#L68
tells me (but I might be wrong) that it's doing it right, by cleaning its own ids.
The problem seems to be at https://github.com/scrooloose/syntastic/blob/master/autoload/syntastic.vim#L8 but, once again, I might have it wrong completely because I'm an amateur at vimscript.

Argument error on Windows

When trying to validate xhtml on Windows using Syntastic it fails. I tracked it down to the file argument to tidy being sent with single quotes around it. I added this to xhtml.vim in syntax_checkers to fix the problem

    if has('win32') || has('win64')
      let makeprg="tidy ".encopt." -xml -e ".expand('%')
    else
      let makeprg="tidy ".encopt." -xml -e ".shellescape(expand('%'))
    endif

Error when opening .sass file

Here's a screenshot of the error:

Do I have Syntastic set up incorrectly? Does Syntastic not know how to handle Sass files?

support error messages from sass 3.x

Old error message format (sass 2.x):

Syntax error on line 15: Undefined mixin 'display-box'.

New error message format (sass 3.x):

Syntax error: Undefined mixin 'display-box'.
        on line 14 of src/screen.sass, in `display-box'
        from line 14 of src/screen.sass
  Use --trace for backtrace.

Patch:

diff --git a/syntax_checkers/sass.vim b/syntax_checkers/sass.vim
index 2bfa1ab..192992d 100644
--- a/syntax_checkers/sass.vim
+++ b/syntax_checkers/sass.vim
@@ -21,7 +21,8 @@ endif

 function! SyntaxCheckers_sass_GetLocList()
     let makeprg='sass --check '.shellescape(expand('%'))
-    let errorformat = '%Wwarning on line %l:,%Z%m,Syntax %trror on line %l: %m'
+    let errorformat = '%ESyntax %trror:%m,%C        on line %l of %f,%Z%m'
+    let errorformat .= ',%Wwarning on line %l:,%Z%m,Syntax %trror on line %l: %m'
     let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })

     let bn = bufnr("")

PHP syntax checking doesn't work

When saving a php file with errors in it, the plugin doesn't work properly. The error message appears in the error list displayed by the :Errors command but the error line number is not displayed in the status line; instead, [syntax:0] is displayed. Also, the error signs are not displayed either.

I tried the plugin with a ruby file and it works perfectly.

Avoid loading location list with errors if it's already loaded when "set autoread" is set.

First, thanks for this plugin. It's great.

Second, I don't know if this is really an issue, or just an improvement. Here it goes.

I have your plugin installed. Suppose I'm editing a file with some erros (warnings), and then I edit this same file elsewhere, and since "autoread" is set in my .vimrc, a location list is loaded on top and the original location list on the bottom is kept as well.

I don't know if this is possible, but here is the suggestion: if there's already a location list loaded, don't load it again. I'm dont know vimscript so well, I think you already do this checking, but it may be lost when "autoread" is run, so you cant detect if location list is loaded, so the script loads the location list with syntax errors on the top again.

Very long vim startup time caused by syntastic on OSX

After some troubleshooting, I discovered that the excessively long vim startup times I was experiencing
were caused by the Syntastic bundle. I was seeing startup times of 15 to 30+ seconds for a new file.
The startup time drops to less than 1 sec without sytastic installed.

However, I was only seeing this on Mac OSX (Snow Leopard, Tiger), but not on Ubuntu Linux. On all
of the machines I am using the same build and the same .vimrc & .vim/

Using the command "time vim -c q abc.txt" I get these times:

OSX (Snow Leopard) OSX (Tiger) Ubuntu(Lucid Lynx)

real 0m11.717s real 0m23.673s real 0m0.091s
user 0m0.841s user 0m3.426s user 0m0.070s
sys 0m0.295s sys 0m1.391s sys 0m0.000s

In subsequent runs the times improve (for OSX), but not significantly.

Are there any know issues that would cause this behavior on OSX and not Ubuntu?

Is there any way to not auto load the Syntastic bundle, but have it available on demand.

Thanks

Matt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.