Merge commit '31d14ce69586623d2f4c3d256f919a3760c805f3' as 'vim/bundle/checksyntax'

main
Buddy Sandidge 11 years ago
commit bae330908c

@ -0,0 +1,11 @@
tags
archive
Makefile
TODO.TXT
TODO_archived.viki
*.vba
*.vmb
*.zip
.last_*
test
test_*

@ -0,0 +1,195 @@
0.2
php specific
0.3
generalized plugin; modes; support for ruby, phpp, tex (chktex)
0.4
use vim compilers if available (e.g., tidy, xmllint ...); makeprg was
restored in the wrong window
0.5
- Support for jsl (javascript lint).
- Support for jlint.
- 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)
- Support for lua (thanks to norman)
0.6
- checksyntax_compiler_{&ft} & checksyntax_cmd_{&ft} variables can be
buffer local
1.0
- 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)
version: "1.01"
- Experimental support for python: pyflakes, pylint
- redraw before calling CheckSyntaxSucceed/CheckSyntaxFail
- Make sure we're in the right buffer
MD5 checksum: f94781c5748200e809a28562a692ed6b
version: "1.02"
- 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
version: "1.03"
- 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
- 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
version: "2.00"
- 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
version: "2.00"
version: "2.01"
- 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
- 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
version: "2.02"
version: "2.03"
- Included missing files in vba (fixes #16)
MD5 checksum: 40c9ea31d916db1ff5f22ec1c4af14c3
version: "3.00"
- 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

@ -0,0 +1,48 @@
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 vimscript #2584 is installed, lines containing syntax errors will be marked
with signs.
By default, |:CheckSyntax| is mapped to <F5> (if not mapped already),
and automatically executed when saving the buffer. The |:CheckSyntax|
command takes one optional argument: the mode (default: &filetype).
<C-F5> will run all syntax checkers for a given filetype if multiple
alternatives are defined and installed on your computer.
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 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.
This plugin was originally based on Klaus Horsten's php_console
(vimscript #779) and it is the successor of php_check_syntax.vim
(vimscript #1272).
-----------------------------------------------------------------------
Status: Works for me (there may be some minor quirks)
Install: See http://github.com/tomtom/vimtlib/blob/master/INSTALL.TXT
See http://github.com/tomtom for related plugins.

@ -0,0 +1,9 @@
{
"name" : "checksyntax",
"version" : "dev",
"author" : "Tom Link <micathom at gmail com>",
"maintainer" : "Tom Link <micathom at gmail com>",
"repository" : {"type": "git", "url": "git://github.com/tomtom/checksyntax_vim.git"},
"dependencies" : {},
"description" : "Check syntax when saving a file (php etc.)"
}

@ -0,0 +1,31 @@
if !exists(':CheckSyntax')
finish
endif
function! airline#extensions#checksyntax#get_msg()
let errors = checksyntax#Status()
if !empty(errors)
return errors.(g:airline_symbols.space)
endif
return ''
endf
let s:spc = g:airline_symbols.space
function! airline#extensions#checksyntax#apply(...)
let w:airline_section_c = get(w:, 'airline_section_c', g:airline_section_c)
let w:airline_section_c .= s:spc . g:airline_left_alt_sep . s:spc . '%{airline#extensions#checksyntax#get_msg()}'
endf
function! airline#extensions#checksyntax#init(ext)
call airline#parts#define_function('checksyntax', 'airline#extensions#checksyntax#get_msg')
" call airline#parts#define_raw('checksyntax', '%{airline#extensions#checksyntax#get_msg()}')
call a:ext.add_statusline_func('airline#extensions#checksyntax#apply')
endf
" vi: ft=vim:tw=72:ts=4

File diff suppressed because it is too large Load Diff

@ -0,0 +1,68 @@
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Revision: 37
let s:async_handler = {}
function s:async_handler.get(temp_file_name) dict
" echom "DBG async_handler.get" self.name self.job_id
let jobs = checksyntax#RemoveJob(self.job_id)
if jobs != -1
let errorformat = &errorformat
try
" TLogVAR self.async_type, self.bufnr, bufnr('%')
if self.async_type != 'loc' || self.bufnr == bufnr('%')
let &errorformat = self.async_efm
" TLogVAR self.async_efm
" TLogVAR self.async_cmd, a:temp_file_name
" let lines = readfile(a:temp_file_name) " DBG
" TLogVAR lines
exec self.async_cmd a:temp_file_name
let list = g:checksyntax#issues.AddList(self.name, self, self.async_type)
" TLogVAR list
" TLogVAR self.name, len(list)
if g:checksyntax#debug
echo
echom printf('CheckSyntax: Processing %s (%s items)', self.name, len(list))
endif
if jobs == 0
" let bg = self.bg
let bg = 1
" let manually = self.manually
let manually = g:checksyntax#debug
call g:checksyntax#issues.Display(manually, bg)
endif
endif
finally
let &errorformat = errorformat
endtry
endif
endf
function! s:AsyncCommandHandler(make_def)
" TLogVAR a:make_def
let type = get(a:make_def, 'listtype', 'loc')
let async_handler = {
\ 'async_cmd': type == 'loc' ? 'lgetfile' : 'cgetfile',
\ 'async_type': type,
\ 'async_efm': get(a:make_def, 'efm', &errorformat),
\ }
call extend(async_handler, a:make_def)
call extend(async_handler, s:async_handler, 'keep')
" TLogVAR async_handler
return asynccommand#tab_restore(async_handler)
endf
function! checksyntax#async#asynccommand#Run(cmd, make_def) "{{{3
" TLogVAR a:cmd, a:make_def
let @+ = a:cmd
let async_handler = s:AsyncCommandHandler(a:make_def)
" TLogVAR async_handler
call asynccommand#run(a:cmd, async_handler)
return 1
endf

@ -0,0 +1,13 @@
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Revision: 5
call checksyntax#AddChecker('c?',
\ {
\ 'compiler': 'splint',
\ 'if_executable': 'splint',
\ 'convert_filename': checksyntax#MaybeUseCygpath('splint'),
\ }
\ )

@ -0,0 +1,8 @@
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Revision: 4
call checksyntax#Require('c')
call checksyntax#AddChecker('cpp?', checksyntax#GetChecker('c'))

@ -0,0 +1,7 @@
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Revision: 3
call checksyntax#Require('xml')
call checksyntax#AddChecker('docbk?', checksyntax#GetChecker('xml'))

@ -0,0 +1,14 @@
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Revision: 4
call checksyntax#AddChecker('html?',
\ {
\ 'cmd': 'tidy -eq',
\ 'efm': 'line %l column %c - %m',
\ 'convert_filename': checksyntax#MaybeUseCygpath('tidy'),
\ }
\ )

@ -0,0 +1,55 @@
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Revision: 46
if !exists('checksyntax#defs#java#pmd_rulesets')
" :read: let checksyntax#defs#java#pmd_rulesets = [...] "{{{2
let checksyntax#defs#java#pmd_rulesets = [
\ "basic", "braces", "clone", "codesize", "comments",
\ "design", "empty", "finalizers", "imports", "javabeans",
\ "logging-jakarta-commons", "logging-java", "migrating",
\ "optimizations", "strictexception", "strings",
\ "sunsecure", "typeresolution", "unnecessary",
\ "unusedcode"]
"android", "controversial", "coupling", "j2ee", "junit", "naming",
endif
if !exists('checksyntax#defs#java#pmd_args')
let checksyntax#defs#java#pmd_args = '' "{{{2
endif
function! checksyntax#defs#java#Jlint() "{{{3
let filename = expand('%:r') .'.class'
let dirname = expand('%:h')
return 'jlint +all -done -source '. shellescape(dirname) .' '. shellescape(filename)
endf
call checksyntax#AddChecker('java?',
\ {
\ 'if_executable': 'checkstyle',
\ 'compiler': 'checkstyle',
\ 'compiler_args': '%'
\ })
" \ {
" \ 'name': 'jlint',
" \ 'if_executable': 'jlint',
" \ 'efm': '%m',
" \ 'cmdexpr': 'checksyntax#defs#java#Jlint()'
" \ },
if !empty(g:checksyntax#pmd#cmd)
call checksyntax#AddChecker('java?',
\ {
\ 'name': 'pmd',
\ 'type': 'qfl',
\ 'cmdexpr': 'checksyntax#pmd#Cmd("java", g:checksyntax#defs#java#pmd_args, g:checksyntax#defs#java#pmd_rulesets)',
\ 'cmd_args': '',
\ 'buffers': 'listed',
\ 'efm': '%f:%l:%m',
\ })
endif

@ -0,0 +1,84 @@
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Revision: 66
if !exists('g:checksyntax#defs#javascript#closure')
" If non-empty, enable some checks via closure compiler.
let g:checksyntax#defs#javascript#closure = '' "{{{2
endif
if !exists('g:checksyntax#defs#javascript#closure_warnings')
let g:checksyntax#defs#javascript#closure_warnings = ['const', 'constantProperty', 'checkRegExp', 'strictModuleDepCheck', 'visibility'] "{{{2
endif
if !exists('checksyntax#defs#javascript#pmd_rulesets')
let checksyntax#defs#javascript#pmd_rulesets = ["basic", "braces", "unnecessary"]
endif
if !exists('checksyntax#defs#javascript#pmd_args')
let checksyntax#defs#javascript#pmd_args = '' "{{{2
endif
call checksyntax#AddChecker('javascript?',
\ {
\ 'name': 'jshint',
\ 'cmd': 'jshint --verbose',
\ 'efm': '%f: line %l\, col %c\, %m (%t%n)',
\ },
\ {
\ 'name': 'esprima',
\ 'cmd': 'esvalidate',
\ 'efm': '%f:%l: %m',
\ },
\ {
\ 'name': 'gjslint',
\ 'cmd': 'gjslint',
\ 'ignore_nr': [1, 110],
\ 'efm': '%P%*[^F]FILE%*[^:]: %f %*[-],Line %l%\, %t:%n: %m,%Q',
\ },
\ {
\ 'name': 'jslint',
\ 'cmd': 'jslint --terse',
\ 'efm': '%f:%l:%c: %m',
\ },
\ {
\ 'name': 'jsl',
\ 'cmd': 'jsl -nofilelisting -nocontext -nosummary -nologo -process',
\ },
\ )
if !empty(g:checksyntax#defs#javascript#closure)
if !empty(g:checksyntax#defs#javascript#closure_warnings)
let s:closure_warnings = ' --jscomp_warning '. join(g:checksyntax#defs#javascript#closure_warnings, ' --jscomp_warning ')
else
let s:closure_warnings = ''
endif
call checksyntax#AddChecker('javascript?',
\ {
\ 'name': 'closure',
\ 'cmd': g:checksyntax#defs#javascript#closure .' --warning_level VERBOSE '. checksyntax#NullOutput('--js_output_file') . s:closure_warnings,
\ 'efm': '%A%f:%l: %m,%-Cfound %#: %.%#,%+Crequired %#: %.%#,%-C%.%#,%-Z%p^',
\ },
\ )
unlet s:closure_warnings
" ,%-C%.%#,%+Z%p^
endif
if !empty(g:checksyntax#pmd#cmd)
call checksyntax#AddChecker('javascript?',
\ {
\ 'name': 'pmd',
\ 'type': 'qfl',
\ 'cmdexpr': "checksyntax#pmd#Cmd('ecmascript', g:checksyntax#defs#javascript#pmd_args, g:checksyntax#defs#javascript#pmd_rulesets)",
\ 'cmd_args': '',
\ 'buffers': 'listed',
\ 'efm': '%f:%l:%m',
\ })
endif

@ -0,0 +1,14 @@
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Revision: 5
call checksyntax#AddChecker('lua?',
\ {
\ 'if_executable': 'luac',
\ 'cmd': 'luac -p',
\ 'efm': 'luac\:\ %f:%l:\ %m'
\ 'convert_filename': checksyntax#MaybeUseCygpath('luac'),
\ }
\ )

@ -0,0 +1,13 @@
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Revision: 14
call checksyntax#AddChecker('perl?',
\ {
\ 'cmd': 'perl -Wc %',
\ 'efm': '%-G%.%#had compilation errors.,%-G%.%#syntax OK,%m at %f line %l.,%+A%.%# at %f line %l\,%.%#,%+C%.%#',
\ 'convert_filename': checksyntax#MaybeUseCygpath('perl'),
\ },
\ )

@ -0,0 +1,15 @@
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Revision: 13
call checksyntax#AddChecker('php?',
\ {
\ 'name': 'php',
\ 'cmd': 'php -l -d display_errors=0 -d error_log= -d error_reporting=E_PARSE',
\ 'if_executable': 'php',
\ 'convert_filename': checksyntax#MaybeUseCygpath('php'),
\ 'efm': '%*[^:]: %m in %f on line %l',
\ }
\ )

@ -0,0 +1,20 @@
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Revision: 16
call checksyntax#AddChecker('python?',
\ {
\ 'cmd': 'pyflakes',
\ 'if_executable': 'pyflakes',
\ 'efm': '%f:%l: %m',
\ 'convert_filename': checksyntax#MaybeUseCygpath('pyflakes'),
\ },
\ {
\ 'cmd': 'pylint -r n -f parseable',
\ 'if_executable': 'pylint',
\ 'efm': '%f:%l: [%t] %m',
\ 'convert_filename': checksyntax#MaybeUseCygpath('pylint'),
\ }
\ )

@ -0,0 +1,176 @@
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Revision: 145
" :doc:
" Syntax checkers for R:
"
" codetools::checkUsageEnv ... Requires http://cran.r-project.org/web/packages/codetools/
" lint::lint ... Requires http://cran.r-project.org/web/packages/lint/
" svTools::lint ... Requires http://cran.r-project.org/web/packages/svTools/
if !exists('g:checksyntax#defs#r#progname')
let g:checksyntax#defs#r#progname = executable('Rterm') ? 'Rterm' : 'R' "{{{2
endif
if !executable(g:checksyntax#defs#r#progname)
throw "Please set g:checksyntax#defs#r#progname to the full filename of Rterm/R first!"
endif
if !exists('g:checksyntax#defs#r#options')
let g:checksyntax#defs#r#options = '--slave --ess --restore --no-save -e "%s" --args' "{{{2
endif
if !exists('g:checksyntax#defs#r#checkUsage_options')
" Optons passed to codetools::checkUsageEnv.
" Must not be empty.
let g:checksyntax#defs#r#checkUsage_options = 'all = TRUE' "{{{2
endif
if !exists('g:checksyntax#defs#r#checkUsage_ignore_undefined_rx')
" A |/\V| regexp pattern of names that should be ignored, when
" codetools::checkUsageEnv reports "no visible global function
" definition".
let g:checksyntax#defs#r#checkUsage_ignore_undefined_rx = '' "{{{2
endif
if !exists('g:checksyntax#defs#r#checkUsage_ignore_functions')
" A list of function names that will be ignored when parsing the
" result list from codetools::checkUsageEnv.
let g:checksyntax#defs#r#checkUsage_ignore_functions = [] "{{{2
endif
if !exists('g:checksyntax#defs#r#checkUsage_search_other_buffers')
" If 2, also search other buffers for patterns returned by
" codetools::checkUsageEnv. This may cause unreponsive behaviour.
"
" If 1, show unidentifiable patterns as is.
"
" If 0, remove unidentifiable patterns.
let g:checksyntax#defs#r#checkUsage_search_other_buffers = 0 "{{{2
endif
call checksyntax#AddChecker('r?',
\ {
\ 'listtype': 'qfl',
\ 'name': 'codetools',
\ 'cmd': g:checksyntax#defs#r#progname .' '.
\ printf(g:checksyntax#defs#r#options, 'try({library(codetools); source(commandArgs(TRUE)); checkUsageEnv(globalenv(),'. g:checksyntax#defs#r#checkUsage_options .')})'),
\ 'efm': '%m (%f:%l), %s : <anonymous>: %m, %s : %m, %s: %m',
\ 'process_list': 'checksyntax#defs#r#CheckUsageEnv'
\ },
\ {
\ 'name': 'lint',
\ 'cmd': g:checksyntax#defs#r#progname .' '.
\ printf(g:checksyntax#defs#r#options, 'try(lint::lint(commandArgs(TRUE)))'),
\ 'efm': 'Lint: %m,%E%f:%l:%c,%Z%\\s\\+%m',
\ 'process_list': 'checksyntax#defs#r#LintLint'
\ },
\ {
\ 'name': 'svTools::lint',
\ 'cmd': g:checksyntax#defs#r#progname .' '.
\ printf(g:checksyntax#defs#r#options, 'try(svTools::lint(commandArgs(TRUE),type=''flat''))'),
\ 'efm': '%t%\\w%\\++++%l+++%c+++%m',
\ }
\ )
" :nodoc:
function! checksyntax#defs#r#LintLint(list) "{{{3
" TLogVAR a:list
let list = []
for issue in a:list
let text = get(issue, 'text', '')
if text =~ ': found on lines \d\+'
let message = matchstr(text, '^.\{-}\ze: found on lines \d\+')
let lines = split(matchstr(text, 'found on lines \zs\d\+.*$'), ', ')
" TLogVAR message, lines
for line in lines
if line[0] =~ '^\d\+'
let issue1 = copy(issue)
let issue1.text = message
let issue1.lnum = str2nr(line)
call add(list, issue1)
endif
endfor
else
call add(list, issue)
endif
endfor
" TLogVAR list
return list
endf
" :nodoc:
function! checksyntax#defs#r#CheckUsageEnv(list) "{{{3
" TLogVAR a:list
let view = winsaveview()
try
let list = map(a:list, 's:CompleteCheckUsageEnvItem(v:val)')
unlet! s:lnum s:bufnr
let list = filter(list, '!empty(v:val)')
finally
call winrestview(view)
endtry
return list
endf
function! s:CompleteCheckUsageEnvItem(item) "{{{3
" TLogVAR a:item
let item = a:item
let pattern = get(item, 'pattern', '')
if !empty(g:checksyntax#defs#r#checkUsage_ignore_functions) && !empty(pattern)
let ignored = filter(copy(g:checksyntax#defs#r#checkUsage_ignore_functions),
\ 'v:val =~ pattern')
if len(ignored) > 0
return {}
endif
endif
if !empty(g:checksyntax#defs#r#checkUsage_ignore_undefined_rx) &&
\ item.text =~ '\C\V\<no visible global function definition for '''. g:checksyntax#defs#r#checkUsage_ignore_undefined_rx .''''
return {}
endif
" TLogVAR bufname(item.bufnr)
if get(item, 'bufnr', 0) == 0 && !empty(pattern)
let pattern = substitute(pattern, '\\\$', '\\>', '')
let s:bufnr = bufnr('%')
" let fn_rx = pattern .'\_s\*<-\_s\*function\_s\*('
let fn_rx = pattern .'\_s\*<-\_s\*'
let s:lnum = search(fn_rx, 'cwn')
if s:lnum == 0 && g:checksyntax#defs#r#checkUsage_search_other_buffers == 2
let bufnr0 = s:bufnr
let view = winsaveview()
try
bufdo! if &ft == 'r' | let s:lnum = search(fn_rx, 'cwn') | if s:lnum > 0 | let s:bufnr = bufnr('%') | throw "ok" | endif | endif
catch /ok/
finally
exec 'buffer' bufnr0
call winrestview(view)
endtry
endif
" TLogVAR pattern, s:lnum
if s:lnum > 0
let item.bufnr = s:bufnr
let item.lnum = s:lnum
let item.pattern = ''
" TLogVAR item
elseif g:checksyntax#defs#r#checkUsage_search_other_buffers == 1
let item.pattern = pattern
else
return {}
endif
elseif bufname(item.bufnr) == '<Text>'
return {}
endif
return item
endf

@ -0,0 +1,25 @@
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Revision: 10
if !exists('g:checksyntax#defs#ruby#interpreter')
let g:checksyntax#defs#ruby#interpreter = system('ruby --version') "{{{2
endif
let s:def = {
\ 'prepare': 'compiler ruby',
\ 'cmd': 'ruby -c',
\ }
if g:checksyntax#defs#ruby#interpreter =~ '\<jruby'
let s:def.efm = 'SyntaxError in %f:%l:%m'
else
let s:def.convert_filename = checksyntax#MaybeUseCygpath('xmllint')
endif
call checksyntax#AddChecker('ruby?', s:def)
unlet s:def

@ -0,0 +1,37 @@
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Revision: 17
if !exists('g:checksyntax#defs#scala#scalastyle')
" The command to invoke scalastyle -- see http://www.scalastyle.org
" and especially http://www.scalastyle.org/command-line.html
let g:checksyntax#defs#scala#scalastyle = '' "{{{2
endif
function! checksyntax#defs#scala#Cmd() "{{{3
let build = findfile('build.sbt', '.;')
if !empty(build)
let config = fnamemodify(build, ':h') .'/scalastyle-config.xml'
if filereadable(config)
return 'sbt scalastyle'
endif
endif
if !empty(g:checksyntax#defs#scala#scalastyle)
return g:checksyntax#defs#scala#scalastyle .' %'
endif
return ''
endf
" if !empty(g:checksyntax#defs#scala#scalastyle)
call checksyntax#AddChecker('scala?',
\ {
\ 'name': 'scalastyle',
\ 'cmdexpr': 'checksyntax#defs#scala#Cmd()',
\ 'cmd_args': '',
\ 'efm': '%t%\\S%\\+ file=%f message=%m line=%l column=%c',
\ },
\ )
" endif

@ -0,0 +1,14 @@
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Revision: 7
if &shell =~ '\<bash\>'
call checksyntax#AddChecker('sh?',
\ {
\ 'cmd': 'bash -n',
\ 'efm': '%f: %\\w%\\+ %l: %m',
\ 'convert_filename': checksyntax#MaybeUseCygpath('bash'),
\ }
\ )
endif

@ -0,0 +1,15 @@
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Revision: 3
call checksyntax#AddChecker('tex?',
\ {
\ 'cmd': 'chktex -q -v0',
\ 'if_executable': 'chktex',
\ 'convert_filename': checksyntax#MaybeUseCygpath('chktex'),
\ 'efm': '%f:%l:%m',
\ }
\ )

@ -0,0 +1,15 @@
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Revision: 4
call checksyntax#AddChecker('typescript?',
\ {
\ 'name': 'tsc',
\ 'args': checksyntax#NullOutput('--out'),
\ 'if_executable': 'tsc',
\ 'compiler': 'typescript',
\ }
\ )

@ -0,0 +1,13 @@
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Revision: 4
call checksyntax#AddChecker('viki?',
\ {
\ 'cmd': 'deplate -f null',
\ 'convert_filename': checksyntax#MaybeUseCygpath('deplate'),
\ }
\ )

@ -0,0 +1,10 @@
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Revision: 2
call checksyntax#Require('html')
call checksyntax#AddChecker('xhtml?',
\ checksyntax#GetChecker('html'))

@ -0,0 +1,36 @@
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Revision: 27
if !exists('checksyntax#defs#xml#pmd_rulesets')
let checksyntax#defs#xml#pmd_rulesets = ["basic"]
endif
if !exists('checksyntax#defs#xml#pmd_args')
let checksyntax#defs#xml#pmd_args = '' "{{{2
endif
call checksyntax#AddChecker('xml?',
\ {
\ 'compiler': 'xmllint',
\ 'compiler_args': '%',
\ 'convert_filename': checksyntax#MaybeUseCygpath('xmllint'),
\ }
\ )
if !empty(g:checksyntax#pmd#cmd)
call checksyntax#AddChecker('xml?',
\ {
\ 'name': 'pmd',
\ 'type': 'qfl',
\ 'cmdexpr': "checksyntax#pmd#Cmd('xml', g:checksyntax#defs#xml#pmd_args, g:checksyntax#defs#xml#pmd_rulesets)",
\ 'cmd_args': '',
\ 'buffers': 'listed',
\ 'efm': '%f:%l:%m',
\ })
endif

@ -0,0 +1,37 @@
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Revision: 13
if !exists('g:checksyntax#pmd#cmd')
" The command to run pmd.
let g:checksyntax#pmd#cmd = '' "{{{2
endif
if !exists('g:checksyntax#pmd#args')
let g:checksyntax#pmd#args = '-f text' "{{{2
endif
function! checksyntax#pmd#Cmd(language, args, rulesets) "{{{3
if empty(g:checksyntax#pmd#cmd)
return ''
else
let args = [g:checksyntax#pmd#args, a:args, '-l', a:language]
if !exists('b:checksyntax_project_dir')
if exists('b:project_dir')
let b:checksyntax_project_dir = b:project_dir
else
let b:checksyntax_project_dir = expand('%:h')
endif
endif
call add(args, '-d '. shellescape(b:checksyntax_project_dir))
let rulesets = join(map(copy(a:rulesets), 'a:language ."-". v:val'), ',')
let args += ['-R', rulesets]
return printf("%s %s",
\ g:checksyntax#pmd#cmd,
\ join(args))
endif
endf

@ -0,0 +1,328 @@
*checksyntax.txt* checksyntax -- Check syntax when saving a file (php, ruby, tex ...)
Author: Tom Link, micathom at gmail com
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.
Pre-defined syntax checkers (the respective syntax checker has to
be installed):
c, cpp ... Requires splint
html ... Requires tidy
java ... Requires
jlint (http://jlint.sourceforge.net),
checkstyle (http://checkstyle.sourceforge.net),
pmd (http://pmd.sourceforge.net)
javascript ... Syntax check; requires jshint, esprima,
gjslint, jslint, jsl, pmd
lua ... Requires luac (run luac -p)
php ... Syntax check; requires php (run php -l)
python ... Requires pyflakes or pylint
r ... Requires codetools::checkUsage, lint::lint, or
svTools::lint
ruby ... Requires ruby (run ruby -c)
tex, latex ... Requires chktex (run chktex -q -v0)
viki ... Requires deplate
xhtml ... Requires tidy
xml, docbk ... Requires 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')
This plugin was originally based on Klaus Horsten's php_console
(vimscript #779) and it is the successor of php_check_syntax.vim
(vimscript #1272).
-----------------------------------------------------------------------
Install~
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.
Optional enhancements:
quickfixsigns (vimscript #2584) ... Use signs
AsyncCommand (vimscript #3431) ... Run commands asynchronously
========================================================================
Contents~
:CheckSyntax ......................... |:CheckSyntax|
g:checksyntax_key_single ............. |g:checksyntax_key_single|
g:checksyntax_key_all ................ |g:checksyntax_key_all|
g:checksyntax_auto ................... |g:checksyntax_auto|
g:checksyntax#auto_enable_rx ......... |g:checksyntax#auto_enable_rx|
g:checksyntax#auto_disable_rx ........ |g:checksyntax#auto_disable_rx|
g:checksyntax#preferred .............. |g:checksyntax#preferred|
g:checksyntax#async_runner ........... |g:checksyntax#async_runner|
:CheckSyntaxStatus ................... |:CheckSyntaxStatus|
g:checksyntax#run_alternatives ....... |g:checksyntax#run_alternatives|
g:checksyntax#run_all_alternatives ... |g:checksyntax#run_all_alternatives|
g:checksyntax#windows ................ |g:checksyntax#windows|
g:checksyntax#null ................... |g:checksyntax#null|
g:checksyntax#cygwin_path_rx ......... |g:checksyntax#cygwin_path_rx|
g:checksyntax#cygwin_expr ............ |g:checksyntax#cygwin_expr|
g:checksyntax#check_cygpath .......... |g:checksyntax#check_cygpath|
CheckSyntaxSucceed ................... |CheckSyntaxSucceed()|
CheckSyntaxFail ...................... |CheckSyntaxFail()|
g:checksyntax#prototypes ............. |g:checksyntax#prototypes|
checksyntax#AddChecker ............... |checksyntax#AddChecker()|
checksyntax#GetChecker ............... |checksyntax#GetChecker()|
checksyntax#Check .................... |checksyntax#Check()|
checksyntax#AddJob ................... |checksyntax#AddJob()|
checksyntax#RemoveJob ................ |checksyntax#RemoveJob()|
checksyntax#Status ................... |checksyntax#Status()|
checksyntax#GetList .................. |checksyntax#GetList()|
checksyntax#NullOutput ............... |checksyntax#NullOutput()|
checksyntax#MaybeUseCygpath .......... |checksyntax#MaybeUseCygpath()|
g:checksyntax#pmd#cmd ................ |g:checksyntax#pmd#cmd|
g:checksyntax#pmd#args ............... |g:checksyntax#pmd#args|
checksyntax#pmd#Cmd .................. |checksyntax#pmd#Cmd()|
========================================================================
plugin/checksyntax.vim~
*:CheckSyntax*
CheckSyntax[!] [NAME]
Check the current buffer's syntax (type defaults to &filetype).
Or use NAME instead of &filetype.
With the bang !, run all alternatives (see
|g:checksyntax#run_alternatives|).
*g:checksyntax_key_single*
g:checksyntax_key_single (default: '<F5>')
Map for running the preferred syntax checkers on the current
buffer.
*g:checksyntax_key_all*
g:checksyntax_key_all (default: '<C-F5>')
Map for running all suitable syntax checkers on the current
buffer.
*g:checksyntax_auto*
g:checksyntax_auto (default: 1)
If 1, enable automatic syntax checks after saving a file.
If 2, enable automatic syntax checks when saving and loading a
file.
NOTE: This variable must be customized in vimrc before loading
this plugin.
See also |g:checksyntax|, |g:checksyntax#auto_enable_rx| and
|g:checksyntax#auto_disable_rx|.
========================================================================
autoload/checksyntax.vim~
*g:checksyntax#auto_enable_rx*
g:checksyntax#auto_enable_rx (default: '')
Enable automatic checking for filetypes matching this rx.
Set to "." to enable for all filetypes.
This requires |g:checksyntax_auto| to be > 0.
This variable overrules any filetype-specific settings in
|g:checksyntax|.
*g:checksyntax#auto_disable_rx*
g:checksyntax#auto_disable_rx (default: '')
Disable automatic checking for filetypes matching this rx.
Set to "." to disable for all filetypes.
This requires |g:checksyntax_auto| to be > 0.
This variable overrules any filetype-specific settings in
|g:checksyntax|.
*g:checksyntax#preferred*
g:checksyntax#preferred (default: {'xml': '.'})
A dictionary of 'filetype' => |regexp|.
If only one alternative should be run (see
|g:checksyntax#run_alternatives|), check only those syntax
checkers whose names matches |regexp|.
*g:checksyntax#async_runner*
g:checksyntax#async_runner (default: has('clientserver') && !empty(v:servername) && exists(':AsyncMake') ? 'asynccommand' : '')
Supported values:
asynccommand ... Use the AsyncCommand plugin
*:CheckSyntaxStatus*
:CheckSyntaxStatus
Show status information (pending async tasks).
*g:checksyntax#run_alternatives*
g:checksyntax#run_alternatives (default: 'first' . (!empty(g:checksyntax#async_runner) ? ' async' : ''))
How to handle alternatives. Possible values:
first ... Use the first valid entry
all ... Run all valid alternatives one after another
Alternatively, the following flag can be added in order to change
how the alternatives are run:
async ... Run alternatives asynchronously (see also
|g:checksyntax#async_runner|)
*g:checksyntax#run_all_alternatives*
g:checksyntax#run_all_alternatives (default: 'all' . (!empty(g:checksyntax#async_runner) ? ' async' : ''))
How to run "all" alternatives -- e.g., when calling the
|:CheckSyntax| command with a bang.
*g:checksyntax#windows*
g:checksyntax#windows (default: &shell !~ 'sh' && (has('win16') || has('win32') || has('win64')))
*g:checksyntax#null*
g:checksyntax#null (default: g:checksyntax#windows ? 'nul' : (filereadable('/dev/null') ? '/dev/null' : ''))
*g:checksyntax#cygwin_path_rx*
g:checksyntax#cygwin_path_rx (default: '/cygwin/')
If a full windows filename (with slashes instead of backslashes)
matches this |regexp|, it is assumed to be a cygwin executable.
*g:checksyntax#cygwin_expr*
g:checksyntax#cygwin_expr (default: '"bash -c ''". escape(%s, "''\\") ."''"')
For cygwin binaries, convert command calls using this vim
expression.
*g:checksyntax#check_cygpath*
g:checksyntax#check_cygpath (default: g:checksyntax#windows && s:Executable('cygpath'))
If true, check whether we have to convert a path via cyppath --
see |checksyntax#MaybeUseCygpath|
*CheckSyntaxSucceed()*
CheckSyntaxSucceed(type, manually)
This function is called when no syntax errors were found.
*CheckSyntaxFail()*
CheckSyntaxFail(type, manually, bg)
This function is called when a syntax error was found.
*g:checksyntax#prototypes*
g:checksyntax#prototypes (default: {'loc': {}, 'qfl': {}})
Contains prototype definitions for syntax checkers that use the
|location-list| ("loc") or the |quixfix|-list.
*checksyntax#AddChecker()*
checksyntax#AddChecker(filetype, ...)
Define a syntax checker definition for a given filetype.
If filetype ends with "?", add only if no checker with the given name
is defined.
A checker definition is a dictionary with the following fields:
Mandatory (either one of the following):
cmd ........ A shell command used as 'makeprg' to check the file.
cmdexpr .... A vim expression that returns the cmd
compiler ... A vim compiler that is used to check the file.
exec ....... A vim command used to check the file (deprecated; use
cmdexpr & process_list instead)
Optional:
efm ....... An 'errorformat' string.
prepare .... An ex command that is run before doing anything.
ignore_nr .. A list of error numbers that should be ignored.
listtype ... Either loc (default) or qfl
include .... Include another definition
process_list .. Process a list of issues
if ......... An expression to test *once* whether a syntax checker
should be used.
if_executable .. Test whether an application is executable.
buffers .... Keep results only for either "current", "listed", or
"all" buffers
compiler_args .. Internal use
cmd_args ... Internal use
Optional top-level fields:
auto ....... Run automatically when saving a file (see also
|g:checksyntax#auto_enable_rx| and
|g:checksyntax#auto_disable_rx|)
modified ... The name of a pseudo-filetype that should be used if
the buffer was modified
run_alternatives ... A string that defines how to run
alternatives (overrides
|g:checksyntax#run_alternatives|).
Top-level fields affect how syntax checkers for a filetype are run.
*checksyntax#GetChecker()*
checksyntax#GetChecker(filetype, ...)
*checksyntax#Check()*
checksyntax#Check(manually, ?bang='', ?filetype=&ft, ?background=1)
Perform a syntax check.
If bang is not empty, run all alternatives (see
|g:checksyntax#run_alternatives|).
If filetype is empty, the current buffer's 'filetype' will be used.
If background is true, display the list of issues in the background,
i.e. the active window will keep the focus.
*checksyntax#AddJob()*
checksyntax#AddJob(make_def)
*checksyntax#RemoveJob()*
checksyntax#RemoveJob(job_id)
*checksyntax#Status()*
checksyntax#Status()
*checksyntax#GetList()*
checksyntax#GetList(name, make_def, type)
*checksyntax#NullOutput()*
checksyntax#NullOutput(flag)
*checksyntax#MaybeUseCygpath()*
checksyntax#MaybeUseCygpath(cmd)
If cmd seems to be a cygwin executable, use cygpath to convert
filenames. This assumes that cygwin's which command returns full
filenames for non-cygwin executables.
========================================================================
autoload/checksyntax/pmd.vim~
*g:checksyntax#pmd#cmd*
g:checksyntax#pmd#cmd (default: '')
The command to run pmd.
*g:checksyntax#pmd#args*
g:checksyntax#pmd#args (default: '-f text')
*checksyntax#pmd#Cmd()*
checksyntax#pmd#Cmd(language, args, rulesets)
vim:tw=78:fo=tcq2:isk=!-~,^*,^|,^":ts=8:ft=help:norl:

@ -0,0 +1,78 @@
*checksyntax.txt* checksyntax -- Check syntax when saving a file (php, ruby, tex ...)
Author: Tom Link, micathom at gmail com
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.
Pre-defined syntax checkers (the respective syntax checker has to
be installed):
c, cpp ... Requires splint
html ... Requires tidy
java ... Requires
jlint (http://jlint.sourceforge.net),
checkstyle (http://checkstyle.sourceforge.net),
pmd (http://pmd.sourceforge.net)
javascript ... Syntax check; requires jshint, esprima,
gjslint, jslint, jsl, pmd
lua ... Requires luac (run luac -p)
php ... Syntax check; requires php (run php -l)
python ... Requires pyflakes or pylint
r ... Requires codetools::checkUsage, lint::lint, or
svTools::lint
ruby ... Requires ruby (run ruby -c)
tex, latex ... Requires chktex (run chktex -q -v0)
viki ... Requires deplate
xhtml ... Requires tidy
xml, docbk ... Requires 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')
This plugin was originally based on Klaus Horsten's php_console
(vimscript #779) and it is the successor of php_check_syntax.vim
(vimscript #1272).
-----------------------------------------------------------------------
Install~
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.
Optional enhancements:
quickfixsigns (vimscript #2584) ... Use signs
AsyncCommand (vimscript #3431) ... Run commands asynchronously
%s

@ -0,0 +1,87 @@
" checksyntax.vim -- Check syntax when saving a file (php, ruby, tex ...)
" @Author: Tom Link (micathom AT gmail com)
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 04-Mai-2005.
" @Last Change: 2012-08-28.
" GetLatestVimScripts: 1431 0 :AutoInstall: checksyntax.vim
" @Revision: 429
if exists('g:loaded_checksyntax')
finish
endif
let g:loaded_checksyntax = 300
if !exists('g:checksyntax')
let g:checksyntax = {}
endif
" :display: CheckSyntax[!] [NAME]
" Check the current buffer's syntax (type defaults to &filetype).
" Or use NAME instead of &filetype.
"
" With the bang !, run all alternatives (see
" |g:checksyntax#run_alternatives|).
command! -bang -nargs=? CheckSyntax call checksyntax#Check(1, "<bang>", <f-args>)
" @TPluginInclude
if !exists('g:checksyntax_key_single')
" Map for running the preferred syntax checkers on the current
" buffer.
let g:checksyntax_key_single = '<F5>' "{{{2
endif
" @TPluginInclude
if !exists('g:checksyntax_key_all')
" Map for running all suitable syntax checkers on the current
" buffer.
let g:checksyntax_key_all = '<C-F5>' "{{{2
endif
if !exists('g:checksyntax_auto')
" If 1, enable automatic syntax checks after saving a file.
" If 2, enable automatic syntax checks when saving and loading a
" file.
" NOTE: This variable must be customized in vimrc before loading
" this plugin.
"
" See also |g:checksyntax|, |g:checksyntax#auto_enable_rx| and
" |g:checksyntax#auto_disable_rx|.
let g:checksyntax_auto = 1 "{{{2
endif
" @TPluginInclude
augroup CheckSyntax
autocmd!
if !exists('g:checksyntax_auto') || g:checksyntax_auto >= 1
autocmd BufWritePost * call checksyntax#Check(0)
endif
if exists('g:checksyntax_auto') && g:checksyntax_auto >= 2
autocmd BufEnter * if !exists('b:checksyntax_runs')
\ | call checksyntax#Check(0, 0, &ft, 1)
\ | endif
endif
augroup END
" @TPluginInclude
if !hasmapto(':CheckSyntax')
if empty(maparg(g:checksyntax_key_single, 'n'))
exec 'noremap' g:checksyntax_key_single ':CheckSyntax<cr>'
endif
if empty(maparg(g:checksyntax_key_single, 'i'))
exec 'inoremap' g:checksyntax_key_single '<c-o>:CheckSyntax<cr>'
endif
if empty(maparg(g:checksyntax_key_all, 'n'))
exec 'noremap' g:checksyntax_key_all ':CheckSyntax!<cr>'
endif
if empty(maparg(g:checksyntax_key_all, 'i'))
exec 'inoremap' g:checksyntax_key_all '<c-o>:CheckSyntax!<cr>'
endif
endif
Loading…
Cancel
Save