1
0
mirror of https://github.com/gryf/.vim.git synced 2025-12-17 11:30:29 +01:00

Added syntastic plugin, moved pylint_parseable script to compiler.

This commit is contained in:
2012-02-14 21:17:43 +01:00
parent 8b57ead694
commit f621a19a3d
61 changed files with 3656 additions and 1 deletions

View File

@@ -5,3 +5,5 @@ syntax: glob
view/*
**/doc/tags
.netrwhist

View File

@@ -8,5 +8,5 @@ if exists("current_compiler")
endif
let current_compiler = "pylint"
CompilerSet makeprg=$HOME/.vim/bin/pylint_parseable.py\ %
CompilerSet makeprg=pylint_parseable.py\ %
CompilerSet efm=%f:\ %t:\ %l:\ %c:\ %m,%f:\ %t:\ %l:\ %m

View File

@@ -0,0 +1,5 @@
Simple pylint compiler for Vim.
Installation:
Place bin/pylint_parseable.py into your path (/usr/local/bin or whenever) and
compiler/pylint.vim under ~/.vim/compiler.

4
bundle/git_syntastic/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
*~
*.swp
tags
.DS_Store

View File

@@ -0,0 +1,142 @@
,
/ \,,_ .'|
,{{| /}}}}/_.' _____________________________________________
}}}}` '{{' '. / \
{{{{{ _ ;, \ / Gentlemen, \
,}}}}}} /o`\ ` ;) | |
{{{{{{ / ( | this is ... |
}}}}}} | \ | |
{{{{{{{{ \ \ | |
}}}}}}}}} '.__ _ | | _____ __ __ _ |
{{{{{{{{ /`._ (_\ / | / ___/__ ______ / /_____ ______/ /_(_)____ |
}}}}}}' | //___/ --=: \__ \/ / / / __ \/ __/ __ `/ ___/ __/ / ___/ |
jgs `{{{{` | '--' | ___/ / /_/ / / / / /_/ /_/ (__ ) /_/ / /__ |
}}}` | /____/\__, /_/ /_/\__/\__,_/____/\__/_/\___/ |
| /____/ |
| /
\_____________________________________________/
Syntastic is a syntax checking plugin that 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, syntax checking plugins exist for applescript, c,
coffee, cpp, css, cucumber, cuda, docbk, erlang, eruby, fortran,
gentoo_metadata, go, haml, haskell, html, javascript, json, less, lua, matlab,
perl, php, puppet, python, rst, ruby, sass/scss, sh, tcl, tex, vala, xhtml,
xml, xslt, yaml, zpt
Screenshot
----------
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](https://github.com/scrooloose/syntastic/raw/master/_assets/screenshot_1.png)
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.
Installation
------------
[pathogen.vim](https://github.com/tpope/vim-pathogen) is the recommended way to install syntastic.
cd ~/.vim/bundle
git clone https://github.com/scrooloose/syntastic.git
Then reload vim, run `:helptags`, and check out `:help syntastic.txt`.
Google group
------------
To get information or make suggestions check out the [google group](https://groups.google.com/group/vim-syntastic).
Changelog
---------
2.2.0 (24-dec-2011)
* only do syntax checks when files are saved (not when first opened) - add g:syntastic_check_on_open option to get the old behavior back
* bug fix with echoing error messages; fixes incompatability with cmd-t (datanoise)
* dont allow warnings to mask errors when signing/echoing errors (ashikase)
* auto close location list when leaving buffer. (millermedeiros)
* update errors appropriately when :SyntasticToggleMode is called
* updates/fixes to existing checkers:
* javascript/jshint (millermedeiros)
* javascript/jslint
* c (kongo2002)
* Support for new filetypes:
* JSON (millermedeiros, tocer)
* rst (reStructuredText files) (JNRowe)
* gentoo-metadata (JNRowe)
2.1.0 (14-dec-2011)
* when the cursor is on a line containing an error, echo the
* error msg (kevinw)
* various bug fixes and refactoring
* updates/fixes to existing checkers:
* html (millermedeiros)
* erlang
* coffeescript
* javascript
* sh
* php (add support for phpcs - technosophos)
* add an applescript checker (Zhai Cai)
* add support for hyphenated filetypes (JNRowe)
2.0.0 (2-dec-2011):
* Add support for highlighting the erroneous parts of lines (kstep)
* Add support for displaying errors via balloons (kstep)
* Add syntastic_mode_map option to give more control over when checking should be done.
* Add :SyntasticCheck command to force a syntax check - useful in passive mode (justone).
* Add the option to automatically close the location list, but not automatically open it (milkypostman)
* Add syntastic_auto_jump option to automatically jump to the first error (milkypostman)
* Only source syntax checkers as needed - instead of loading all of them when vim starts
* Support for new filetypes:
* less (julienXX)
* docbook (tpope)
* matlab (jasongraham)
* go (dtjm)
* puppet (uggedal, roman, zsprackett)
* haskell (baldo, roman)
* tcl (et)
* vala (kstep)
* cuda (temporaer)
* css (oryband, sitedyno)
* fortran (Karl Yngve Lervåg)
* xml (kusnier)
* xslt (kusnier)
* erlang (kTT)
* zpt (claytron)
* updates to existing checkers:
* javascript (mogren, bryanforbes, cjab, ajduncan)
* sass/scss (tmm1, atourino, dlee, epeli)
* ruby (changa)
* perl (harleypig)
* haml (bmihelac)
* php (kstep, docteurklein)
* python (kstep, soli)
* lua (kstep)
* html (kstep)
* xhtml (kstep)
* c (kongo2002, brandonw)
* cpp (kongo2002)
* coffee (industrial)
* eruby (sergevm)

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

View File

@@ -0,0 +1,171 @@
if exists("g:loaded_syntastic_c_autoload")
finish
endif
let g:loaded_syntastic_c_autoload = 1
let s:save_cpo = &cpo
set cpo&vim
" initialize c/cpp syntax checker handlers
function! s:Init()
let s:handlers = []
let s:cflags = {}
call s:RegHandler('gtk', 'syntastic#c#CheckPKG',
\ ['gtk', 'gtk+-2.0', 'gtk+', 'glib-2.0', 'glib'])
call s:RegHandler('glib', 'syntastic#c#CheckPKG',
\ ['glib', 'glib-2.0', 'glib'])
call s:RegHandler('glade', 'syntastic#c#CheckPKG',
\ ['glade', 'libglade-2.0', 'libglade'])
call s:RegHandler('libsoup', 'syntastic#c#CheckPKG',
\ ['libsoup', 'libsoup-2.4', 'libsoup-2.2'])
call s:RegHandler('webkit', 'syntastic#c#CheckPKG',
\ ['webkit', 'webkit-1.0'])
call s:RegHandler('cairo', 'syntastic#c#CheckPKG',
\ ['cairo', 'cairo'])
call s:RegHandler('pango', 'syntastic#c#CheckPKG',
\ ['pango', 'pango'])
call s:RegHandler('libxml', 'syntastic#c#CheckPKG',
\ ['libxml', 'libxml-2.0', 'libxml'])
call s:RegHandler('freetype', 'syntastic#c#CheckPKG',
\ ['freetype', 'freetype2', 'freetype'])
call s:RegHandler('SDL', 'syntastic#c#CheckPKG',
\ ['sdl', 'sdl'])
call s:RegHandler('opengl', 'syntastic#c#CheckPKG',
\ ['opengl', 'gl'])
call s:RegHandler('ruby', 'syntastic#c#CheckRuby', [])
call s:RegHandler('Python\.h', 'syntastic#c#CheckPython', [])
call s:RegHandler('php\.h', 'syntastic#c#CheckPhp', [])
endfunction
" search the first 100 lines for include statements that are
" given in the handlers dictionary
function! syntastic#c#SearchHeaders()
let includes = ''
let files = []
let found = []
let lines = filter(getline(1, 100), 'v:val =~# "#\s*include"')
" search current buffer
for line in lines
let file = matchstr(line, '"\zs\S\+\ze"')
if file != ''
call add(files, file)
continue
endif
for handler in s:handlers
if line =~# handler["regex"]
let includes .= call(handler["func"], handler["args"])
call add(found, handler["regex"])
break
endif
endfor
endfor
" search included headers
for hfile in files
if hfile != ''
let filename = expand('%:p:h') . ((has('win32') || has('win64')) ?
\ '\' : '/') . hfile
try
let lines = readfile(filename, '', 100)
catch /E484/
continue
endtry
let lines = filter(lines, 'v:val =~# "#\s*include"')
for handler in s:handlers
if index(found, handler["regex"]) != -1
continue
endif
for line in lines
if line =~# handler["regex"]
let includes .= call(handler["func"], handler["args"])
call add(found, handler["regex"])
break
endif
endfor
endfor
endif
endfor
return includes
endfunction
" try to find library with 'pkg-config'
" search possible libraries from first to last given
" argument until one is found
function! syntastic#c#CheckPKG(name, ...)
if executable('pkg-config')
if !has_key(s:cflags, a:name)
for i in range(a:0)
let l:cflags = system('pkg-config --cflags '.a:000[i])
" since we cannot necessarily trust the pkg-config exit code
" we have to check for an error output as well
if v:shell_error == 0 && l:cflags !~? 'not found'
let l:cflags = ' '.substitute(l:cflags, "\n", '', '')
let s:cflags[a:name] = l:cflags
return l:cflags
endif
endfor
else
return s:cflags[a:name]
endif
endif
return ''
endfunction
" try to find PHP includes with 'php-config'
function! syntastic#c#CheckPhp()
if executable('php-config')
if !exists('s:php_flags')
let s:php_flags = system('php-config --includes')
let s:php_flags = ' ' . substitute(s:php_flags, "\n", '', '')
endif
return s:php_flags
endif
return ''
endfunction
" try to find the ruby headers with 'rbconfig'
function! syntastic#c#CheckRuby()
if executable('ruby')
if !exists('s:ruby_flags')
let s:ruby_flags = system('ruby -r rbconfig -e '
\ . '''puts Config::CONFIG["archdir"]''')
let s:ruby_flags = substitute(s:ruby_flags, "\n", '', '')
let s:ruby_flags = ' -I' . s:ruby_flags
endif
return s:ruby_flags
endif
return ''
endfunction
" try to find the python headers with distutils
function! syntastic#c#CheckPython()
if executable('python')
if !exists('s:python_flags')
let s:python_flags = system('python -c ''from distutils import '
\ . 'sysconfig; import sys; sys.stdout.write(sysconfig.get_python_inc())''')
let s:python_flags = substitute(s:python_flags, "\n", '', '')
let s:python_flags = ' -I' . s:python_flags
endif
return s:python_flags
endif
return ''
endfunction
" return a handler dictionary object
function! s:RegHandler(regex, function, args)
let handler = {}
let handler["regex"] = a:regex
let handler["func"] = function(a:function)
let handler["args"] = a:args
call add(s:handlers, handler)
endfunction
call s:Init()
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View File

@@ -0,0 +1,569 @@
*syntastic.txt* Syntax checking on the fly has never been so pimp.
*syntastic*
It's a bird! It's a plane! ZOMG It's ... ~
_____ __ __ _ ~
/ ___/__ ______ / /_____ ______/ /_(_)____ ~
\__ \/ / / / __ \/ __/ __ `/ ___/ __/ / ___/ ~
___/ / /_/ / / / / /_/ /_/ (__ ) /_/ / /__ ~
/____/\__, /_/ /_/\__/\__,_/____/\__/_/\___/ ~
/____/ ~
Reference Manual~
==============================================================================
CONTENTS *syntastic-contents*
1.Intro...................................|syntastic-intro|
2.Functionality provided..................|syntastic-functionality|
2.1.The statusline flag...............|syntastic-statusline-flag|
2.2.Error signs.......................|syntastic-error-signs|
2.3.Error window......................|syntastic-error-window|
3.Commands................................|syntastic-commands|
4.Options.................................|syntastic-options|
5.Writing syntax checkers.................|syntastic-syntax-checkers|
6.About...................................|syntastic-about|
7.Changelog...............................|syntastic-changelog|
8.Credits.................................|syntastic-credits|
9.License.................................|syntastic-license|
==============================================================================
1. Intro *syntastic-intro*
Syntastic is a syntax checking plugin that runs files through external syntax
checkers. This can be done on demand, or automatically as files are saved and
opened. If syntax errors are detected, the user is notified and is happy
because they didn't have to compile their code or execute their script to find
them.
Syntastic comes in two parts: the syntax checker plugins, and the core script
(i.e. syntastic.vim). The syntax checker plugins are defined on a per-filetype
basis where each one wraps up an external syntax checking program. The core
script delegates off to these plugins and uses their output to provide the
syntastic functionality. At the time of this writing, syntax checking plugins
exist for c, coffee, cpp, css, cucumber, cuda, docbk, erlang, eruby, fortran,
go, haml, haskell, html, javascript, less, lua, matlab, perl, php, puppet,
python, ruby, sass/scss, sh, tcl, tex, vala, xhtml, xml, xslt, zpt
Take a look in the syntax_checkers directory for the most up to date list.
If your language is not supported then see |syntastic-syntax-checkers| for
details on how to implement a syntax checking plugin, and be sure to send me a
patch ;-)
This plugin is currently only recommended for *nix users. It is functional on
Windows, but since the syntax checking plugins shell out, the command window
briefly appears whenever one is executed.
==============================================================================
2. Functionality provided *syntastic-functionality*
Syntax checking can be done automatically or on demand (see
|'syntastic_mode_map'| for configuring this).
When syntax checking is done, the features below can be used to notify the
user of errors. See |syntastic-options| for how to configure and
activate/deactivate these features.
* A configurable statusline flag
* Lines with errors can have |signs| placed beside them - where a different
sign is used for errors and warnings.
* A |location-list| can be displayed with error messages for erroneous
buffers.
* Offending parts of lines can be highlighted (this functionality is only
provided by some syntax checkers).
* Balloons (if compiled in) can be used to display error messages for
erroneous lines when hovering the mouse over them.
Note: This functionality is only available if a syntax checker plugin is
present for the filetype of the buffer in question. See
|syntastic-syntax-checkers| for details.
------------------------------------------------------------------------------
2.1. The statusline flag *syntastic-statusline-flag*
To use the statusline flag, this must appear in your |'statusline'| setting >
%{SyntasticStatuslineFlag()}
<
Something like this could be more useful: >
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
<
When syntax errors are detected a flag will be shown. The content of the flag
is derived from the |syntastic_stl_format| option
------------------------------------------------------------------------------
2.2. Error signs *syntastic-error-signs*
Syntastic uses the |:sign| commands to mark lines with errors and warnings in
the sign column. To enable this feature, use the |'syntastic_enable_signs'|
option.
------------------------------------------------------------------------------
2.3. The error window *:Errors* *syntastic-error-window*
You can use the :Errors command to display the errors for the current buffer
in the |location-list|.
Note that when you use :Errors, the current location list is overwritten with
Syntastic's own location list.
==============================================================================
3. Commands *syntastic-commands*
:Errors *:SyntasticErrors*
When errors have been detected, use this command to pop up the |location-list|
and display the error messages.
:SyntasticToggleMode *:SyntasticToggleMode*
Toggles syntastic between active and passive mode. See |'syntastic_mode_map'|
for more info.
:SyntasticCheck *:SyntasticCheck*
Manually cause a syntax check to be done. Useful in passive mode, or if the
current filetype is set to passive. See |'syntastic_mode_map'| for more info.
==============================================================================
4. Options *syntastic-options*
*'syntastic_check_on_open'*
Default: 0
If enabled, syntastic will do syntax checks when buffers are first loaded as
well as on saving >
let g:syntastic_check_on_open=1
<
*'syntastic_echo_current_error'*
Default: 1
If enabled, syntastic will error message associated with the current line to
the command window. If multiple errors are found, the first will be used. >
let g:syntastic_echo_current_error=1
<
*'syntastic_enable_signs'*
Default: 1
Use this option to tell syntastic whether to use the |:sign| interface to mark
syntax errors: >
let g:syntastic_enable_signs=1
<
*'syntastic_enable_balloons'*
Default: 1
Use this option to tell syntastic whether to display error messages in balloons
when the mouse is hovered over erroneous lines: >
let g:syntastic_enable_balloons = 1
<
Note that vim must be compiled with |+balloon_eval|.
*'syntastic_enable_highlighting'*
Default: 1
Use this option to tell syntastic whether to use syntax highlighting to mark
errors (where possible). Highlighting can be turned off with the following >
let g:syntastic_enable_highlighting = 0
<
*'syntastic_auto_jump'*
Default: 0
Enable this option if you want the cursor to jump to the first detected error
when saving or opening a file: >
let g:syntastic_auto_jump=1
<
*'syntastic_auto_loc_list'*
Default: 2
Use this option to tell syntastic to automatically open and/or close the
|location-list| (see |syntastic-error-window|).
When set to 0 the error window will not be opened or closed automatically. >
let g:syntastic_auto_loc_list=0
<
When set to 1 the error window will be automatically opened when errors are
detected, and closed when none are detected. >
let g:syntastic_auto_loc_list=1
<
When set to 2 the error window will be automatically closed when no errors are
detected, but not opened automatically. >
let g:syntastic_auto_loc_list=2
<
*'syntastic_loc_list_height'*
Default: 10
Use this option to specify the height of the location lists that syntastic
opens. >
let g:syntastic_loc_list_height=5
<
*'syntastic_mode_map'*
Default: { "mode": "active",
"active_filetypes": [],
"passive_filetypes": [] }
Use this option to fine tune when automatic syntax checking is done (or not
done).
The option should be set to something like: >
let g:syntastic_mode_map = { 'mode': 'active',
\ 'active_filetypes': ['ruby', 'php'],
\ 'passive_filetypes': ['puppet'] }
<
"mode" can be mapped to one of two values - "active" or "passive". When set to
active, syntastic does automatic checking whenever a buffer is saved or
initially opened. When set to "passive" syntastic only checks when the user
calls :SyntasticCheck.
The exceptions to these rules are defined with "active_filetypes" and
"passive_filetypes". In passive mode, automatic checks are still done
for all filetypes in the "active_filetypes" array. In active mode,
automatic checks are not done for any filetypes in the
"passive_filetypes" array.
At runtime, the |:SyntasticToggleMode| command can be used to switch between
active and passive mode.
If any of "mode", "active_filetypes", or "passive_filetypes" are not specified
then they will default to their default value as above.
*'syntastic_quiet_warnings'*
Use this option if you only care about syntax errors, not warnings. When set,
this option has the following effects:
* no |signs| appear unless there is at least one error, whereupon both
errors and warnings are displayed
* the |'syntastic_auto_loc_list'| option only pops up the error window if
there's at least one error, whereupon both errors and warnings are
displayed
>
let g:syntastic_quiet_warnings=1
<
*'syntastic_stl_format'*
Default: [Syntax: line:%F (%t)]
Use this option to control what the syntastic statusline text contains. Several
magic flags are availble to insert information:
%e - number of errors
%w - number of warnings
%t - total number of warnings and errors
%fe - line number of first error
%fw - line number of first warning
%F - line number of first warning or error
Several additional flags are available to hide text under certain conditions:
%E{...} - hide the text in the brackets unless there are errors
%W{...} - hide the text in the brackets unless there are warnings
%B{...} - hide the text in the brackets unless there are both warnings AND
errors
These flags cant be nested.
Example: >
let g:syntastic_stl_format = '[%E{Err: %fe #%e}%B{, }%W{Warn: %fw #%w}]'
<
If this format is used and the current buffer has 5 errors and 1 warning
starting on lines 20 and 10 respectively then this would appear on the
statusline: >
[Err: 20 #5, Warn: 10 #1]
<
If the buffer had 2 warnings, starting on line 5 then this would appear: >
[Warn: 5 #2]
<
==============================================================================
5. Writing syntax checkers *syntastic-syntax-checkers*
A syntax checker plugin is really nothing more than a single function. You
should define them in ~/.vim/syntax_checkers/<filetype>.vim, but this is
purely for convenience; Syntastic doesn't actually care where these functions
are defined.
A syntax checker plugin must define a function of the form:
>
SyntaxCheckers_<filetype>_GetLocList()
<
The output of this function must be of the same format as that returned by
the |getloclist()| function. See |getloclist()| and |getqflist()| for
details.
To achieve this, the function should call |SyntasticMake()| or shell out to a
syntax checker, parse the output and munge it into the format.
There are several syntax checker plugins provided with this plugin. The ruby
one is a good example of |SyntasticMake()|, while the haml one is a good
example of how to create the data structure manually.
SyntasticMake({options}) *SyntasticMake()*
{options} must be a dictionary. It can contain "makeprg" and "errorformat"
as keys (both optional).
SyntasticMake will run |:lmake| with the given |'makeprg'| and
|'errorformat'| (using the current settings if none are supplied). It will
store the resulting error list and use it to provide all of the
|syntastic-functionality|. The previous makeprg and errorformat settings
will then be restored, as well as the location list for the window. From
the user's perspective, it will be as though |:lmake| was never run.
Note that the given "makeprg" and "errorformat" will be set using |:let-&|,
so you should not escape spaces.
==============================================================================
6. About *syntastic-about*
The author of syntastic is a mighty wild stallion, hear him roar! >
_ _ _____ _____ ___ ___ ___ ____ _ _ _
| \ | | ____| ____|_ _|_ _|_ _/ ___| | | | |
| \| | _| | _| | | | | | | | _| |_| | |
| |\ | |___| |___ | | | | | | |_| | _ |_|
|_| \_|_____|_____|___|___|___\____|_| |_(_)
<
He likes to trot around in the back yard reading his emails and sipping a
scolding hot cup of Earl Grey. Email him at martin.grenfell at gmail dot com.
He can also be found trolling the #vim channel on the freenode IRC network as
scrooloose.
Bug reports, feedback, suggestions etc are welcomed.
The latest official releases will be on vim.org at some point.
The latest dev versions are on github
http://github.com/scrooloose/syntastic
==============================================================================
7. Changelog *syntastic-changelog*
next
- Add syntastic_loc_list_height option
- Allow errors to have a "subtype" that is signed differently to standard
errors. Currently geared towards differentiating style errors from
syntax errors. Currently implemented for phpcs (technosophos).
- New checkers for:
- yaml
- haxe (davidB)
- ocaml (edwintorok)
- pylint (parantapa)
- Updates to existing checkers:
- jslint
- fortran (bmattern)
- sass
- html (darcyparker)
- coffee (darcyparker)
- docbk (darcyparker)
- xml
- xslt
- less (irrationalfab)
- php (AD7six, technosophos)
- cuda
- python (mitchellh)
- perl (Anthony Carapetis)
- c (naoina, zsprackett)
- puppet
2.2.0
- only do syntax checks when files are saved (not when first opened) - add
g:syntastic_check_on_open option to get the old behavior back
- bug fix with echoing error messages; fixes incompatability with cmd-t (datanoise)
- dont allow warnings to mask errors when signing/echoing errors (ashikase)
- auto close location list when leaving buffer. (millermedeiros)
- update errors appropriately when :SyntasticToggleMode is called
- updates/fixes to existing checkers:
- javascript/jshint (millermedeiros)
- javascript/jslint
- c (kongo2002)
- Support for new filetypes:
- JSON (millermedeiros, tocer)
- rst (reStructuredText files) (JNRowe)
- gentoo-metadata (JNRowe)
2.1.0
- when the cursor is on a line containing an error, echo the
error msg (kevinw)
- various bug fixes and refactoring
- updates/fixes to existing checkers:
- html (millermedeiros)
- erlang
- coffeescript
- javascript
- sh
- php (add support for phpcs - technosophos)
- add an applescript checker (Zhai Cai)
- add support for hyphenated filetypes (JNRowe)
2.0.0
- Add support for highlighting the erroneous parts of lines (kstep)
- Add support for displaying errors via balloons (kstep)
- Add syntastic_mode_map option to give more control over when checking
should be done.
- Add :SyntasticCheck command to force a syntax check - useful in passive
mode (justone).
- Add the option to automatically close the location list, but not
automatically open it (milkypostman)
- Add syntastic_auto_jump option to automatically jump to the first
error (milkypostman)
- Only source syntax checkers as needed - instead of loading all of them
when vim starts
- Support for new filetypes:
- less (julienXX)
- docbook (tpope)
- matlab (jasongraham)
- go (dtjm)
- puppet (uggedal, roman, zsprackett)
- haskell (baldo, roman)
- tcl (et)
- vala (kstep)
- cuda (temporaer)
- css (oryband, sitedyno)
- fortran (Karl Yngve Lervåg)
- xml (kusnier)
- xslt (kusnier)
- erlang (kTT)
- zpt (claytron)
- updates to existing checkers:
- javascript (mogren, bryanforbes, cjab, ajduncan)
- sass/scss (tmm1, atourino, dlee, epeli)
- ruby (changa)
- perl (harleypig)
- haml (bmihelac)
- php (kstep, docteurklein)
- python (kstep, soli)
- lua (kstep)
- html (kstep)
- xhtml (kstep)
- c (kongo2002, brandonw)
- cpp (kongo2002)
- coffee (industrial)
- eruby (sergevm)
1.2.0
- New syntax checkers from github:kongo2002
- c (thanks also to github:jperras)
- cpp
- lua
- sh (thanks also to github:jmcantrell)
- add coffee syntax checked by github:lstoll
- add tex syntax checker
- make html checker play nicer with html5, thanks to github:enaeseth
- escape filenames properly when invoking syntax checkers, thanks to
github:jmcantrell
- adjust the ruby syntax checker to avoid some common annoying warnings,
thanks to github:robertwahler
1.1.0 [codenamed: tpimp]
- Dont load rubygems for ruby/eruby syntax checkers. Thanks tpope.
- Improve the javascript syntax checker to catch some warnings that were
getting missed. Thanks tpope.
- Dont automatically focus the error window. Thanks tpope.
- Add support for cucumber [tpope], haskell & perl [Anthony Carapetis],
and xhtml
- Add commands to enable/disable syntax checking at runtime. See :help
syntastic-commands.
- Add an option to specifiy syntax checkers that should be disabled by
default. See :help syntastic_disabled_filetypes.
- Dont use :signs if vim wasnt compiled with support for them.
)
==============================================================================
8. Credits *syntastic-credits*
Thanks to the following people for testing, bug reports, patches etc. They own,
hard.
Naoya INADA (naoina)
Mitchell Hashimoto (mitchellh)
irrationalfab
Andy Dawson (AD7six)
Parantapa Bhattacharya (parantapa)
edwintorok
Darcy Parker (darcyparker)
bmattern
David Bernard (davidB)
Aleksey V. Zapparov (ixti)
Benji Fisher (benjifisher)
Lance Fetters (ashikase)
datanoise
Giuseppe Rota (grota)
tocer
James Rowe (JNRowe)
Zhai Cai
Matt Butcher (technosophos)
Kevin Watters (kevinw)
Miller Medeiros (millermedeiros)
Pawel Salata (kTT)
Fjölnir Ásgeirsson (aptiva)
Clayton Parker (claytron)
S. Zachariah Sprackett (zsprackett)
Sylvain Soliman (soli)
Ricardo Catalinas Jiménez (jimenezrick)
kusnier
Klein Florian (docteurklein)
sitedyno
Matthew Batema (mlb-)
Nate Jones (justone)
sergevm
Karl Yngve Lervåg
Pavel Argentov (argent-smith)
Andy Duncan (ajduncan)
Antonio Touriño (atourino)
Chad Jablonski (cjab)
Roman Gonzalez (roman)
Tom Wieland (industrial)
Ory Band (oryband)
Esa-Matti Suuronen (epeli)
Brandon Waskiewicz (brandonw)
dlee
temporaer
Jason Graham (jasongraham)
Sam Nguyen (dtjm)
Claes Mogren (mogren)
Eivind Uggedal (uggedal)
kstep
Andreas Baldeau (baldo)
Eric Thomas (et)
Brian Donovan (eventualbuddha)
Bryan Forbes (bryanforbes)
Aman Gupta (tmm1)
Donald Ephraim Curtis (milkypostman)
Dominique Rose-Rosette (changa)
Harley Pig (harleypig)
bmihelac
Julien Blanchard (julienXX)
Gregor Uhlenheuer (kongo2002)
Lincoln Stoll
Tim Carey-Smith (halorgium)
Tim Pope (tpope)
Travis Jeffery
Anthony Carapetis
==============================================================================
9. License *syntastic-license*
Syntastic is released under the wtfpl.
See http://sam.zoy.org/wtfpl/COPYING.

View File

@@ -0,0 +1,614 @@
"============================================================================
"File: syntastic.vim
"Description: vim plugin for on the fly syntax checking
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"Version: 2.2.0
"Last Change: 24 Dec, 2011
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_plugin")
finish
endif
let g:loaded_syntastic_plugin = 1
let s:running_windows = has("win16") || has("win32") || has("win64")
if !s:running_windows
let s:uname = system('uname')
endif
if !exists("g:syntastic_enable_signs")
let g:syntastic_enable_signs = 1
endif
if !has('signs')
let g:syntastic_enable_signs = 0
endif
if !exists("g:syntastic_enable_balloons")
let g:syntastic_enable_balloons = 1
endif
if !has('balloon_eval')
let g:syntastic_enable_balloons = 0
endif
if !exists("g:syntastic_enable_highlighting")
let g:syntastic_enable_highlighting = 1
endif
if !exists("g:syntastic_echo_current_error")
let g:syntastic_echo_current_error = 1
endif
if !exists("g:syntastic_auto_loc_list")
let g:syntastic_auto_loc_list = 2
endif
if !exists("g:syntastic_auto_jump")
let syntastic_auto_jump=0
endif
if !exists("g:syntastic_quiet_warnings")
let g:syntastic_quiet_warnings = 0
endif
if !exists("g:syntastic_stl_format")
let g:syntastic_stl_format = '[Syntax: line:%F (%t)]'
endif
if !exists("g:syntastic_mode_map")
let g:syntastic_mode_map = {}
endif
if !has_key(g:syntastic_mode_map, "mode")
let g:syntastic_mode_map['mode'] = 'active'
endif
if !has_key(g:syntastic_mode_map, "active_filetypes")
let g:syntastic_mode_map['active_filetypes'] = []
endif
if !has_key(g:syntastic_mode_map, "passive_filetypes")
let g:syntastic_mode_map['passive_filetypes'] = []
endif
if !exists("g:syntastic_check_on_open")
let g:syntastic_check_on_open = 0
endif
if !exists("g:syntastic_loc_list_height")
let g:syntastic_loc_list_height = 10
endif
command! SyntasticToggleMode call s:ToggleMode()
command! SyntasticCheck call s:UpdateErrors(0) <bar> redraw!
command! Errors call s:ShowLocList()
highlight link SyntasticError SpellBad
highlight link SyntasticWarning SpellCap
augroup syntastic
if g:syntastic_echo_current_error
autocmd cursormoved * call s:EchoCurrentError()
endif
autocmd BufReadPost * if g:syntastic_check_on_open | call s:UpdateErrors(1) | endif
autocmd BufWritePost * call s:UpdateErrors(1)
autocmd BufWinEnter * if empty(&bt) | call s:AutoToggleLocList() | endif
autocmd BufWinLeave * if empty(&bt) | lclose | endif
augroup END
"refresh and redraw all the error info for this buf when saving or reading
function! s:UpdateErrors(auto_invoked)
if !empty(&buftype)
return
endif
if !a:auto_invoked || s:ModeMapAllowsAutoChecking()
call s:CacheErrors()
end
if s:BufHasErrorsOrWarningsToDisplay()
call setloclist(0, s:LocList())
endif
if g:syntastic_enable_balloons
call s:RefreshBalloons()
endif
if g:syntastic_enable_signs
call s:RefreshSigns()
endif
if g:syntastic_auto_jump && s:BufHasErrorsOrWarningsToDisplay()
silent! ll
endif
call s:AutoToggleLocList()
endfunction
"automatically open/close the location list window depending on the users
"config and buffer error state
function! s:AutoToggleLocList()
if s:BufHasErrorsOrWarningsToDisplay()
if g:syntastic_auto_loc_list == 1
call s:ShowLocList()
endif
else
if g:syntastic_auto_loc_list > 0
"TODO: this will close the loc list window if one was opened by
"something other than syntastic
lclose
endif
endif
endfunction
"lazy init the loc list for the current buffer
function! s:LocList()
if !exists("b:syntastic_loclist")
let b:syntastic_loclist = []
endif
return b:syntastic_loclist
endfunction
"clear the loc list for the buffer
function! s:ClearLocList()
let b:syntastic_loclist = []
endfunction
"detect and cache all syntax errors in this buffer
"
"depends on a function called SyntaxCheckers_{&ft}_GetLocList() existing
"elsewhere
function! s:CacheErrors()
call s:ClearLocList()
if filereadable(expand("%"))
"sub - for _ in filetypes otherwise we cant name syntax checker
"functions legally for filetypes like "gentoo-metadata"
let fts = substitute(&ft, '-', '_', 'g')
for ft in split(fts, '\.')
if s:Checkable(ft)
let errors = SyntaxCheckers_{ft}_GetLocList()
"make errors have type "E" by default
call SyntasticAddToErrors(errors, {'type': 'E'})
call extend(s:LocList(), errors)
endif
endfor
endif
endfunction
"toggle the g:syntastic_mode_map['mode']
function! s:ToggleMode()
if g:syntastic_mode_map['mode'] == "active"
let g:syntastic_mode_map['mode'] = "passive"
else
let g:syntastic_mode_map['mode'] = "active"
endif
call s:ClearLocList()
call s:UpdateErrors(1)
echo "Syntastic: " . g:syntastic_mode_map['mode'] . " mode enabled"
endfunction
"check the current filetypes against g:syntastic_mode_map to determine whether
"active mode syntax checking should be done
function! s:ModeMapAllowsAutoChecking()
let fts = split(&ft, '\.')
if g:syntastic_mode_map['mode'] == 'passive'
"check at least one filetype is active
let actives = g:syntastic_mode_map["active_filetypes"]
return !empty(filter(fts, 'index(actives, v:val) != -1'))
else
"check no filetypes are passive
let passives = g:syntastic_mode_map["passive_filetypes"]
return empty(filter(fts, 'index(passives, v:val) != -1'))
endif
endfunction
"return true if there are cached errors/warnings for this buf
function! s:BufHasErrorsOrWarnings()
return !empty(s:LocList())
endfunction
"return true if there are cached errors for this buf
function! s:BufHasErrors()
return len(s:ErrorsForType('E')) > 0
endfunction
function! s:BufHasErrorsOrWarningsToDisplay()
return s:BufHasErrors() || (!g:syntastic_quiet_warnings && s:BufHasErrorsOrWarnings())
endfunction
function! s:ErrorsForType(type)
return s:FilterLocList({'type': a:type})
endfunction
function! s:Errors()
return s:ErrorsForType("E")
endfunction
function! s:Warnings()
return s:ErrorsForType("W")
endfunction
"Filter a loc list (defaults to s:LocList()) by a:filters
"e.g.
" s:FilterLocList({'bufnr': 10, 'type': 'e'})
"
"would return all errors in s:LocList() for buffer 10.
"
"Note that all comparisons are done with ==?
function! s:FilterLocList(filters, ...)
let llist = a:0 ? a:1 : s:LocList()
let rv = deepcopy(llist)
for error in llist
for key in keys(a:filters)
let rhs = a:filters[key]
if type(rhs) == 1 "string
let rhs = '"' . rhs . '"'
endif
call filter(rv, "v:val['".key."'] ==? " . rhs)
endfor
endfor
return rv
endfunction
if g:syntastic_enable_signs
"define the signs used to display syntax and style errors/warns
sign define SyntasticError text=>> texthl=error
sign define SyntasticWarning text=>> texthl=todo
sign define SyntasticStyleError text=S> texthl=error
sign define SyntasticStyleWarning text=S> texthl=todo
endif
"start counting sign ids at 5000, start here to hopefully avoid conflicting
"with any other code that places signs (not sure if this precaution is
"actually needed)
let s:first_sign_id = 5000
let s:next_sign_id = s:first_sign_id
"place signs by all syntax errs in the buffer
function! s:SignErrors()
if s:BufHasErrorsOrWarningsToDisplay()
let errors = s:FilterLocList({'bufnr': bufnr('')})
for i in errors
let sign_severity = 'Error'
let sign_subtype = ''
if has_key(i,'subtype')
let sign_subtype = i['subtype']
endif
if i['type'] ==? 'w'
let sign_severity = 'Warning'
endif
let sign_type = 'Syntastic' . sign_subtype . sign_severity
if !s:WarningMasksError(i, errors)
exec "sign place ". s:next_sign_id ." line=". i['lnum'] ." name=". sign_type ." file=". expand("%:p")
call add(s:BufSignIds(), s:next_sign_id)
let s:next_sign_id += 1
endif
endfor
endif
endfunction
"return true if the given error item is a warning that, if signed, would
"potentially mask an error if displayed at the same time
function! s:WarningMasksError(error, llist)
if a:error['type'] !=? 'w'
return 0
endif
return len(s:FilterLocList({ 'type': "E", 'lnum': a:error['lnum'] }, a:llist)) > 0
endfunction
"remove the signs with the given ids from this buffer
function! s:RemoveSigns(ids)
for i in a:ids
exec "sign unplace " . i
call remove(s:BufSignIds(), index(s:BufSignIds(), i))
endfor
endfunction
"get all the ids of the SyntaxError signs in the buffer
function! s:BufSignIds()
if !exists("b:syntastic_sign_ids")
let b:syntastic_sign_ids = []
endif
return b:syntastic_sign_ids
endfunction
"update the error signs
function! s:RefreshSigns()
let old_signs = copy(s:BufSignIds())
call s:SignErrors()
call s:RemoveSigns(old_signs)
let s:first_sign_id = s:next_sign_id
endfunction
"display the cached errors for this buf in the location list
function! s:ShowLocList()
if !empty(s:LocList())
let num = winnr()
exec "lopen " . g:syntastic_loc_list_height
if num != winnr()
wincmd p
endif
endif
endfunction
"remove all error highlights from the window
function! s:ClearErrorHighlights()
for match in getmatches()
if stridx(match['group'], 'Syntastic') == 0
call matchdelete(match['id'])
endif
endfor
endfunction
"check if a syntax checker exists for the given filetype - and attempt to
"load one
function! s:Checkable(ft)
if !exists("g:loaded_" . a:ft . "_syntax_checker")
exec "runtime syntax_checkers/" . a:ft . ".vim"
endif
return exists("*SyntaxCheckers_". a:ft ."_GetLocList")
endfunction
"set up error ballons for the current set of errors
function! s:RefreshBalloons()
let b:syntastic_balloons = {}
if s:BufHasErrorsOrWarningsToDisplay()
for i in s:LocList()
let b:syntastic_balloons[i['lnum']] = i['text']
endfor
set beval bexpr=SyntasticErrorBalloonExpr()
endif
endfunction
"print as much of a:msg as possible without "Press Enter" prompt appearing
function! s:WideMsg(msg)
let old_ruler = &ruler
let old_showcmd = &showcmd
let msg = strpart(a:msg, 0, winwidth(0)-1)
"This is here because it is possible for some error messages to begin with
"\n which will cause a "press enter" prompt. I have noticed this in the
"javascript:jshint checker and have been unable to figure out why it
"happens
let msg = substitute(msg, "\n", "", "g")
set noruler noshowcmd
redraw
echo msg
let &ruler=old_ruler
let &showcmd=old_showcmd
endfunction
"echo out the first error we find for the current line in the cmd window
function! s:EchoCurrentError()
"If we have an error or warning at the current line, show it
let errors = s:FilterLocList({'lnum': line("."), "type": 'e'})
let warnings = s:FilterLocList({'lnum': line("."), "type": 'w'})
let b:syntastic_echoing_error = len(errors) || len(warnings)
if len(errors)
return s:WideMsg(errors[0]['text'])
endif
if len(warnings)
return s:WideMsg(warnings[0]['text'])
endif
"Otherwise, clear the status line
if b:syntastic_echoing_error
echo
let b:syntastic_echoing_error = 0
endif
endfunction
"load the chosen checker for the current filetype - useful for filetypes like
"javascript that have more than one syntax checker
function! s:LoadChecker(checker)
exec "runtime syntax_checkers/" . &ft . "/" . a:checker . ".vim"
endfunction
"return a string representing the state of buffer according to
"g:syntastic_stl_format
"
"return '' if no errors are cached for the buffer
function! SyntasticStatuslineFlag()
if s:BufHasErrorsOrWarningsToDisplay()
let errors = s:Errors()
let warnings = s:Warnings()
let output = g:syntastic_stl_format
"hide stuff wrapped in %E(...) unless there are errors
let output = substitute(output, '\C%E{\([^}]*\)}', len(errors) ? '\1' : '' , 'g')
"hide stuff wrapped in %W(...) unless there are warnings
let output = substitute(output, '\C%W{\([^}]*\)}', len(warnings) ? '\1' : '' , 'g')
"hide stuff wrapped in %B(...) unless there are both errors and warnings
let output = substitute(output, '\C%B{\([^}]*\)}', (len(warnings) && len(errors)) ? '\1' : '' , 'g')
"sub in the total errors/warnings/both
let output = substitute(output, '\C%w', len(warnings), 'g')
let output = substitute(output, '\C%e', len(errors), 'g')
let output = substitute(output, '\C%t', len(s:LocList()), 'g')
"first error/warning line num
let output = substitute(output, '\C%F', s:LocList()[0]['lnum'], 'g')
"first error line num
let output = substitute(output, '\C%fe', len(errors) ? errors[0]['lnum'] : '', 'g')
"first warning line num
let output = substitute(output, '\C%fw', len(warnings) ? warnings[0]['lnum'] : '', 'g')
return output
else
return ''
endif
endfunction
"A wrapper for the :lmake command. Sets up the make environment according to
"the options given, runs make, resets the environment, returns the location
"list
"
"a:options can contain the following keys:
" 'makeprg'
" 'errorformat'
"
"The corresponding options are set for the duration of the function call. They
"are set with :let, so dont escape spaces.
"
"a:options may also contain:
" 'defaults' - a dict containing default values for the returned errors
" 'subtype' - all errors will be assigned the given subtype
function! SyntasticMake(options)
let old_loclist = getloclist(0)
let old_makeprg = &makeprg
let old_shellpipe = &shellpipe
let old_shell = &shell
let old_errorformat = &errorformat
if !s:running_windows && (s:uname !~ "FreeBSD")
"this is a hack to stop the screen needing to be ':redraw'n when
"when :lmake is run. Otherwise the screen flickers annoyingly
let &shellpipe='&>'
let &shell = '/bin/bash'
endif
if has_key(a:options, 'makeprg')
let &makeprg = a:options['makeprg']
endif
if has_key(a:options, 'errorformat')
let &errorformat = a:options['errorformat']
endif
silent lmake!
let errors = getloclist(0)
call setloclist(0, old_loclist)
let &makeprg = old_makeprg
let &errorformat = old_errorformat
let &shellpipe=old_shellpipe
let &shell=old_shell
if !s:running_windows && s:uname =~ "FreeBSD"
redraw!
endif
if has_key(a:options, 'defaults')
call SyntasticAddToErrors(errors, a:options['defaults'])
endif
" Add subtype info if present.
if has_key(a:options, 'subtype')
call SyntasticAddToErrors(errors, {'subtype': a:options['subtype']})
endif
return errors
endfunction
"get the error balloon for the current mouse position
function! SyntasticErrorBalloonExpr()
if !exists('b:syntastic_balloons')
return ''
endif
return get(b:syntastic_balloons, v:beval_lnum, '')
endfunction
"highlight the list of errors (a:errors) using matchadd()
"
"a:termfunc is provided to highlight errors that do not have a 'col' key (and
"hence cant be done automatically). This function must take one arg (an error
"item) and return a regex to match that item in the buffer.
"
"an optional boolean third argument can be provided to force a:termfunc to be
"used regardless of whether a 'col' key is present for the error
function! SyntasticHighlightErrors(errors, termfunc, ...)
if !g:syntastic_enable_highlighting
return
endif
call s:ClearErrorHighlights()
let force_callback = a:0 && a:1
for item in a:errors
let group = item['type'] == 'E' ? 'SyntasticError' : 'SyntasticWarning'
if item['col'] && !force_callback
let lastcol = col([item['lnum'], '$'])
let lcol = min([lastcol, item['col']])
call matchadd(group, '\%'.item['lnum'].'l\%'.lcol.'c')
else
let term = a:termfunc(item)
if len(term) > 0
call matchadd(group, '\%' . item['lnum'] . 'l' . term)
endif
endif
endfor
endfunction
"take a list of errors and add default values to them from a:options
function! SyntasticAddToErrors(errors, options)
for i in range(0, len(a:errors)-1)
for key in keys(a:options)
if !has_key(a:errors[i], key) || empty(a:errors[i][key])
let a:errors[i][key] = a:options[key]
endif
endfor
endfor
return a:errors
endfunction
"take a list of syntax checkers for the current filetype and load the right
"one based on the global settings and checker executable availabity
"
"a:checkers should be a list of syntax checker names. These names are assumed
"to be the names of the vim syntax checker files that should be sourced, as
"well as the names of the actual syntax checker executables. The checkers
"should be listed in order of default preference.
"
"if a option called 'g:syntastic_[filetype]_checker' exists then attempt to
"load the checker that it points to
function! SyntasticLoadChecker(checkers)
let opt_name = "g:syntastic_" . &ft . "_checker"
if exists(opt_name)
let opt_val = {opt_name}
if index(a:checkers, opt_val) != -1 && executable(opt_val)
call s:LoadChecker(opt_val)
else
echoerr &ft . " syntax not supported or not installed."
endif
else
for checker in a:checkers
if executable(checker)
return s:LoadChecker(checker)
endif
endfor
endif
endfunction
" vim: set et sts=4 sw=4:

View File

@@ -0,0 +1,43 @@
"==============================================================================
" FileName: applescript.vim
" Desc: Syntax checking plugin for syntastic.vim
" Author: Zhao Cai
" Email: caizhaoff@gmail.com
" Version: 0.2.1
" Date Created: Thu 09 Sep 2011 10:30:09 AM EST
" Last Modified: Fri 09 Dec 2011 01:10:24 PM EST
"
" History: 0.1.0 - working, but it will run the script everytime to check
" syntax. Should use osacompile but strangely it does not give
" errors.
"
" 0.2.0 - switch to osacompile, it gives less errors compared
" with osascript.
"
" 0.2.1 - remove g:syntastic_applescript_tempfile. use
" tempname() instead.
"
" License: This program is free software. It comes without any
" warranty, to the extent permitted by applicable law. You can
" redistribute it and/or modify it under the terms of the Do What The
" Fuck You Want To Public License, Version 2, as published by Sam
" Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("loaded_applescript_syntax_checker")
finish
endif
let loaded_applescript_syntax_checker = 1
"bail if the user doesnt have osacompile installed
if !executable("osacompile")
finish
endif
function! SyntaxCheckers_applescript_GetLocList()
let makeprg = 'osacompile -o ' . tempname() . '.scpt '. shellescape(expand('%'))
let errorformat = '%f:%l:%m'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -0,0 +1,156 @@
"============================================================================
"File: c.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Gregor Uhlenheuer <kongo2002 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
" In order to also check header files add this to your .vimrc:
" (this usually creates a .gch file in your source directory)
"
" let g:syntastic_c_check_header = 1
"
" To disable the search of included header files after special
" libraries like gtk and glib add this line to your .vimrc:
"
" let g:syntastic_c_no_include_search = 1
"
" To enable header files being re-checked on every file write add the
" following line to your .vimrc. Otherwise the header files are checked only
" one time on initially loading the file.
" In order to force syntastic to refresh the header includes simply
" unlet b:syntastic_c_includes. Then the header files are being re-checked on
" the next file write.
"
" let g:syntastic_c_auto_refresh_includes = 1
"
" Alternatively you can set the buffer local variable b:syntastic_c_cflags.
" If this variable is set for the current buffer no search for additional
" libraries is done. I.e. set the variable like this:
"
" let b:syntastic_c_cflags = ' -I/usr/include/libsoup-2.4'
"
" In order to add some custom include directories that should be added to the
" gcc command line you can add those to the global variable
" g:syntastic_c_include_dirs. This list can be used like this:
"
" let g:syntastic_c_include_dirs = [ 'includes', 'headers' ]
"
" Moreover it is possible to add additional compiler options to the syntax
" checking execution via the variable 'g:syntastic_c_compiler_options':
"
" let g:syntastic_c_compiler_options = ' -ansi'
"
" Using the global variable 'g:syntastic_c_remove_include_errors' you can
" specify whether errors of files included via the g:syntastic_c_include_dirs'
" setting are removed from the result set:
"
" let g:syntastic_c_remove_include_errors = 1
if exists('loaded_c_syntax_checker')
finish
endif
let loaded_c_syntax_checker = 1
if !executable('gcc')
finish
endif
let s:save_cpo = &cpo
set cpo&vim
" default include directories
let s:default_includes = [ '.', '..', 'include', 'includes',
\ '../include', '../includes' ]
" uniquify the input list
function! s:Unique(list)
let l = []
for elem in a:list
if index(l, elem) == -1
let l = add(l, elem)
endif
endfor
return l
endfunction
" get the gcc include directory argument depending on the default
" includes and the optional user-defined 'g:syntastic_c_include_dirs'
function! s:GetIncludeDirs()
let include_dirs = s:default_includes
if exists('g:syntastic_c_include_dirs')
call extend(include_dirs, g:syntastic_c_include_dirs)
endif
return join(map(s:Unique(include_dirs), '"-I" . v:val'), ' ')
endfunction
function! SyntaxCheckers_c_GetLocList()
let makeprg = 'gcc -fsyntax-only -std=gnu99 '.shellescape(expand('%')).
\ ' '.s:GetIncludeDirs()
let errorformat = '%-G%f:%s:,%-G%f:%l: %#error: %#(Each undeclared '.
\ 'identifier is reported only%.%#,%-G%f:%l: %#error: %#for '.
\ 'each function it appears%.%#,%-GIn file included%.%#,'.
\ '%-G %#from %f:%l\,,%f:%l:%c: %m,%f:%l: %trror: %m,%f:%l: %m'
" determine whether to parse header files as well
if expand('%') =~? '.h$'
if exists('g:syntastic_c_check_header')
let makeprg = 'gcc -c '.shellescape(expand('%')).
\ ' '.s:GetIncludeDirs()
else
return []
endif
endif
" add optional user-defined compiler options
if exists('g:syntastic_c_compiler_options')
let makeprg .= g:syntastic_c_compiler_options
endif
" check if the user manually set some cflags
if !exists('b:syntastic_c_cflags')
" check whether to search for include files at all
if !exists('g:syntastic_c_no_include_search') ||
\ g:syntastic_c_no_include_search != 1
" refresh the include file search if desired
if exists('g:syntastic_c_auto_refresh_includes') &&
\ g:syntastic_c_auto_refresh_includes != 0
let makeprg .= syntastic#c#SearchHeaders()
else
" search for header includes if not cached already
if !exists('b:syntastic_c_includes')
let b:syntastic_c_includes = syntastic#c#SearchHeaders()
endif
let makeprg .= b:syntastic_c_includes
endif
endif
else
" use the user-defined cflags
let makeprg .= b:syntastic_c_cflags
endif
" process makeprg
let errors = SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat })
" filter the processed errors if desired
if exists('g:syntastic_c_remove_include_errors') &&
\ g:syntastic_c_remove_include_errors != 0
return filter(errors,
\ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr(''))
else
return errors
endif
endfunction
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View File

@@ -0,0 +1,27 @@
"============================================================================
"File: coffee.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Lincoln Stoll <l@lds.li>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("loaded_coffee_syntax_checker")
finish
endif
let loaded_coffee_syntax_checker = 1
"bail if the user doesnt have coffee installed
if !executable("coffee")
finish
endif
function! SyntaxCheckers_coffee_GetLocList()
let makeprg = 'coffee -c -l -o /tmp '.shellescape(expand('%'))
let errorformat = 'Syntax%trror: In %f\, %m on line %l,%EError: In %f\, Parse error on line %l: %m,%EError: In %f\, %m on line %l,%W%f(%l): lint warning: %m,%-Z%p^,%W%f(%l): warning: %m,%-Z%p^,%E%f(%l): SyntaxError: %m,%-Z%p^,%-G%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -0,0 +1,94 @@
"============================================================================
"File: cpp.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Gregor Uhlenheuer <kongo2002 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
" in order to also check header files add this to your .vimrc:
" (this usually creates a .gch file in your source directory)
"
" let g:syntastic_cpp_check_header = 1
"
" To disable the search of included header files after special
" libraries like gtk and glib add this line to your .vimrc:
"
" let g:syntastic_cpp_no_include_search = 1
"
" To enable header files being re-checked on every file write add the
" following line to your .vimrc. Otherwise the header files are checked only
" one time on initially loading the file.
" In order to force syntastic to refresh the header includes simply
" unlet b:syntastic_cpp_includes. Then the header files are being re-checked
" on the next file write.
"
" let g:syntastic_cpp_auto_refresh_includes = 1
"
" Alternatively you can set the buffer local variable b:syntastic_cpp_cflags.
" If this variable is set for the current buffer no search for additional
" libraries is done. I.e. set the variable like this:
"
" let b:syntastic_cpp_cflags = ' -I/usr/include/libsoup-2.4'
"
" Moreover it is possible to add additional compiler options to the syntax
" checking execution via the variable 'g:syntastic_cpp_compiler_options':
"
" let g:syntastic_cpp_compiler_options = ' -std=c++0x'
if exists('loaded_cpp_syntax_checker')
finish
endif
let loaded_cpp_syntax_checker = 1
if !executable('g++')
finish
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_cpp_GetLocList()
let makeprg = 'g++ -fsyntax-only '.shellescape(expand('%'))
let errorformat = '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m'
if expand('%') =~? '\%(.h\|.hpp\|.hh\)$'
if exists('g:syntastic_cpp_check_header')
let makeprg = 'g++ -c '.shellescape(expand('%'))
else
return []
endif
endif
if exists('g:syntastic_cpp_compiler_options')
let makeprg .= g:syntastic_cpp_compiler_options
endif
if !exists('b:syntastic_cpp_cflags')
if !exists('g:syntastic_cpp_no_include_search') ||
\ g:syntastic_cpp_no_include_search != 1
if exists('g:syntastic_cpp_auto_refresh_includes') &&
\ g:syntastic_cpp_auto_refresh_includes != 0
let makeprg .= syntastic#c#SearchHeaders()
else
if !exists('b:syntastic_cpp_includes')
let b:syntastic_cpp_includes = syntastic#c#SearchHeaders()
endif
let makeprg .= b:syntastic_cpp_includes
endif
endif
else
let makeprg .= b:syntastic_cpp_cflags
endif
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View File

@@ -0,0 +1,31 @@
"============================================================================
"File: css.vim
"Description: Syntax checking plugin for syntastic.vim using `csslint` CLI tool (http://csslint.net).
"Maintainer: Ory Band <oryband at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("loaded_css_syntax_checker")
finish
endif
let loaded_css_syntax_checker = 1
" Bail if the user doesn't have `csslint` installed.
if !executable("csslint")
finish
endif
function! SyntaxCheckers_css_GetLocList()
let makeprg = 'csslint --format=compact '.shellescape(expand('%'))
" Print CSS Lint's error/warning messages from compact format. Ignores blank lines.
let errorformat = '%-G,%-G%f: lint free!,%f: line %l\, col %c\, %trror - %m,%f: line %l\, col %c\, %tarning - %m,%f: line %l\, col %c\, %m,'
return SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")} })
endfunction

View File

@@ -0,0 +1,27 @@
"============================================================================
"File: cucumber.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("loaded_cucumber_syntax_checker")
finish
endif
let loaded_cucumber_syntax_checker = 1
"bail if the user doesnt have cucumber installed
if !executable("cucumber")
finish
endif
function! SyntaxCheckers_cucumber_GetLocList()
let makeprg = 'cucumber --dry-run --quiet --strict --format pretty '.shellescape(expand('%'))
let errorformat = '%f:%l:%c:%m,%W %.%# (%m),%-Z%f:%l:%.%#,%-G%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -0,0 +1,37 @@
"============================================================================
"File: cuda.vim
"Description: Syntax checking plugin for syntastic.vim
"
"Author: Hannes Schulz <schulz at ais dot uni-bonn dot de>
"
"============================================================================
" in order to also check header files add this to your .vimrc:
" (this creates an empty .syntastic_dummy.cu file in your source directory)
"
" let g:syntastic_cuda_check_header = 1
if exists('loaded_cuda_syntax_checker')
finish
endif
let loaded_cuda_syntax_checker = 1
if !executable('nvcc')
finish
endif
function! SyntaxCheckers_cuda_GetLocList()
let makeprg = 'nvcc --cuda -O0 -I . -Xcompiler -fsyntax-only '.shellescape(expand('%')).' -o /dev/null'
"let errorformat = '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m'
let errorformat = '%*[^"]"%f"%*\D%l: %m,"%f"%*\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,"%f"\, line %l%*\D%c%*[^ ] %m,%D%*\a[%*\d]: Entering directory `%f'',%X%*\a[%*\d]: Leaving directory `%f'',%D%*\a: Entering directory `%f'',%X%*\a: Leaving directory `%f'',%DMaking %*\a in %f,%f|%l| %m'
if expand('%') =~? '\%(.h\|.hpp\|.cuh\)$'
if exists('g:syntastic_cuda_check_header')
let makeprg = 'echo > .syntastic_dummy.cu ; nvcc --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include '.shellescape(expand('%')).' -o /dev/null'
else
return []
endif
endif
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -0,0 +1,29 @@
"============================================================================
"File: docbk.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("loaded_docbk_syntax_checker")
finish
endif
let loaded_docbk_syntax_checker = 1
"bail if the user doesnt have tidy or grep installed
if !executable("xmllint")
finish
endif
function! SyntaxCheckers_docbk_GetLocList()
let makeprg="xmllint --xinclude --noout --postvalid ".shellescape(expand(%:p))
let errorformat='%E%f:%l: parser error : %m,%W%f:%l: parser warning : %m,%E%f:%l:%.%# validity error : %m,%W%f:%l:%.%# validity warning : %m,%-Z%p^,%-C%.%#,%-G%.%#'
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
return loclist
endfunction

View File

@@ -0,0 +1,153 @@
#!/usr/bin/perl -w
# vimparse.pl - Reformats the error messages of the Perl interpreter for use
# with the quickfix mode of Vim
#
# Copyright (<28>) 2001 by J<>rg Ziefle <joerg.ziefle@gmx.de>
# You may use and distribute this software under the same terms as Perl itself.
#
# Usage: put one of the two configurations below in your ~/.vimrc (without the
# description and '# ') and enjoy (be sure to adjust the paths to vimparse.pl
# before):
#
# Program is run interactively with 'perl -w':
#
# set makeprg=$HOME/bin/vimparse.pl\ %\ $*
# set errorformat=%f:%l:%m
#
# Program is only compiled with 'perl -wc':
#
# set makeprg=$HOME/bin/vimparse.pl\ -c\ %\ $*
# set errorformat=%f:%l:%m
#
# Usage:
# vimparse.pl [-c] [-f <errorfile>] <programfile> [programargs]
#
# -c compile only, don't run (perl -wc)
# -f write errors to <errorfile>
#
# Example usages:
# * From the command line:
# vimparse.pl program.pl
#
# vimparse.pl -c -f errorfile program.pl
# Then run vim -q errorfile to edit the errors with Vim.
#
# * From Vim:
# Edit in Vim (and save, if you don't have autowrite on), then
# type ':mak' or ':mak args' (args being the program arguments)
# to error check.
#
# Version history:
# 0.2 (04/12/2001):
# * First public version (sent to Bram)
# * -c command line option for compiling only
# * grammatical fix: 'There was 1 error.'
# * bug fix for multiple arguments
# * more error checks
# * documentation (top of file, &usage)
# * minor code clean ups
# 0.1 (02/02/2001):
# * Initial version
# * Basic functionality
#
# Todo:
# * test on more systems
# * use portable way to determine the location of perl ('use Config')
# * include option that shows perldiag messages for each error
# * allow to pass in program by STDIN
# * more intuitive behaviour if no error is found (show message)
#
# Tested under SunOS 5.7 with Perl 5.6.0. Let me know if it's not working for
# you.
use strict;
use Getopt::Std;
use vars qw/$opt_c $opt_f $opt_h/; # needed for Getopt in combination with use strict 'vars'
use constant VERSION => 0.2;
getopts('cf:h');
&usage if $opt_h; # not necessarily needed, but good for further extension
if (defined $opt_f) {
open FILE, "> $opt_f" or do {
warn "Couldn't open $opt_f: $!. Using STDOUT instead.\n";
undef $opt_f;
};
};
my $handle = (defined $opt_f ? \*FILE : \*STDOUT);
(my $file = shift) or &usage; # display usage if no filename is supplied
my $args = (@ARGV ? ' ' . join ' ', @ARGV : '');
my @lines = `perl @{[defined $opt_c ? '-c ' : '' ]} -w "$file$args" 2>&1`;
my $errors = 0;
foreach my $line (@lines) {
chomp($line);
my ($file, $lineno, $message, $rest);
if ($line =~ /^(.*)\sat\s(.*)\sline\s(\d+)(\.|,\snear\s\".*\")$/) {
($message, $file, $lineno, $rest) = ($1, $2, $3, $4);
$errors++;
$message .= $rest if ($rest =~ s/^,//);
print $handle "$file:$lineno:$message\n";
} else { next };
}
if (defined $opt_f) {
my $msg;
if ($errors == 1) {
$msg = "There was 1 error.\n";
} else {
$msg = "There were $errors errors.\n";
};
print STDOUT $msg;
close FILE;
unlink $opt_f unless $errors;
};
sub usage {
(local $0 = $0) =~ s/^.*\/([^\/]+)$/$1/; # remove path from name of program
print<<EOT;
Usage:
$0 [-c] [-f <errorfile>] <programfile> [programargs]
-c compile only, don't run (executes 'perl -wc')
-f write errors to <errorfile>
Examples:
* At the command line:
$0 program.pl
Displays output on STDOUT.
$0 -c -f errorfile program.pl
Then run 'vim -q errorfile' to edit the errors with Vim.
* In Vim:
Edit in Vim (and save, if you don't have autowrite on), then
type ':mak' or ':mak args' (args being the program arguments)
to error check.
EOT
exit 0;
};

View File

@@ -0,0 +1,42 @@
"============================================================================
"File: erlang.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Pawel Salata <rockplayer.pl at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("loaded_erlang_syntax_checker")
finish
endif
let loaded_erlang_syntax_checker = 1
"bail if the user doesnt have escript installed
if !executable("escript")
finish
endif
let s:check_file = expand('<sfile>:p:h') . '/erlang_check_file.erl'
function! SyntaxCheckers_erlang_GetLocList()
let extension = expand('%:e')
if match(extension, 'hrl') >= 0
return []
endif
let shebang = getbufline(bufnr('%'), 1)[0]
if len(shebang) > 0
if match(shebang, 'escript') >= 0
let makeprg = 'escript -s '.shellescape(expand('%:p'))
else
let makeprg = s:check_file . ' '. shellescape(expand('%:p'))
endif
else
let makeprg = s:check_file . ' ' . shellescape(expand('%:p'))
endif
let errorformat = '%f:%l:\ %tarning:\ %m,%E%f:%l:\ %m'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -0,0 +1,12 @@
#!/usr/bin/env escript
-export([main/1]).
main([FileName]) ->
compile:file(FileName, [warn_obsolete_guard,
warn_unused_import,
warn_shadow_vars,
warn_export_vars,
strong_validation,
report,
{i, filename:dirname(FileName) ++ "/../include"}
]).

View File

@@ -0,0 +1,34 @@
"============================================================================
"File: eruby.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("loaded_eruby_syntax_checker")
finish
endif
let loaded_eruby_syntax_checker = 1
"bail if the user doesnt have ruby or cat installed
if !executable("ruby") || !executable("cat")
finish
endif
function! SyntaxCheckers_eruby_GetLocList()
if has('win32') || has('win64')
let makeprg='sed "s/<\%=/<\%/g" '. shellescape(expand("%")) . ' \| ruby -e "require \"erb\"; puts ERB.new(ARGF.read, nil, \"-\").src" \| ruby -c'
else
let makeprg='sed "s/<\%=/<\%/g" '. shellescape(expand("%")) . ' \| RUBYOPT= ruby -e "require \"erb\"; puts ERB.new(ARGF.read, nil, \"-\").src" \| RUBYOPT= ruby -c'
endif
let errorformat='%-GSyntax OK,%E-:%l: syntax error\, %m,%Z%p^,%W-:%l: warning: %m,%Z%p^,%-C%.%#'
return SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")} })
endfunction

View File

@@ -0,0 +1,44 @@
"============================================================================
"File: fortran.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Karl Yngve Lervåg <karl.yngve@lervag.net>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"Note: This syntax checker uses gfortran with the option -fsyntax-only
" to check for errors and warnings. Additional flags may be
" supplied through both local and global variables,
" b:syntastic_fortran_flags,
" g:syntastic_fortran_flags.
" This is particularly useful when the source requires module files
" in order to compile (that is when it needs modules defined in
" separate files).
"
"============================================================================
if exists("loaded_fortran_syntax_checker")
finish
endif
let loaded_fortran_syntax_checker = 1
"bail if the user doesnt have fortran installed
if !executable("gfortran")
finish
endif
if !exists('g:syntastic_fortran_flags')
let g:syntastic_fortran_flags = ''
endif
function! SyntaxCheckers_fortran_GetLocList()
let makeprg = 'gfortran -fsyntax-only'
let makeprg .= g:syntastic_fortran_flags
if exists('b:syntastic_fortran_flags')
let makeprg .= b:syntastic_fortran_flags
endif
let makeprg .= ' ' . shellescape(expand('%'))
let errorformat = '%-C %#,%-C %#%.%#,%A%f:%l.%c:,%Z%m,%G%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -0,0 +1,37 @@
"============================================================================
"File: gentoo-metadata.vim
"Description: Syntax checking plugin for Gentoo's metadata.xml files
"Maintainer: James Rowe <jnrowe at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
" The DTDs required to validate metadata.xml files are available in
" $PORTDIR/metadata/dtd, and these local files can be used to significantly
" speed up validation. You can create a catalog file with:
"
" xmlcatalog --create --add rewriteURI http://www.gentoo.org/dtd/ \
" ${PORTDIR:-/usr/portage}/metadata/dtd/ /etc/xml/gentoo
"
" See xmlcatalog(1) and http://www.xmlsoft.org/catalog.html for more
" information.
if exists("loaded_gentoo_metadata_syntax_checker")
finish
endif
let loaded_gentoo_metadata_syntax_checker = 1
"bail if the user doesn't have xmllint installed
if !executable("xmllint")
finish
endif
runtime syntax_checkers/xml.vim
function! SyntaxCheckers_gentoo_metadata_GetLocList()
return SyntaxCheckers_xml_GetLocList()
endfunction

View File

@@ -0,0 +1,22 @@
"============================================================================
"File: go.vim
"Description: Loads a go syntax checker from the go directory
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
" Use g:syntastic_go_checker option to specify which go executable
" should be used (see below for a list of supported checkers).
" If g:syntastic_go_checker is not set, just use the first syntax
" checker that we find installed.
"============================================================================
if exists("loaded_go_syntax_checker")
finish
endif
let loaded_go_syntax_checker = 1
let s:supported_checkers = ["6g", "gofmt"]
call SyntasticLoadChecker(s:supported_checkers)

View File

@@ -0,0 +1,17 @@
"============================================================================
"File: 6g.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Sam Nguyen <samxnguyen@gmail.com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
function! SyntaxCheckers_go_GetLocList()
let makeprg = '6g -o /dev/null %'
let errorformat = '%E%f:%l: %m'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -0,0 +1,16 @@
"============================================================================
"File: gofmt.vim
"Description: Check go syntax using gofmt
"Maintainer: Brandon Thomson <bt@brandonthomson.com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
function! SyntaxCheckers_go_GetLocList()
let makeprg = 'gofmt %'
let errorformat = '%f:%l:%c: %m,%-G%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'type': 'e'} })
endfunction

View File

@@ -0,0 +1,26 @@
"============================================================================
"File: haml.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("loaded_haml_syntax_checker")
finish
endif
let loaded_haml_syntax_checker = 1
"bail if the user doesnt have the haml binary installed
if !executable("haml")
finish
endif
function! SyntaxCheckers_haml_GetLocList()
let makeprg = "haml -c " . shellescape(expand("%"))
let errorformat = 'Haml error on line %l: %m,Syntax error on line %l: %m,%-G%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -0,0 +1,37 @@
"============================================================================
"File: haskell.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Anthony Carapetis <anthony.carapetis at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("loaded_haskell_syntax_checker")
finish
endif
let loaded_haskell_syntax_checker = 1
"bail if the user doesnt have ghc-mod installed
if !executable("ghc-mod")
finish
endif
function! SyntaxCheckers_haskell_GetLocList()
let makeprg =
\ "{ ".
\ "ghc-mod check ". shellescape(expand('%')) . "; " .
\ "ghc-mod lint " . shellescape(expand('%')) . ";" .
\ " }"
let errorformat = '%-G\\s%#,%f:%l:%c:%trror: %m,%f:%l:%c:%tarning: %m,'.
\ '%f:%l:%c: %trror: %m,%f:%l:%c: %tarning: %m,%f:%l:%c:%m,'.
\ '%E%f:%l:%c:,%Z%m,'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction
function! SyntaxCheckers_lhaskell_GetLocList()
return SyntaxCheckers_haskell_GetLocList()
endfunction

View File

@@ -0,0 +1,55 @@
"============================================================================
"File: haxe.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: David Bernard <david.bernard.31 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("loaded_haxe_syntax_checker")
finish
endif
let loaded_haxe_syntax_checker = 1
"bail if the user doesn't have haxe installed
if !executable("haxe")
finish
endif
" s:FindInParent
" find the file argument and returns the path to it.
" Starting with the current working dir, it walks up the parent folders
" until it finds the file, or it hits the stop dir.
" If it doesn't find it, it returns "Nothing"
function! s:FindInParent(fln,flsrt,flstp)
let here = a:flsrt
while ( strlen( here) > 0 )
let p = split(globpath(here, a:fln), '\n')
if len(p) > 0
return ['ok', here, fnamemodify(p[0], ':p:t')]
endif
let fr = match(here, '/[^/]*$')
if fr == -1
break
endif
let here = strpart(here, 0, fr)
if here == a:flstp
break
endif
endwhile
return ['fail', '', '']
endfunction
function! SyntaxCheckers_haxe_GetLocList()
let [success, hxmldir, hxmlname] = s:FindInParent('*.hxml', expand('%:p:h'), '/')
if success == 'ok'
let makeprg = 'cd ' . hxmldir . '; haxe ' . hxmlname
let errorformat = '%E%f:%l: characters %c-%*[0-9] : %m'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
else
return SyntasticMake({})
endif
endfunction

View File

@@ -0,0 +1,86 @@
"============================================================================
"File: html.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("loaded_html_syntax_checker")
finish
endif
let loaded_html_syntax_checker = 1
"bail if the user doesnt have tidy or grep installed
if !executable("tidy") || !executable("grep")
finish
endif
" TODO: join this with xhtml.vim for DRY's sake?
function! s:TidyEncOptByFenc()
let tidy_opts = {
\'utf-8' : '-utf8',
\'ascii' : '-ascii',
\'latin1' : '-latin1',
\'iso-2022-jp' : '-iso-2022',
\'cp1252' : '-win1252',
\'macroman' : '-mac',
\'utf-16le' : '-utf16le',
\'utf-16' : '-utf16',
\'big5' : '-big5',
\'sjis' : '-shiftjis',
\'cp850' : '-ibm858',
\}
return get(tidy_opts, &fileencoding, '-utf8')
endfunction
let s:ignore_html_errors = [
\ "<table> lacks \"summary\" attribute",
\ "not approved by W3C",
\ "attribute \"placeholder\"",
\ "<meta> proprietary attribute \"charset\"",
\ "<meta> lacks \"content\" attribute",
\ "inserting \"type\" attribute",
\ "proprietary attribute \"data-"
\]
function! s:ValidateError(text)
let valid = 0
for i in s:ignore_html_errors
if stridx(a:text, i) != -1
let valid = 1
break
endif
endfor
return valid
endfunction
function! SyntaxCheckers_html_GetLocList()
let encopt = s:TidyEncOptByFenc()
let makeprg="tidy ".encopt." --new-blocklevel-tags ".shellescape('section, article, aside, hgroup, header, footer, nav, figure, figcaption')." --new-inline-tags ".shellescape('video, audio, embed, mark, progress, meter, time, ruby, rt, rp, canvas, command, details, datalist')." --new-empty-tags ".shellescape('wbr, keygen')." -e ".shellescape(expand('%'))." 2>&1"
let errorformat='%Wline %l column %c - Warning: %m,%Eline %l column %c - Error: %m,%-G%.%#,%-G%.%#'
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
" process loclist since we need to add some info and filter out valid HTML5
" from the errors
let n = len(loclist) - 1
let bufnum = bufnr("")
while n >= 0
let i = loclist[n]
" filter out valid HTML5
if s:ValidateError(i['text']) == 1
unlet loclist[n]
else
"the file name isnt in the output so stick in the buf num manually
let i['bufnr'] = bufnum
endif
let n -= 1
endwhile
return loclist
endfunction

View File

@@ -0,0 +1,23 @@
"============================================================================
"File: javascript.vim
"Description: Figures out which javascript syntax checker (if any) to load
" from the javascript directory.
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
" Use g:syntastic_javascript_checker option to specify which jslint executable
" should be used (see below for a list of supported checkers).
" If g:syntastic_javascript_checker is not set, just use the first syntax
" checker that we find installed.
"============================================================================
if exists("loaded_javascript_syntax_checker")
finish
endif
let loaded_javascript_syntax_checker = 1
let s:supported_checkers = ["gjslint", "jslint", "jsl", "jshint"]
call SyntasticLoadChecker(s:supported_checkers)

View File

@@ -0,0 +1,20 @@
"============================================================================
"File: gjslint.vim
"Description: Javascript syntax checker - using gjslint
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if !exists("g:syntastic_javascript_gjslint_conf")
let g:syntastic_javascript_gjslint_conf = ""
endif
function! SyntaxCheckers_javascript_GetLocList()
let makeprg = "gjslint " . g:syntastic_javascript_gjslint_conf . " --nosummary --unix_mode --nodebug_indentation --nobeep " . shellescape(expand('%'))
let errorformat="%f:%l:(New Error -%\\?\%n) %m,%f:%l:(-%\\?%n) %m,%-G1 files checked, no errors found.,%-G%.%#"
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -0,0 +1,21 @@
"============================================================================
"File: jshint.vim
"Description: Javascript syntax checker - using jshint
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if !exists("g:syntastic_javascript_jshint_conf")
let g:syntastic_javascript_jshint_conf = ""
endif
function! SyntaxCheckers_javascript_GetLocList()
" node-jshint uses .jshintrc as config unless --config arg is present
let args = !empty(g:syntastic_javascript_jshint_conf) ? ' --config ' . g:syntastic_javascript_jshint_conf : ''
let makeprg = 'jshint ' . shellescape(expand("%")) . args
let errorformat = '%ELine %l:%c,%Z\\s%#Reason: %m,%C%.%#,%f: line %l\, col %c\, %m,%-G%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr('')} })
endfunction

View File

@@ -0,0 +1,20 @@
"============================================================================
"File: jsl.vim
"Description: Javascript syntax checker - using jsl
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if !exists("g:syntastic_javascript_jsl_conf")
let g:syntastic_javascript_jsl_conf = ""
endif
function! SyntaxCheckers_javascript_GetLocList()
let makeprg = "jsl " . g:syntastic_javascript_jsl_conf . " -nologo -nofilelisting -nosummary -nocontext -process ".shellescape(expand('%'))
let errorformat='%W%f(%l): lint warning: %m,%-Z%p^,%W%f(%l): warning: %m,%-Z%p^,%E%f(%l): SyntaxError: %m,%-Z%p^,%-G'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -0,0 +1,31 @@
"============================================================================
"File: jslint.vim
"Description: Javascript syntax checker - using jslint
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"Tested with jslint 0.1.4.
"============================================================================
if !exists("g:syntastic_javascript_jslint_conf")
let g:syntastic_javascript_jslint_conf = "--white --undef --nomen --regexp --plusplus --bitwise --newcap --sloppy --vars"
endif
function! SyntaxCheckers_javascript_HighlightTerm(error)
let unexpected = matchstr(a:error['text'], 'Expected.*and instead saw \'\zs.*\ze\'')
if len(unexpected) < 1 | return '' | end
return '\V'.split(unexpected, "'")[1]
endfunction
function! SyntaxCheckers_javascript_GetLocList()
let makeprg = "jslint " . g:syntastic_javascript_jslint_conf . " " . shellescape(expand('%'))
let errorformat='%E %##%n %m,%-Z%.%#Line %l\, Pos %c,%-G%.%#'
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr("")} })
call SyntasticHighlightErrors(errors, function('SyntaxCheckers_javascript_HighlightTerm'))
return errors
endfunction

View File

@@ -0,0 +1,23 @@
"============================================================================
"File: json.vim
"Description: Figures out which json syntax checker (if any) to load
" from the json directory.
"Maintainer: Miller Medeiros <contact at millermedeiros dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
" Use g:syntastic_json_checker option to specify which jsonlint executable
" should be used (see below for a list of supported checkers).
" If g:syntastic_json_checker is not set, just use the first syntax
" checker that we find installed.
"============================================================================
if exists("loaded_json_syntax_checker")
finish
endif
let loaded_json_syntax_checker = 1
let s:supported_checkers = ["jsonlint", "jsonval"]
call SyntasticLoadChecker(s:supported_checkers)

View File

@@ -0,0 +1,16 @@
"============================================================================
"File: jsonlint.vim
"Description: JSON syntax checker - using jsonlint
"Maintainer: Miller Medeiros <contact at millermedeiros dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
function! SyntaxCheckers_json_GetLocList()
let makeprg = 'jsonlint ' . shellescape(expand("%")) . ' --compact'
let errorformat = '%ELine %l:%c,%Z\\s%#Reason: %m,%C%.%#,%f: line %l\, col %c\, %m,%-G%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr('')} })
endfunction

View File

@@ -0,0 +1,17 @@
"============================================================================
"File: jsonval.vim
"Description: JSON syntax checker - using jsonval
"Maintainer: Miller Medeiros <contact at millermedeiros dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
function! SyntaxCheckers_json_GetLocList()
" based on https://gist.github.com/1196345
let makeprg = 'jsonval '. shellescape(expand('%'))
let errorformat = '%E%f:\ %m\ at\ line\ %l,%-G%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr('')} })
endfunction

View File

@@ -0,0 +1,38 @@
"============================================================================
"File: less.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Julien Blanchard <julien at sideburns dot eu>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("loaded_less_syntax_checker")
finish
endif
let loaded_less_syntax_checker = 1
"bail if the user doesnt have the lessc binary installed
if !executable("lessc")
finish
endif
if !exists("g:syntastic_less_options")
let g:syntastic_less_options = "--no-color"
endif
function! SyntaxCheckers_less_GetLocList()
let makeprg = 'lessc '. g:syntastic_less_options .' '. shellescape(expand('%')) . ' /dev/null'
"lessc >= 1.2
let errorformat = '%m in %f:%l:%c'
"lessc < 1.2
let errorformat .= ', Syntax %trror on line %l in %f,Syntax %trror on line %l,! Syntax %trror: on line %l: %m,%-G%.%#'
return SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr(""), 'text': "Syntax error"} })
endfunction

View File

@@ -0,0 +1,58 @@
"============================================================================
"File: lua.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Gregor Uhlenheuer <kongo2002 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('loaded_lua_syntax_checker')
finish
endif
let loaded_lua_syntax_checker = 1
" check if the lua compiler is installed
if !executable('luac')
finish
endif
function! SyntaxCheckers_lua_Term(pos)
let near = matchstr(a:pos['text'], "near '[^']\\+'")
let result = ''
if len(near) > 0
let near = split(near, "'")[1]
if near == '<eof>'
let p = getpos('$')
let a:pos['lnum'] = p[1]
let a:pos['col'] = p[2]
let result = '\%'.p[2].'c'
else
let result = '\V'.near
endif
let open = matchstr(a:pos['text'], "(to close '[^']\\+' at line [0-9]\\+)")
if len(open) > 0
let oline = split(open, "'")[1:2]
let line = 0+strpart(oline[1], 9)
call matchadd('SpellCap', '\%'.line.'l\V'.oline[0])
endif
endif
return result
endfunction
function! SyntaxCheckers_lua_GetLocList()
let makeprg = 'luac -p ' . shellescape(expand('%'))
let errorformat = 'luac: %#%f:%l: %m'
let loclist = SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': { 'bufnr': bufnr(''), 'type': 'E' } })
call SyntasticHighlightErrors(loclist, function("SyntaxCheckers_lua_Term"))
return loclist
endfunction

View File

@@ -0,0 +1,28 @@
"============================================================================
"File: matlab.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Jason Graham <jason at the-graham dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("loaded_matlab_syntax_checker")
finish
endif
let loaded_matlab_syntax_checker = 1
"bail if the user doesn't have mlint installed
if !executable("mlint")
finish
endif
function! SyntaxCheckers_matlab_GetLocList()
let makeprg = 'mlint -id $* '.shellescape(expand('%'))
let errorformat = 'L %l (C %c): %*[a-zA-Z0-9]: %m,L %l (C %c-%*[0-9]): %*[a-zA-Z0-9]: %m'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr("")} })
endfunction

View File

@@ -0,0 +1,89 @@
"============================================================================
"File: ocaml.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Török Edwin <edwintorok at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
"
" By default the camlp4o preprocessor is used to check the syntax of .ml, and .mli files,
" ocamllex is used to check .mll files and menhir is used to check .mly files.
" The output is all redirected to /dev/null, nothing is written to the disk.
"
" If your source code needs camlp4r then you can define this in your .vimrc:
"
" let g:syntastic_ocaml_camlp4r = 1
"
" If you used some syntax extensions, or you want to also typecheck the source
" code, then you can define this:
"
" let g:syntastic_ocaml_use_ocamlbuild = 1
"
" This will run ocamlbuild <name>.inferred.mli, so it will write to your _build
" directory (and possibly rebuild your myocamlbuild.ml plugin), only enable this
" if you are ok with that.
"
" If you are using syntax extensions / external libraries and have a properly
" set up _tags (and myocamlbuild.ml file) then it should just work
" to enable this flag and get syntax / type checks through syntastic.
"
" For best results your current directory should be the project root
" (same situation if you want useful output from :make).
if exists("loaded_ocaml_syntax_checker")
finish
endif
let loaded_ocaml_syntax_checker = 1
if exists('g:syntastic_ocaml_camlp4r') &&
\ g:syntastic_ocaml_camlp4r != 0
let s:ocamlpp="camlp4r"
else
let s:ocamlpp="camlp4o"
endif
"bail if the user doesnt have the preprocessor
if !executable(s:ocamlpp)
finish
endif
function! SyntaxCheckers_ocaml_GetLocList()
if exists('g:syntastic_ocaml_use_ocamlbuild') &&
\ g:syntastic_ocaml_use_ocamlbuild != 0 &&
\ executable("ocamlbuild") &&
\ isdirectory('_build')
let makeprg = "ocamlbuild -quiet -no-log -tag annot,". s:ocamlpp. " -no-links -no-hygiene -no-sanitize ".
\ shellescape(expand('%:r')).".cmi"
else
let extension = expand('%:e')
if match(extension, 'mly') >= 0
" ocamlyacc output can't be redirected, so use menhir
if !executable("menhir")
return []
endif
let makeprg = "menhir --only-preprocess ".shellescape(expand('%')) . " >/dev/null"
elseif match(extension,'mll') >= 0
if !executable("ocamllex")
return []
endif
let makeprg = "ocamllex -q -o /dev/null ".shellescape(expand('%'))
else
let makeprg = "camlp4o -o /dev/null ".shellescape(expand('%'))
endif
endif
let errorformat = '%AFile "%f"\, line %l\, characters %c-%*\d:,'.
\ '%AFile "%f"\, line %l\, characters %c-%*\d (end at line %*\d\, character %*\d):,'.
\ '%AFile "%f"\, line %l\, character %c:,'.
\ '%AFile "%f"\, line %l\, character %c:%m,'.
\ '%-GPreprocessing error %.%#,'.
\ '%-GCommand exited %.%#,'.
\ '%C%tarning %n: %m,'.
\ '%C%m,'.
\ '%-G+%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -0,0 +1,29 @@
"============================================================================
"File: perl.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Anthony Carapetis <anthony.carapetis at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("loaded_perl_syntax_checker")
finish
endif
let loaded_perl_syntax_checker = 1
"bail if the user doesnt have perl installed
if !executable("perl")
finish
endif
let s:checker = 'perl ' . shellescape(expand('<sfile>:p:h') . '/efm_perl.pl') . ' -c'
function! SyntaxCheckers_perl_GetLocList()
let makeprg = s:checker . ' ' . shellescape(expand('%'))
let errorformat = '%f:%l:%m'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -0,0 +1,58 @@
"============================================================================
"File: php.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("loaded_php_syntax_checker")
finish
endif
let loaded_php_syntax_checker = 1
"bail if the user doesnt have php installed
if !executable("php")
finish
endif
"Support passing configuration directives to phpcs
if !exists("g:syntastic_phpcs_conf")
let g:syntastic_phpcs_conf = ""
endif
if !exists("g:syntastic_phpcs_disable")
let g:syntastic_phpcs_disable = 0
endif
function! SyntaxCheckers_php_Term(item)
let unexpected = matchstr(a:item['text'], "unexpected '[^']\\+'")
if len(unexpected) < 1 | return '' | end
return '\V'.split(unexpected, "'")[1]
endfunction
function! SyntaxCheckers_php_GetLocList()
let errors = []
let makeprg = "php -l ".shellescape(expand('%'))
let errorformat='%-GNo syntax errors detected in%.%#,PHP Parse error: %#syntax %trror\, %m in %f on line %l,PHP Fatal %trror: %m in %f on line %l,%-GErrors parsing %.%#,%-G\s%#,Parse error: %#syntax %trror\, %m in %f on line %l,Fatal %trror: %m in %f on line %l'
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
if empty(errors) && !g:syntastic_phpcs_disable && executable("phpcs")
let errors = errors + s:GetPHPCSErrors()
endif
call SyntasticHighlightErrors(errors, function('SyntaxCheckers_php_Term'))
return errors
endfunction
function! s:GetPHPCSErrors()
let makeprg = "phpcs " . g:syntastic_phpcs_conf . " --report=csv ".shellescape(expand('%'))
let errorformat = '%-GFile\,Line\,Column\,Type\,Message\,Source\,Severity,"%f"\,%l\,%c\,%t%*[a-zA-Z]\,"%m"\,%*[a-zA-Z0-9_.-]\,%*[0-9]'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'subtype': 'Style' })
endfunction

View File

@@ -0,0 +1,54 @@
"============================================================================
"File: puppet.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Eivind Uggedal <eivind at uggedal dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("loaded_puppet_syntax_checker")
finish
endif
let loaded_puppet_syntax_checker = 1
"bail if the user doesnt have puppet installed
if !executable("puppet")
finish
endif
function! s:ExtractVersion()
let output = system("puppet --version")
let output = substitute(output, '\n$', '', '')
return split(output, '\.')
endfunction
let s:puppetVersion = s:ExtractVersion()
function! SyntaxCheckers_puppet_GetLocList()
"If puppet is >= version 2.7 then use the new executable
if s:puppetVersion[0] >= '2' && s:puppetVersion[1] >= '7'
let makeprg = 'puppet parser validate ' .
\ shellescape(expand('%')) .
\ ' --color=false' .
\ ' --storeconfigs'
"add --ignoreimport for versions < 2.7.10
if s:puppetVersion[2] < '10'
let makeprg .= ' --ignoreimport'
endif
else
let makeprg = 'puppet --color=false --parseonly --ignoreimport '.shellescape(expand('%'))
endif
"some versions of puppet (e.g. 2.7.10) output the message below if there
"are any syntax errors
let errorformat = '%-Gerr: Try ''puppet help parser validate'' for usage,'
let errorformat .= 'err: Could not parse for environment %*[a-z]: %m at %f:%l'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -0,0 +1,80 @@
"============================================================================
"File: python.vim
"Description: Syntax checking plugin for syntastic.vim
"
"Authors: Martin Grenfell <martin.grenfell@gmail.com>
" kstep <me@kstep.me>
" Parantapa Bhattacharya <parantapa@gmail.com>
"
"============================================================================
"
" For forcing the use of flake8, pyflakes, or pylint set
"
" let g:syntastic_python_checker = 'pyflakes'
"
" in your .vimrc. Default is flake8.
if exists("loaded_python_syntax_checker")
finish
endif
let loaded_python_syntax_checker = 1
"bail if the user doesnt have his favorite checker or flake8 or pyflakes installed
if !exists('g:syntastic_python_checker') || !executable(g:syntastic_python_checker)
if executable("flake8")
let g:syntastic_python_checker = 'flake8'
elseif executable("pyflakes")
let g:syntastic_python_checker = 'pyflakes'
elseif executable("pylint")
let g:syntastic_python_checker = 'pylint'
else
finish
endif
endif
if !exists('g:syntastic_python_checker_args')
let g:syntastic_python_checker_args = ''
endif
function! SyntaxCheckers_python_Term(i)
if a:i['type'] ==# 'E'
let a:i['text'] = "Syntax error"
endif
if match(a:i['text'], 'is assigned to but never used') > -1
\ || match(a:i['text'], 'imported but unused') > -1
\ || match(a:i['text'], 'undefined name') > -1
\ || match(a:i['text'], 'redefinition of') > -1
\ || match(a:i['text'], 'referenced before assignment') > -1
\ || match(a:i['text'], 'duplicate argument') > -1
\ || match(a:i['text'], 'after other statements') > -1
\ || match(a:i['text'], 'shadowed by loop variable') > -1
let term = split(a:i['text'], "'", 1)[1]
return '\V\<'.term.'\>'
endif
return ''
endfunction
if g:syntastic_python_checker == 'pylint'
function! SyntaxCheckers_python_GetLocList()
let makeprg = 'pylint -f parseable -r n -i y ' .
\ shellescape(expand('%')) .
\ ' \| sed ''s_: \[[RC]_: \[W_''' .
\ ' \| sed ''s_: \[[F]_:\ \[E_'''
let errorformat = '%f:%l: [%t%n] %m,%-GNo config%m'
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
return errors
endfunction
else
function! SyntaxCheckers_python_GetLocList()
let makeprg = g:syntastic_python_checker.' '.g:syntastic_python_checker_args.' '.shellescape(expand('%'))
let errorformat =
\ '%E%f:%l: could not compile,%-Z%p^,%W%f:%l:%c: %m,%W%f:%l: %m,%-G%.%#'
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
call SyntasticHighlightErrors(errors, function('SyntaxCheckers_python_Term'))
return errors
endfunction
endif

View File

@@ -0,0 +1,37 @@
"============================================================================
"File: rst.vim
"Description: Syntax checking plugin for docutil's reStructuredText files
"Maintainer: James Rowe <jnrowe at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
" We use rst2pseudoxml.py, as it is ever so marginally faster than the other
" rst2${x} tools in docutils.
if exists("loaded_rst_syntax_checker")
finish
endif
let loaded_rst_syntax_checker = 1
"bail if the user doesn't have rst2pseudoxml.py installed
if !executable("rst2pseudoxml.py")
finish
endif
function! SyntaxCheckers_rst_GetLocList()
let makeprg = 'rst2pseudoxml.py --report=1 --exit-status=1 ' .
\ shellescape(expand('%')) . ' /dev/null'
let errorformat = '%f:%l:\ (%tNFO/1)\ %m,
\%f:%l:\ (%tARNING/2)\ %m,
\%f:%l:\ (%tRROR/3)\ %m,
\%f:%l:\ (%tEVERE/4)\ %m,
\%-G%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -0,0 +1,32 @@
"============================================================================
"File: ruby.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("loaded_ruby_syntax_checker")
finish
endif
let loaded_ruby_syntax_checker = 1
"bail if the user doesnt have ruby installed
if !executable("ruby")
finish
endif
function! SyntaxCheckers_ruby_GetLocList()
" we cannot set RUBYOPT on windows like that
if has('win32') || has('win64')
let makeprg = 'ruby -W1 -T1 -c '.shellescape(expand('%'))
else
let makeprg = 'RUBYOPT= ruby -W1 -c '.shellescape(expand('%'))
endif
let errorformat = '%-GSyntax OK,%E%f:%l: syntax error\, %m,%Z%p^,%W%f:%l: warning: %m,%Z%p^,%W%f:%l: %m,%-C%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -0,0 +1,33 @@
"============================================================================
"File: rust.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Chad Jablonski <chad.jablonski at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("loaded_rust_syntax_checker")
finish
endif
let loaded_rust_syntax_checker = 1
"bail if the user doesnt have rustc installed
if !executable("rustc")
finish
endif
function! SyntaxCheckers_rust_GetLocList()
let makeprg = 'rustc --parse-only '.shellescape(expand('%'))
let errorformat = '%E%f:%l:%c: \\d%#:\\d%# %.%\{-}error:%.%\{-} %m,' .
\ '%W%f:%l:%c: \\d%#:\\d%# %.%\{-}warning:%.%\{-} %m,' .
\ '%C%f:%l %m,' .
\ '%-Z%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -0,0 +1,35 @@
"============================================================================
"File: sass.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("loaded_sass_syntax_checker")
finish
endif
let loaded_sass_syntax_checker = 1
"bail if the user doesnt have the sass binary installed
if !executable("sass")
finish
endif
"use compass imports if available
let s:imports = ""
if executable("compass")
let s:imports = "--compass"
endif
function! SyntaxCheckers_sass_GetLocList()
let makeprg='sass '.s:imports.' --check '.shellescape(expand('%'))
let errorformat = '%ESyntax %trror:%m,%C on line %l of %f,%Z%.%#'
let errorformat .= ',%Wwarning on line %l:,%Z%m,Syntax %trror on line %l: %m'
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
return loclist
endfunction

View File

@@ -0,0 +1,27 @@
"============================================================================
"File: scss.vim
"Description: scss syntax checking plugin for syntastic
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("loaded_scss_syntax_checker")
finish
endif
let loaded_scss_syntax_checker = 1
"bail if the user doesnt have the sass binary installed
if !executable("sass")
finish
endif
runtime syntax_checkers/sass.vim
function! SyntaxCheckers_scss_GetLocList()
return SyntaxCheckers_sass_GetLocList()
endfunction

View File

@@ -0,0 +1,52 @@
"============================================================================
"File: sh.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Gregor Uhlenheuer <kongo2002 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('loaded_sh_syntax_checker')
finish
endif
let loaded_sh_syntax_checker = 1
function! s:GetShell()
if !exists('b:shell') || b:shell == ""
let b:shell = ''
let shebang = getbufline(bufnr('%'), 1)[0]
if len(shebang) > 0
if match(shebang, 'bash') >= 0
let b:shell = 'bash'
elseif match(shebang, 'zsh') >= 0
let b:shell = 'zsh'
elseif match(shebang, 'sh') >= 0
let b:shell = 'sh'
endif
endif
endif
return b:shell
endfunction
function! SyntaxCheckers_sh_GetLocList()
if len(s:GetShell()) == 0 || !executable(s:GetShell())
return []
endif
let output = split(system(s:GetShell().' -n '.shellescape(expand('%'))), '\n')
if v:shell_error != 0
let result = []
for err_line in output
let line = substitute(err_line, '^[^:]*:\D\{-}\(\d\+\):.*', '\1', '')
let msg = substitute(err_line, '^[^:]*:\D\{-}\d\+: \(.*\)', '\1', '')
call add(result, {'lnum' : line,
\ 'text' : msg,
\ 'bufnr': bufnr(''),
\ 'type': 'E' })
endfor
return result
endif
return []
endfunction

View File

@@ -0,0 +1,28 @@
"============================================================================
"File: tcl.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Eric Thomas <eric.l.m.thomas at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("loaded_tcl_syntax_checker")
finish
endif
let loaded_tcl_syntax_checker = 1
"bail if the user doesnt have tclsh installed
if !executable("tclsh")
finish
endif
function! SyntaxCheckers_tcl_GetLocList()
let makeprg = 'tclsh '.shellescape(expand('%'))
let errorformat = '%f:%l:%m'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -0,0 +1,26 @@
"============================================================================
"File: tex.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("loaded_tex_syntax_checker")
finish
endif
let loaded_tex_syntax_checker = 1
"bail if the user doesnt have lacheck installed
if !executable("lacheck")
finish
endif
function! SyntaxCheckers_tex_GetLocList()
let makeprg = 'lacheck '.shellescape(expand('%'))
let errorformat = '%-G** %f:,%E"%f"\, line %l: %m'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -0,0 +1,56 @@
"============================================================================
"File: vala.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Konstantin Stepanov (me@kstep.me)
"Notes: Add special comment line into your vala file starting with
" "// modules: " and containing space delimited list of vala
" modules, used by the file, so this script can build correct
" --pkg arguments.
" Valac compiler is not the fastest thing in the world, so you
" may want to disable this plugin with
" let g:syntastic_vala_check_disabled = 1 command in your .vimrc or
" command line. Unlet this variable to set it to 0 to reenable
" this checker.
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('loaded_vala_syntax_checker')
finish
endif
let loaded_vala_syntax_checker = 1
if !executable('valac')
finish
endif
if exists('g:syntastic_vala_check_disabled') && g:syntastic_vala_check_disabled
finish
endif
function! SyntaxCheckers_vala_Term(pos)
let strlength = strlen(matchstr(a:pos['text'], '\^\+$'))
return '\%>'.(a:pos.col-1).'c.*\%<'.(a:pos.col+strlength+1).'c'
endfunction
function! s:GetValaModules()
let modules_line = search('^// modules: ', 'n')
let modules_str = getline(modules_line)
let modules = split(strpart(modules_str, 12), '\s\+')
return modules
endfunction
function! SyntaxCheckers_vala_GetLocList()
let vala_pkg_args = join(map(s:GetValaModules(), '"--pkg ".v:val'), ' ')
let makeprg = 'valac -C ' . vala_pkg_args . ' ' .shellescape(expand('%'))
let errorformat = '%A%f:%l.%c-%\d%\+.%\d%\+: %t%[a-z]%\+: %m,%C%m,%Z%m'
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
call SyntasticHighlightErrors(loclist, function("SyntaxCheckers_vala_Term"), 1)
return loclist
endfunction

View File

@@ -0,0 +1,46 @@
"============================================================================
"File: xhtml.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("loaded_xhtml_syntax_checker")
finish
endif
let loaded_xhtml_syntax_checker = 1
"bail if the user doesnt have tidy or grep installed
if !executable("tidy")
finish
endif
" TODO: join this with html.vim DRY's sake?
function! s:TidyEncOptByFenc()
let tidy_opts = {
\'utf-8' : '-utf8',
\'ascii' : '-ascii',
\'latin1' : '-latin1',
\'iso-2022-jp' : '-iso-2022',
\'cp1252' : '-win1252',
\'macroman' : '-mac',
\'utf-16le' : '-utf16le',
\'utf-16' : '-utf16',
\'big5' : '-big5',
\'sjis' : '-shiftjis',
\'cp850' : '-ibm858',
\}
return get(tidy_opts, &fileencoding, '-utf8')
endfunction
function! SyntaxCheckers_xhtml_GetLocList()
let encopt = s:TidyEncOptByFenc()
let makeprg="tidy ".encopt." -xml -e ".shellescape(expand('%'))
let errorformat='%Wline %l column %c - Warning: %m,%Eline %l column %c - Error: %m,%-G%.%#,%-G%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr("")} })
endfunction

View File

@@ -0,0 +1,42 @@
"============================================================================
"File: xml.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Sebastian Kusnier <sebastian at kusnier dot net>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
" You can use a local installation of DTDs to significantly speed up validation
" and allow you to validate XML data without network access, see xmlcatalog(1)
" and http://www.xmlsoft.org/catalog.html for more information.
if exists("loaded_xml_syntax_checker")
finish
endif
let loaded_xml_syntax_checker = 1
"bail if the user doesnt have tidy or grep installed
if !executable("xmllint")
finish
endif
function! SyntaxCheckers_xml_GetLocList()
let makeprg="xmllint --xinclude --noout --postvalid " . shellescape(expand("%:p"))
let errorformat='%E%f:%l:\ error\ :\ %m,
\%-G%f:%l:\ validity\ error\ :\ Validation\ failed:\ no\ DTD\ found\ %m,
\%W%f:%l:\ warning\ :\ %m,
\%W%f:%l:\ validity\ warning\ :\ %m,
\%E%f:%l:\ validity\ error\ :\ %m,
\%E%f:%l:\ parser\ error\ :\ %m,
\%E%f:%l:\ %m,
\%-Z%p^,
\%-G%.%#'
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
return loclist
endfunction

View File

@@ -0,0 +1,38 @@
"============================================================================
"File: xslt.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Sebastian Kusnier <sebastian at kusnier dot net>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("loaded_xslt_syntax_checker")
finish
endif
let loaded_xslt_syntax_checker = 1
"bail if the user doesnt have tidy or grep installed
if !executable("xmllint")
finish
endif
function! SyntaxCheckers_xslt_GetLocList()
let makeprg="xmllint --xinclude --noout --postvalid " . shellescape(expand("%:p"))
let errorformat='%E%f:%l:\ error\ :\ %m,
\%-G%f:%l:\ validity\ error\ :\ Validation\ failed:\ no\ DTD\ found\ %m,
\%W%f:%l:\ warning\ :\ %m,
\%W%f:%l:\ validity\ warning\ :\ %m,
\%E%f:%l:\ validity\ error\ :\ %m,
\%E%f:%l:\ parser\ error\ :\ %m,
\%E%f:%l:\ namespace\ error\ :\ %m,
\%E%f:%l:\ %m,
\%-Z%p^,
\%-G%.%#'
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
return loclist
endfunction

View File

@@ -0,0 +1,30 @@
"============================================================================
"File: yaml.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"
"Installation: $ npm install -g js-yaml.bin
"
"============================================================================
if exists("loaded_yaml_syntax_checker")
finish
endif
let loaded_yaml_syntax_checker = 1
if !executable("js-yaml")
finish
endif
function! SyntaxCheckers_yaml_GetLocList()
let makeprg='js-yaml --compact ' . shellescape(expand('%'))
let errorformat='Error on line %l\, col %c:%m,%-G%.%#'
return SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")} })
endfunction

View File

@@ -0,0 +1,36 @@
"============================================================================
"File: zpt.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: claytron <robots at claytron dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
" In order for this plugin to be useful, you will need to set up the
" zpt filetype in your vimrc
"
" " set up zope page templates as the zpt filetype
" au BufNewFile,BufRead *.pt,*.cpt,*.zpt set filetype=zpt syntax=xml
"
" Then install the zptlint program, found on pypi:
" http://pypi.python.org/pypi/zptlint
if exists("loaded_zpt_syntax_checker")
finish
endif
let loaded_zpt_syntax_checker = 1
" Bail if the user doesn't have zptlint installed
if !executable("zptlint")
finish
endif
function! SyntaxCheckers_zpt_GetLocList()
let makeprg="zptlint ".shellescape(expand('%'))
let errorformat='%-P*** Error in: %f,%Z%*\s\, at line %l\, column %c,%E%*\s%m,%-Q'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction