1
0
mirror of https://github.com/amix/vimrc synced 2025-09-17 01:35:01 +08:00
This commit is contained in:
vsooda
2014-11-08 13:32:59 +08:00
parent 013a91d8d2
commit c2ae99ad8b
27 changed files with 229 additions and 147 deletions

View File

@ -20,7 +20,7 @@ set cpo&vim
" TODO: we should probably split this into separate checkers
function! SyntaxCheckers_elixir_elixir_IsAvailable() dict
call self.log(g:SyntasticDebugCheckers,
call self.log(
\ 'executable("elixir") = ' . executable('elixir') . ', ' .
\ 'executable("mix") = ' . executable('mix'))
return executable('elixir') && executable('mix')

View File

@ -55,7 +55,7 @@ set cpo&vim
" TODO: join this with xhtml.vim for DRY's sake?
function! s:TidyEncOptByFenc()
let tidy_opts = {
let TIDY_OPTS = {
\ 'utf-8': '-utf8',
\ 'ascii': '-ascii',
\ 'latin1': '-latin1',
@ -69,10 +69,10 @@ function! s:TidyEncOptByFenc()
\ 'sjis': '-shiftjis',
\ 'cp850': '-ibm858',
\ }
return get(tidy_opts, &fileencoding, '-utf8')
return get(TIDY_OPTS, &fileencoding, '-utf8')
endfunction
let s:ignore_errors = [
let s:IGNORE_ERRORS = [
\ "<table> lacks \"summary\" attribute",
\ "not approved by W3C",
\ "<input> proprietary attribute \"placeholder\"",
@ -123,9 +123,9 @@ let s:ignore_errors = [
\ "proprietary attribute \"aria-valuenow\"",
\ "proprietary attribute \"aria-valuetext\""
\ ]
lockvar! s:ignore_errors
lockvar! s:IGNORE_ERRORS
let s:blocklevel_tags = [
let s:BLOCKLEVEL_TAGS = [
\ "main",
\ "section",
\ "article",
@ -136,9 +136,9 @@ let s:blocklevel_tags = [
\ "figure",
\ "figcaption"
\ ]
lockvar! s:blocklevel_tags
lockvar! s:BLOCKLEVEL_TAGS
let s:inline_tags = [
let s:INLINE_TAGS = [
\ "video",
\ "audio",
\ "source",
@ -155,16 +155,16 @@ let s:inline_tags = [
\ "details",
\ "datalist"
\ ]
lockvar! s:inline_tags
lockvar! s:INLINE_TAGS
let s:empty_tags = [
let s:EMPTY_TAGS = [
\ "wbr",
\ "keygen"
\ ]
lockvar! s:empty_tags
lockvar! s:EMPTY_TAGS
function! s:IgnoreError(text)
for item in s:ignore_errors + g:syntastic_html_tidy_ignore_errors
for item in s:IGNORE_ERRORS + g:syntastic_html_tidy_ignore_errors
if stridx(a:text, item) != -1
return 1
endif
@ -173,7 +173,7 @@ function! s:IgnoreError(text)
endfunction
function! s:NewTags(name)
return syntastic#util#shescape(join( s:{a:name} + g:syntastic_html_tidy_{a:name}, ',' ))
return syntastic#util#shescape(join( s:{toupper(a:name)} + g:syntastic_html_tidy_{a:name}, ',' ))
endfunction
function! s:Args()

View File

@ -24,6 +24,11 @@ function! SyntaxCheckers_javascript_closurecompiler_IsAvailable() dict
return 0
endif
let s:has_script = exists('g:syntastic_javascript_closurecompiler_script')
if s:has_script
return 1
endif
let cp = get(g:, 'syntastic_javascript_closurecompiler_path', '')
call self.log('g:syntastic_javascript_closurecompiler_path =', cp)
@ -45,14 +50,13 @@ function! SyntaxCheckers_javascript_closurecompiler_GetLocList() dict
endif
let makeprg = self.makeprgBuild({
\ 'exe_after': ['-jar', expand(g:syntastic_javascript_closurecompiler_path)],
\ 'exe_after': (s:has_script ? [] : ['-jar', expand(g:syntastic_javascript_closurecompiler_path)]),
\ 'args_after': '--js',
\ 'fname': file_list })
let errorformat =
\ '%-GOK,'.
\ '%E%f:%l: ERROR - %m,'.
\ '%Z%p^,'.
\ '%W%f:%l: WARNING - %m,'.
\ '%Z%p^'
@ -64,7 +68,7 @@ endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'javascript',
\ 'name': 'closurecompiler',
\ 'exec': 'java'})
\ 'exec': get(g:, 'syntastic_javascript_closurecompiler_script', 'java')})
let &cpo = s:save_cpo
unlet s:save_cpo

View File

@ -0,0 +1,48 @@
"============================================================================
"File: bashate.vim
"Description: Bash script style checking plugin for syntastic.vim
"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_sh_bashate_checker")
finish
endif
let g:loaded_syntastic_sh_bashate_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_sh_bashate_GetLocList() dict
let makeprg = self.makeprgBuild({})
let errorformat =
\ '%EE%n: %m,' .
\ '%Z - %f: L%l,' .
\ '%-G%.%#'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'returns': [0, 1] })
for e in loclist
let e['text'] = substitute(e['text'], "\\m: '.*", '', '')
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'sh',
\ 'name': 'bashate' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View File

@ -29,7 +29,7 @@ set cpo&vim
" TODO: join this with html.vim DRY's sake?
function! s:TidyEncOptByFenc()
let tidy_opts = {
let TIDY_OPTS = {
\ 'utf-8': '-utf8',
\ 'ascii': '-ascii',
\ 'latin1': '-latin1',
@ -43,7 +43,7 @@ function! s:TidyEncOptByFenc()
\ 'sjis': '-shiftjis',
\ 'cp850': '-ibm858',
\ }
return get(tidy_opts, &fileencoding, '-utf8')
return get(TIDY_OPTS, &fileencoding, '-utf8')
endfunction
function! s:IgnoreError(text)