sponsor Vim development Vim logo Vim Book Ad

checksyntax : Check for syntax erros (r, javascript, php, ruby, tex ...)

 script karma  Rating 93/42, Downloaded by 5361    Comments, bugs, improvements  Vim wiki

created by
Tom Link
 
script type
utility
 
description
http://github.com/tomtom/checksyntax_vim

The checksyntax plugin runs an external syntax checker for the current buffer
whenever the buffer is saved (by calling the |:CheckSyntax| command). Syntax
errors are managed as location or quickfix lists. If any syntax error occurs,
the |location-list| is opened (users can redefine |CheckSyntaxFail()| to change
this behaviour). You can use any |location-list| related command to navigate
the list of syntax errors.

If quickfixsigns (vimscript #2584) is installed, lines containing syntax errors
will be marked with signs.

Experimental: If AsyncCommand (vimscript #3431) is installed, syntax checks can
be peformed asynchronously -- see also |g:checksyntax#run_alternatives|,
|g:checksyntax#run_all_alternatives| and |g:checksyntax#async_runner|.

By default, |:CheckSyntax| is mapped to <F5> (if not mapped already),
and automatically executed when saving the buffer. :CheckSyntax! or <C-F5> will
run all syntax checkers for a given filetype if multiple alternatives are
defined and installed on your computer.

The |:CheckSyntax| command takes one optional argument: the mode (default:
&filetype).

As the plugin doesn't provide syntax checks by its own. This is done by
an external syntax checker that has to be installed on your computer.

For the following filetypes, syntax checkers are pre-defined:

    c, cpp :: Check syntax via splint
    html :: Check syntax via tidy
    javascript :: Check syntax via jslint, jshint, jsl, or gjslint
    java :: Check syntax via jlint or javaCheckstyle
    lua :: Parse file (luac -p)
    php  :: Check syntax (php -l)
    python :: Check file with pyflakes or pylint
    r :: Check syntax & style with codetools::checkUsage, lint::lint or svTools::lint
    ruby :: Check syntax (ruby -c)
    tex, latex :: Parse file (chktex -q -v0)
    xml, docbk :: Check syntax via xmllint

See the autoload/checksyntax/defs/ directory for a complete list of
supported syntax checkers. See |g:checksyntax| also for how to define
your own syntax checkers.
 
install details
Edit the vba file and type: >

    :so %

See :help vimball for details.

As the plugin doesn't provide syntax checks by its own, the external
syntax checker has to be installed on your computer.

Optional enhancements:

    quickfixsigns (vimscript #2584) ... Use signs
    AsyncCommand (vimscript #3431) ... Run commands asynchronously
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
checksyntax.vba 4.03 2014-03-26 7.0 Tom Link - g:checksyntax#null: upper-case NUL
- Don't perform auto-checks when dying
- g:checksyntax_enable_syntax: Highlight frequent beginner errors by means of regexps; set s:vimleave on VimLeave
- g:checksyntax_enable_syntax: Improved handling; option to mark trailing whitespace
- checksyntax_enable_syntax: Use own highlight group
- vim syntax: Minor improvments
- javascript: FIX no scope for global variables
- Support for haxe
- haxe: use -D no-compilation
- FIX #19: Don't emulate autochdir if it isn't enabled
- g:checksyntax_enable_syntax: disable by default
MD5 checksum: 2870d7ccd62e1d7990665b07123c9da0
checksyntax.vba 4.02 2014-03-06 7.0 Tom Link - checksyntax#Check(): Use fnameescape() for :lcd
- php: Facilitate changing cmd & args
- s:Executable(): Fix windows vs cygwin executables
- r: Disable svTools::lint (it's only a shortcut to codetools)
MD5 checksum: 59a1082c5e936b66f38b4a9e873516eb
checksyntax.vba 4.01 2014-02-26 7.0 Tom Link - Fix #17: error when running with noautochdir
- Remove debug info
MD5 checksum: 59458811257639ba95f13068aa0d289f
checksyntax.vba 4.00 2014-02-24 7.0 Tom Link - Move AsyncCommand related code to autoload/checksyntax/async/asynccommand.vim
- Check validity of g:checksyntax#async_runner only when running an async check
- Compile to /dev/null; properly handle tasks for async tasks
- g:checksyntax#auto_enable_rx and g:checksyntax#auto_disable_rx replace g:checksyntax#auto_mode
- javascript: Initial support for checkTypes by closure compiler
- javascript: closure: g:checksyntax#defs#javascript#closure_warnings
- Misc changes (use checksyntax#AddChecker() to define checkers) & cleanup
- Don't use async if v:servername is empty (vim with clientserver)
- Re-enable support for "top-level field"; some support for cygwin; misc improvements
- Don't check for cygwin on non-windows OS
- FIX pass filename when running synchronously
- Minor improvement to acync commands
- Support for scalastyle
- Improved use of scalastyle
- Support for pmd (java, javascript, xml); new options: cmd_args, buffers
- Disable support for jlint
- pmd: Use cmdexpr to provide for buffer-local options
- Don't run make_def, if cmd is set but empty
- scala: Use sbt scalastyle if there is a scalastyle-config.xml in the same dir as build.sbt
- Make the qfl/loc window adapt to the length of the issues list
- Facilitate configuration of showing the error list
- Use :resize to set qfl window height
MD5 checksum: 1838eb8aeb4748b55d50511fc9fc6380
checksyntax.vba 3.00 2014-02-07 7.0 Tom Link - addon-info
- Help template
- g:checksyntax#preferred defaults to {'xml': '.'}
- g:checksyntax['xml'] use auto: 0 for xmllint
- javascript: Support for esvalidate (esprima)
- javascript: default to jshint
- Support for running checkers asynchronously (requires the AsyncCommand vim plugin)
- Updated errorformat for jslint 0.2.7
- Support for typescript compiler (requires https://github.com/leafgarland/typescript-vim)
- Experimental: Enable async processing when performing a full check (:CheckSyntax!) if AsyncCommand is installed
- checksyntax#Check(): When mixing async & sync processing, don't show issue list if a check is still pending
- When mixing sync & async & no pending checks: Include async results in sync results
- Removed support for syntastic
- async_handler.get(): Properly handle issues list when the last check yielded no new issues
- Use job_ids to check for pending tasks
- g:checksyntax#async_runner and related vars is set based on exists(':AsyncMake')
- Show info about pending jobs (also support toptions_vim)
- Correctly handle makeprgs with full filename
- GetList(): Correctly handle "process_list" property
- r options: Add --ess
- Reset pending tasks, when calling CheckSyntax before all async tasks were completed
- Improved integration with toptions_vim
- R checker defaults to codetools::checkUsage
- Tentative integration with airline
- Support for tstatus (replaces toptions)
MD5 checksum: c9a7ae5304038568ea2309ed13c8ed96
checksyntax.vba 2.03 2013-01-06 7.0 Tom Link - Included missing files in vba (fixes #16)
MD5 checksum: 40c9ea31d916db1ff5f22ec1c4af14c3
checksyntax.vba 2.02 2012-11-23 7.0 Tom Link - Support for perl (by TheAthlete)
- s:Make(): Echo v:exception & v:throwpoint
- checksyntax#Alternative(): Copy top-level properties
- Don't change the checker definition when dealing with alternatives (reported by techlivezheng)
MD5 checksum: d2d95bcff1d039497bc9c95cdb7a0ea1
checksyntax.vba 2.01 2012-08-28 7.0 Tom Link - Extra syntax checker definitions was prematurely removed after running a single syntax checker
- Facilitate customization of maps (g:checksyntax_key_single, g:checksyntax_key_all)
- process_list attribute for syntax checker definitions
- Support for R (lint::lint, svTools::lint)
- s:Executable(): Run executable() only once
- SyntasticLoadChecker(): Accept filetype as optional argument
- Support for jshint
MD5 checksum: 617a9cc8fd1fac7533e75b721106f2ad
checksyntax.vba 2.00 2012-08-27 7.0 Tom Link - Enable syntax checks when loading a file (disabled by default)
- g:checksyntax#auto_mode: Default auto mode (fixes #10)
- g:checksyntax#debug
- s:GetDef(ft): Remove syntax checker definition if the command is not executable
- Fix duplicate errors (closes bug #7)
- checksyntax#auto_mode: 0 disable, 1 enable, 2 force (fixes #12)
- checksyntax: "if" and "alternatives" fields; removed g:checksyntax_javascript
- define g:checksyntax in plugin/checksyntax.vim in order to facilitate customisation
- s:GetDef(ft): If empty(rv), check if the rest of alternatives is empty
- Move syntax checker definitions to autoload/checksyntax/&filetype.vim
- php: run with php -l -d error_log= -d error_reporting=E_PARSE
- Remove outdated references to failrx and okrx
- Move syntax checker definitions to autoload/checksyntax/defs/
- Experimental support for syntastic syntax checkers.
- debug message
- Support for SyntasticLoadChecker()
- checksyntax#Require(): Return 0 if filetype is empty
- efm for jruby (see https://github.com/tomtom/checksyntax_vim/pull/13)
- Run php with "-d display_errors=0" (fixes #7)
- php: Use -d display_errors=0
- checksyntax#syntastic#Require(): Make sure not to replace existing defintions
- Experimental: Prepare for running all valid alternatives
- Prepare for run_alternatives == "all"
- Javascript: Support for jslint (fixes #14)
- Run multiple syntax checkers (fixes #15)
- javascript: Remove run_alternatives = all
- Improved running all alternatives
- Improved support for syntastic syntax checkers (in conjunction with run_alternatives == all)
- :CheckSyntax! runs all alternatives (not the alternative syntax checker); use g:checksyntax#preferred for selecting the preferred checker
- checksyntax#Name(): Also consider the value of compiler
- s:CompleteItem(): Improved display of error message
- checksyntax#Alternative(): Define an alternative
- Updated syntax checker definitions for java, php, python
- checksyntax#syntastic#Require(): Use checksyntax#Alternative()
- checksyntax#syntastic#Require(): handle yet undefined filetypes
- Syntastic: Improved display of the checker name
- Support for bash -n
- Call bash -n only if shell =~ bash
- Facilitate configuration of g:checksyntax#prototypes.
- Map <c-f5> to CheckSyntax!
MD5 checksum: dfe8b09008f5106fdf7886d4c4cd5fb6
checksyntax.vba 1.03 2012-01-21 7.0 Tom Link - checksyntax#Check: Check &modified before anything else
- .gitignore
- Support for "modified" property
- Check executable() when setting the *.auto property.
- When eclim is installed: Set g:checksyntax.php.auto, not b:checksyntax.php.auto
- Do not map `<F5>` if it is used already.
- Use either location list (default) or optionally the quickfix list
- CheckSyntaxFail(): call .Open(); fixes #6
- Tackle issue #7 ... maybe
- php is now forced to display parse errors even when in production mode
- Rename s:prototypes to g:checksyntax#prototypes
MD5 checksum: dfe8b09008f5106fdf7886d4c4cd5fb6
checksyntax.vba 1.01 2011-05-26 7.0 Tom Link - checksyntax#Check: Check &modified before anything else
- .gitignore
- Support for "modified" property
- Check executable() when setting the *.auto property.
- When eclim is installed: Set g:checksyntax.php.auto, not b:checksyntax.php.auto
- Do not map `<F5>` if it is used already.
- Use either location list (default) or optionally the quickfix list
- CheckSyntaxFail(): call .Open(); fixes #6
MD5 checksum: 4425f1434baa8795fbccec38721eef67
checksyntax.vba 1.01 2010-11-11 7.0 Tom Link - Experimental support for python: pyflakes, pylint
- redraw before calling CheckSyntaxSucceed/CheckSyntaxFail
- Make sure we're in the right buffer
MD5 checksum: f94781c5748200e809a28562a692ed6b
checksyntax.vba 1.0 2010-10-29 7.0 Tom Link - checksyntax_compiler_{&ft} & checksyntax_cmd_{&ft} variables can be buffer local
- The info maintained as g:checksyntax_* variables is now kept in a dictionary named g:checksyntax
- Support for gjslint
- Some bug fixes (e.g. tidy)
checksyntax.vba.gz 0.5 2009-09-26 7.0 Tom Link - use vim compilers if available (e.g., tidy, xmllint ...)
- Support for jsl (javascript lint).
- Support for jlint.
- Support for lua (thanks to norman)
- Don't automatically check php files if eclim is installed.
- Allow auto_* parameters to be buffer local.
- FIX: Unlet current_compiler, use g:current_compiler
- FIX: garbled screen: use redraw! (thanks to Vincent de Lau)
- FIX: makeprg was restored in the wrong window
checksyntax.zip 0.3 2005-12-12 6.0 Tom Link Initial upload
ip used for rating: 50.19.148.56

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo