mirror of
https://github.com/amix/vimrc
synced 2025-07-07 00:15:00 +08:00
Adding submodules and stuff.
This commit is contained in:
@ -0,0 +1,66 @@
|
||||
"============================================================================
|
||||
"File: closurecompiler.vim
|
||||
"Description: Javascript syntax checker - using Google Closure Compiler
|
||||
"Maintainer: Motohiro Takayama <mootoh 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.
|
||||
"============================================================================
|
||||
"
|
||||
" To enable this plugin, edit the .vimrc like this:
|
||||
"
|
||||
" let g:syntastic_javascript_checker = "closurecompiler"
|
||||
"
|
||||
" and set the path to the Google Closure Compiler:
|
||||
"
|
||||
" let g:syntastic_javascript_closure_compiler_path = '/path/to/google-closure-compiler.jar'
|
||||
"
|
||||
" It takes additional options for Google Closure Compiler with the variable
|
||||
" g:syntastic_javascript_closure_compiler_options.
|
||||
"
|
||||
|
||||
if exists("g:loaded_syntastic_javascript_closurecompiler_checker")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_javascript_closurecompiler_checker=1
|
||||
|
||||
if !exists("g:syntastic_javascript_closure_compiler_options")
|
||||
let g:syntastic_javascript_closure_compiler_options = ""
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_javascript_closurecompiler_IsAvailable()
|
||||
return exists("g:syntastic_javascript_closure_compiler_path")
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_javascript_closurecompiler_GetLocList()
|
||||
if exists("g:syntastic_javascript_closure_compiler_file_list")
|
||||
let file_list = join(readfile(g:syntastic_javascript_closure_compiler_file_list), ' ')
|
||||
else
|
||||
let file_list = syntastic#util#shexpand('%')
|
||||
endif
|
||||
|
||||
let makeprg = syntastic#makeprg#build({
|
||||
\ 'exe': 'java -jar ' . g:syntastic_javascript_closure_compiler_path,
|
||||
\ 'args': g:syntastic_javascript_closure_compiler_options . ' --js' ,
|
||||
\ 'fname': file_list,
|
||||
\ 'filetype': 'javascript',
|
||||
\ 'subchecker': 'closurecompiler' })
|
||||
|
||||
let errorformat =
|
||||
\ '%-GOK,'.
|
||||
\ '%E%f:%l: ERROR - %m,'.
|
||||
\ '%Z%p^,'.
|
||||
\ '%W%f:%l: WARNING - %m,'.
|
||||
\ '%Z%p^'
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'javascript',
|
||||
\ 'name': 'closurecompiler'})
|
||||
|
@ -0,0 +1,46 @@
|
||||
"============================================================================
|
||||
"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:loaded_syntastic_javascript_gjslint_checker")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_javascript_gjslint_checker=1
|
||||
|
||||
if !exists("g:syntastic_javascript_gjslint_conf")
|
||||
let g:syntastic_javascript_gjslint_conf = ""
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_javascript_gjslint_IsAvailable()
|
||||
return executable('gjslint')
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_javascript_gjslint_GetLocList()
|
||||
let makeprg = syntastic#makeprg#build({
|
||||
\ 'exe': 'gjslint',
|
||||
\ 'args': g:syntastic_javascript_gjslint_conf . " --nosummary --unix_mode --nodebug_indentation --nobeep",
|
||||
\ 'filetype': 'javascript',
|
||||
\ 'subchecker': 'gjslint' })
|
||||
|
||||
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
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'javascript',
|
||||
\ 'name': 'gjslint'})
|
||||
|
@ -0,0 +1,55 @@
|
||||
"============================================================================
|
||||
"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:loaded_syntastic_javascript_jshint_checker")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_javascript_jshint_checker=1
|
||||
|
||||
if !exists("g:syntastic_javascript_jshint_conf")
|
||||
let g:syntastic_javascript_jshint_conf = ""
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_javascript_jshint_IsAvailable()
|
||||
return executable('jshint')
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_javascript_jshint_GetLocList()
|
||||
let jshint_new = s:JshintNew()
|
||||
let makeprg = syntastic#makeprg#build({
|
||||
\ 'exe': 'jshint',
|
||||
\ 'post_args': (jshint_new ? ' --verbose ' : '') . s:Args(),
|
||||
\ 'filetype': 'javascript',
|
||||
\ 'subchecker': 'jshint' })
|
||||
|
||||
let errorformat = jshint_new ?
|
||||
\ '%f: line %l\, col %c\, %m \(%t%*\d\)' :
|
||||
\ '%E%f: line %l\, col %c\, %m'
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'defaults': {'bufnr': bufnr('')} })
|
||||
endfunction
|
||||
|
||||
function s:JshintNew()
|
||||
return syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('jshint --version'), [1, 1])
|
||||
endfunction
|
||||
|
||||
function s:Args()
|
||||
" node-jshint uses .jshintrc as config unless --config arg is present
|
||||
return !empty(g:syntastic_javascript_jshint_conf) ? ' --config ' . g:syntastic_javascript_jshint_conf : ''
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'javascript',
|
||||
\ 'name': 'jshint'})
|
||||
|
@ -0,0 +1,56 @@
|
||||
"============================================================================
|
||||
"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:loaded_syntastic_javascript_jsl_checker")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_javascript_jsl_checker=1
|
||||
|
||||
if !exists("g:syntastic_javascript_jsl_conf")
|
||||
let g:syntastic_javascript_jsl_conf = ""
|
||||
endif
|
||||
|
||||
function s:ConfFlag()
|
||||
if !empty(g:syntastic_javascript_jsl_conf)
|
||||
return "-conf " . g:syntastic_javascript_jsl_conf
|
||||
endif
|
||||
|
||||
return ""
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_javascript_jsl_IsAvailable()
|
||||
return executable('jsl')
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_javascript_jsl_GetLocList()
|
||||
let makeprg = syntastic#makeprg#build({
|
||||
\ 'exe': 'jsl',
|
||||
\ 'args': s:ConfFlag() . " -nologo -nofilelisting -nosummary -nocontext -process",
|
||||
\ 'filetype': 'javascript',
|
||||
\ 'subchecker': 'jsl' })
|
||||
|
||||
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
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'javascript',
|
||||
\ 'name': 'jsl'})
|
||||
|
@ -0,0 +1,53 @@
|
||||
"============================================================================
|
||||
"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:loaded_syntastic_javascript_jslint_checker")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_javascript_jslint_checker=1
|
||||
|
||||
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_jslint_IsAvailable()
|
||||
return executable('jslint')
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_javascript_jslint_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_jslint_GetLocList()
|
||||
let makeprg = syntastic#makeprg#build({
|
||||
\ 'exe': 'jslint',
|
||||
\ 'args': g:syntastic_javascript_jslint_conf,
|
||||
\ 'filetype': 'javascript',
|
||||
\ 'subchecker': 'jslint' })
|
||||
|
||||
let errorformat =
|
||||
\ '%E %##%n %m,'.
|
||||
\ '%-Z%.%#Line %l\, Pos %c,'.
|
||||
\ '%-G%.%#'
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'defaults': {'bufnr': bufnr("")} })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'javascript',
|
||||
\ 'name': 'jslint'})
|
||||
|
Reference in New Issue
Block a user