checksyntax : Check for syntax errors (r, javascript, php, ruby, tex ...)
script karma |
Rating 103/46,
Downloaded by 10912 |
Comments, bugs, improvements
|
Vim wiki
|
created by |
Tom Link |
|
script type |
utility |
|
description |
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.
Most syntax checks can be run asynchronously (from Vim 8 onwards or, for
Vim 7, if the AsyncCommand plugin is installed).
Invocation~
Manual invocation:
By default, |:CheckSyntax| is mapped to <F5> (if not mapped already), and
automatically executed when saving the buffer. If multiple syntax checkers are
defined for the given filetype, this will by default invoke the preferred (see
|g:checksyntax#preferred|) or first good (i.e. installed) syntax checker for a
given filetype.
:CheckSyntax! (with the optional <bang>) or <C-F5> will run all supported
syntax checkers for a given filetype if multiple syntax checkers are defined
for a given filetype and if the software is installed on your computer.
Automatic invocation:
In order to automatically run a syntax check when saving a file, please set
|g:checksyntax#auto_filetypes| or |g:checksyntax#auto_enable_rx| to an
appropriate value. If |g:checksyntax#auto_enable_rx| is set to '.', which
matches all filetypes, automatic syntax checks are enabled for all supported
filetypes. Automatic checks are equivalent to running |:CheckSyntax| with no
<bang>.
Supported filetypes~
The syntax checks are performed by external syntax checker. This software has
to be installed on your computer. Pre-defined syntax checkers are:
bash ... shellcheck, bash -n
c, cpp ... splint
haskell ... hlint, ghc-mod-check
html ... tidy
java ... jlint, checkstyle, pmd
javascript ... jshint, esprima, gjslint, jslint, jsl, pmd
lua ... luac (run luac -p)
perl ... perl (run perl -Wc)
php ... php (run php -l)
python ... pyflakes or pylint
r ... lintr
ruby ... ruby (run ruby -c)
tex, latex ... chktex (run chktex -q -v0)
typescript ... tsc
viki ... deplate
vim ... vint
xhtml ... tidy
xml, docbk ... xmllint, pmd
Syntax checker definitions are kept in:
autoload/checksyntax/defs/{&filetype}.vim
Run this command to find out, which filetypes are supported: >
:echo globpath(&rtp, 'autoload/checksyntax/defs/*.vim')
|
|
install details |
Edit the vba file and type: >
:so %
See :help vimball for details. If you have difficulties or use vim 7.0,
please make sure, you have the current version of vimball (vimscript
#1502) installed or update your runtime.
Also available via git: http://github.com/tomtom/checksyntax_vim/
Optional enhancements~
If the quickfixsigns plugin (vimscript #2584) is installed, lines containing
syntax errors will be marked with signs.
The tinykeymap plugin (vimscript #4199) can be used to quickly move from one
issue to the next by using it's quickfix or location-list maps (see
|g:tinykeymap#map#qfl#map| and |g:tinykeymap#map#loc#map|).
For vim8+: Checks will be run asynchronously by default.
For vim7: 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|. This
requires a version of vim with |clientserver| support and |v:servername| to be
set (for vim see also |--servername|).
|
|
script versions (upload new version)
Click on the package to download.
checksyntax.zip |
5.00 |
2017-03-11 |
7.0 |
Tom Link |
- Renamed g:checksyntax_enable_syntax to g:checksyntax#enable_syntax (allow g:checksyntax#enable_syntax_{&ft}; g:checksyntax#enable_syntax_ - Trailing whitespace: Ignore before cursor position - tabs: highlight tabs - checkergen: JIT generation of checker definitions (e.g. multiple targets for haxe) - FIX #20: missing comma in defs/lua.vim - FIX #21: s:Open(): lines was undefined - VimCheckSyntaxError: if =: ignore text after a "|" char - s:Open(): redraw! after resize - checksyntax#defs#haxe#Gen(): chxml is undefined if :HaxeCtags does not exist - FIX #22: mention perl support in docs - checksyntax#GetList(): Return only unique items - async_handler.get: Set bg & manually - Haskell: Support for hlint - vim syntax: Highlight "else if" - haskell: Support for ghc-mod check - checksyntax#Check(): check if key "make_defs" exists - Support for shellcheck - Initial support for rust - Scala: use fsc for basic checks - Scala: use -Xlint - FIX #24: Default value for g:checksyntax#async_runner - Add flake8 for checking python syntax and fix a bug - Simple definition for checking sourcode written in Google Go - Merge pull request #26 from thorn1976/master - s:GetDefsByFiletype(): Return {} if buffer was modified - Duplicate helptags - Merge pull request #25 from yan12125/master - FIX #25: s:GetValidAlternatives(): correct handling of "first" option - FIX #27: perl: Don't include -W flag - checksyntax#Check(): preferred_rx as 3th optional argument - checksyntax#RemoveJob(): Call TStatusForceUpdate() if necessary - haxe: Support for checksyntax - Add PHP_CodeSniffer checker for php. - phpcs: Use correct autoload variable names - php: Support for phpcs - tstatus integration - javascript: Updated gjslint definition - Merge pull request #31 from machinshin/patch-1 - FIX javascript/gjslint efm - Support for vim8 async jobs - Updated r checker - Misc improvments to async checks - vim8: Revert callbacks - Implemented some checkers as compilers for easier testing - Run vint on autoload/checksyntax.vim, chktex.vim - Support for vint (vim source files) - Support for csslint - Done(): How to handle loclists, when the buffer has changed? - Re-implemented scala checkers to compilers - checksyntax#GetChecker(): Optional is a regexp matching the names of eligible checkers - php: scriptencoding - r: Use ignore_rx - scalastyle: Define CheckSyntaxScalaStyleCmd() only once - Support for rmd (use r) - Misc refactoring, edits - Retrieve compiler parameters only once - Re-Implemented more checkers as compilers; removed some if_executable and convert_filename entries (those should be automatically detected) - :CheckSyntax, checksyntax#Check(): optional arguments have changed; background is set via g:checksyntax#background - checksyntax#Check(): FIX optional arguments in autocommand MD5 checksum: b346b86f808dc7ca3bc312103dd0d0be |
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: 142.132.191.50
|