mirror of
https://github.com/amix/vimrc
synced 2025-06-24 07:44:59 +08:00
Updated plugins
This commit is contained in:
@ -9,7 +9,7 @@
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
if exists('g:loaded_syntastic_plugin')
|
||||
if exists('g:loaded_syntastic_plugin') || &compatible
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_plugin = 1
|
||||
@ -19,11 +19,16 @@ if has('reltime')
|
||||
lockvar! g:_SYNTASTIC_START
|
||||
endif
|
||||
|
||||
let g:_SYNTASTIC_VERSION = '3.6.0-122'
|
||||
let g:_SYNTASTIC_VERSION = '3.7.0-55'
|
||||
lockvar g:_SYNTASTIC_VERSION
|
||||
|
||||
" Sanity checks {{{1
|
||||
|
||||
if v:version < 700 || (v:version == 700 && !has('patch175'))
|
||||
call syntastic#log#error('need Vim version 7.0.175 or later')
|
||||
finish
|
||||
endif
|
||||
|
||||
for s:feature in [
|
||||
\ 'autocmd',
|
||||
\ 'eval',
|
||||
@ -87,6 +92,7 @@ let g:_SYNTASTIC_DEFAULTS = {
|
||||
\ 'ignore_extensions': '\c\v^([gx]?z|lzma|bz2)$',
|
||||
\ 'ignore_files': [],
|
||||
\ 'loc_list_height': 10,
|
||||
\ 'nested_autocommands': 0,
|
||||
\ 'quiet_messages': {},
|
||||
\ 'reuse_loc_lists': 0,
|
||||
\ 'shell': &shell,
|
||||
@ -130,7 +136,7 @@ let s:_DEBUG_DUMP_OPTIONS = [
|
||||
\ 'shelltemp',
|
||||
\ 'shellxquote'
|
||||
\ ]
|
||||
if v:version > 703 || (v:version == 703 && has('patch446'))
|
||||
if exists('+shellxescape')
|
||||
call add(s:_DEBUG_DUMP_OPTIONS, 'shellxescape')
|
||||
endif
|
||||
lockvar! s:_DEBUG_DUMP_OPTIONS
|
||||
@ -157,6 +163,8 @@ let s:registry = g:SyntasticRegistry.Instance()
|
||||
let s:notifiers = g:SyntasticNotifiers.Instance()
|
||||
let s:modemap = g:SyntasticModeMap.Instance()
|
||||
|
||||
let s:_quit_pre = []
|
||||
|
||||
" Commands {{{1
|
||||
|
||||
" @vimlint(EVL103, 1, a:cursorPos)
|
||||
@ -184,12 +192,15 @@ endfunction " }}}2
|
||||
" @vimlint(EVL103, 0, a:cmdLine)
|
||||
" @vimlint(EVL103, 0, a:argLead)
|
||||
|
||||
command! -nargs=* -complete=custom,s:CompleteCheckerName SyntasticCheck call SyntasticCheck(<f-args>)
|
||||
command! -nargs=? -complete=custom,s:CompleteFiletypes SyntasticInfo call SyntasticInfo(<f-args>)
|
||||
command! Errors call SyntasticErrors()
|
||||
command! SyntasticReset call SyntasticReset()
|
||||
command! SyntasticToggleMode call SyntasticToggleMode()
|
||||
command! SyntasticSetLoclist call SyntasticSetLoclist()
|
||||
command! -bar -nargs=* -complete=custom,s:CompleteCheckerName SyntasticCheck call SyntasticCheck(<f-args>)
|
||||
command! -bar -nargs=? -complete=custom,s:CompleteFiletypes SyntasticInfo call SyntasticInfo(<f-args>)
|
||||
command! -bar Errors call SyntasticErrors()
|
||||
command! -bar SyntasticReset call SyntasticReset()
|
||||
command! -bar SyntasticToggleMode call SyntasticToggleMode()
|
||||
command! -bar SyntasticSetLoclist call SyntasticSetLoclist()
|
||||
|
||||
command! SyntasticJavacEditClasspath runtime! syntax_checkers/java/*.vim | SyntasticJavacEditClasspath
|
||||
command! SyntasticJavacEditConfig runtime! syntax_checkers/java/*.vim | SyntasticJavacEditConfig
|
||||
|
||||
" }}}1
|
||||
|
||||
@ -231,15 +242,26 @@ endfunction " }}}2
|
||||
" Autocommands {{{1
|
||||
|
||||
augroup syntastic
|
||||
autocmd BufReadPost * call s:BufReadPostHook()
|
||||
autocmd BufWritePost * call s:BufWritePostHook()
|
||||
autocmd BufEnter * call s:BufEnterHook()
|
||||
autocmd!
|
||||
autocmd BufEnter * call s:BufEnterHook()
|
||||
augroup END
|
||||
|
||||
if v:version > 703 || (v:version == 703 && has('patch544'))
|
||||
if g:syntastic_nested_autocommands
|
||||
augroup syntastic
|
||||
autocmd BufReadPost * nested call s:BufReadPostHook()
|
||||
autocmd BufWritePost * nested call s:BufWritePostHook()
|
||||
augroup END
|
||||
else
|
||||
augroup syntastic
|
||||
autocmd BufReadPost * call s:BufReadPostHook()
|
||||
autocmd BufWritePost * call s:BufWritePostHook()
|
||||
augroup END
|
||||
endif
|
||||
|
||||
if exists('##QuitPre')
|
||||
" QuitPre was added in Vim 7.3.544
|
||||
augroup syntastic
|
||||
autocmd QuitPre * call s:QuitPreHook()
|
||||
autocmd QuitPre * call s:QuitPreHook(expand('<amatch>', 1))
|
||||
augroup END
|
||||
endif
|
||||
|
||||
@ -276,10 +298,15 @@ function! s:BufEnterHook() abort " {{{2
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:QuitPreHook() abort " {{{2
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
|
||||
\ 'autocmd: QuitPre, buffer ' . bufnr('') . ' = ' . string(bufname(str2nr(bufnr('')))))
|
||||
let b:syntastic_skip_checks = get(b:, 'syntastic_skip_checks', 0) || !syntastic#util#var('check_on_wq')
|
||||
function! s:QuitPreHook(fname) abort " {{{2
|
||||
let buf = bufnr(fnameescape(a:fname))
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS, 'autocmd: QuitPre, buffer ' . buf . ' = ' . string(a:fname))
|
||||
|
||||
if !syntastic#util#var('check_on_wq')
|
||||
call syntastic#util#setWids()
|
||||
call add(s:_quit_pre, buf . '_' . getbufvar(buf, 'changetick') . '_' . w:syntastic_wid)
|
||||
endif
|
||||
|
||||
if get(w:, 'syntastic_loclist_set', 0)
|
||||
call SyntasticLoclistHide()
|
||||
endif
|
||||
@ -296,17 +323,23 @@ function! s:UpdateErrors(auto_invoked, checker_names) abort " {{{2
|
||||
call syntastic#log#debugDump(g:_SYNTASTIC_DEBUG_VARIABLES)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'UpdateErrors' . (a:auto_invoked ? ' (auto)' : '') .
|
||||
\ ': ' . (len(a:checker_names) ? join(a:checker_names) : 'default checkers'))
|
||||
|
||||
call s:modemap.synch()
|
||||
|
||||
if s:_skip_file()
|
||||
return
|
||||
endif
|
||||
|
||||
call s:modemap.synch()
|
||||
let run_checks = !a:auto_invoked || s:modemap.doAutoChecking()
|
||||
if run_checks
|
||||
call s:CacheErrors(a:checker_names)
|
||||
unlockvar! b:syntastic_changedtick
|
||||
let b:syntastic_changedtick = b:changedtick
|
||||
lockvar! b:syntastic_changedtick
|
||||
else
|
||||
if a:auto_invoked
|
||||
return
|
||||
endif
|
||||
endif
|
||||
|
||||
let loclist = g:SyntasticLoclist.current()
|
||||
@ -610,12 +643,26 @@ function! s:_ignore_file(filename) abort " {{{2
|
||||
return 0
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:_is_quitting(buf) abort " {{{2
|
||||
let quitting = 0
|
||||
if exists('w:syntastic_wid')
|
||||
let key = a:buf . '_' . getbufvar(a:buf, 'changetick') . '_' . w:syntastic_wid
|
||||
let idx = index(s:_quit_pre, key)
|
||||
if idx >= 0
|
||||
call remove(s:_quit_pre, idx)
|
||||
let quitting = 1
|
||||
endif
|
||||
endif
|
||||
|
||||
return quitting
|
||||
endfunction " }}}2
|
||||
|
||||
" Skip running in special buffers
|
||||
function! s:_skip_file() abort " {{{2
|
||||
let fname = expand('%', 1)
|
||||
let skip = get(b:, 'syntastic_skip_checks', 0) || (&buftype !=# '') ||
|
||||
\ !filereadable(fname) || getwinvar(0, '&diff') || s:_ignore_file(fname) ||
|
||||
\ fnamemodify(fname, ':e') =~? g:syntastic_ignore_extensions
|
||||
let skip = s:_is_quitting(bufnr('%')) || get(b:, 'syntastic_skip_checks', 0) ||
|
||||
\ (&buftype !=# '') || !filereadable(fname) || getwinvar(0, '&diff') ||
|
||||
\ s:_ignore_file(fname) || fnamemodify(fname, ':e') =~? g:syntastic_ignore_extensions
|
||||
if skip
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, '_skip_file: skipping checks')
|
||||
endif
|
||||
@ -628,6 +675,9 @@ function! s:_explain_skip(filetypes) abort " {{{2
|
||||
let why = []
|
||||
let fname = expand('%', 1)
|
||||
|
||||
if s:_is_quitting(bufnr('%'))
|
||||
call add(why, 'quitting buffer')
|
||||
endif
|
||||
if get(b:, 'syntastic_skip_checks', 0)
|
||||
call add(why, 'b:syntastic_skip_checks set')
|
||||
endif
|
||||
|
@ -7,26 +7,36 @@ let g:SyntasticChecker = {}
|
||||
|
||||
" Public methods {{{1
|
||||
|
||||
function! g:SyntasticChecker.New(args) abort " {{{2
|
||||
function! g:SyntasticChecker.New(args, ...) abort " {{{2
|
||||
let newObj = copy(self)
|
||||
|
||||
let newObj._filetype = a:args['filetype']
|
||||
let newObj._name = a:args['name']
|
||||
let newObj._exec = get(a:args, 'exec', newObj._name)
|
||||
|
||||
if has_key(a:args, 'redirect')
|
||||
let [filetype, name] = split(a:args['redirect'], '/')
|
||||
if a:0
|
||||
" redirected checker
|
||||
let newObj._exec = get(a:args, 'exec', a:1['_exec'])
|
||||
|
||||
let filetype = a:1['_filetype']
|
||||
let name = a:1['_name']
|
||||
let prefix = 'SyntaxCheckers_' . filetype . '_' . name . '_'
|
||||
|
||||
if exists('g:syntastic_' . filetype . '_' . name . '_sort') && !exists('g:syntastic_' . newObj._filetype . '_' . newObj._name . '_sort')
|
||||
let g:syntastic_{newObj._filetype}_{newObj._name}_sort = g:syntastic_{filetype}_{name}_sort
|
||||
endif
|
||||
else
|
||||
let prefix = 'SyntaxCheckers_' . newObj._filetype . '_' . newObj._name . '_'
|
||||
endif
|
||||
|
||||
if has_key(a:args, 'enable')
|
||||
let newObj._enable = a:args['enable']
|
||||
if has_key(a:args, 'enable')
|
||||
let newObj._enable = a:args['enable']
|
||||
elseif has_key(a:1, '_enable')
|
||||
let newObj._enable = a:1['_enable']
|
||||
endif
|
||||
else
|
||||
let newObj._exec = get(a:args, 'exec', newObj._name)
|
||||
let prefix = 'SyntaxCheckers_' . newObj._filetype . '_' . newObj._name . '_'
|
||||
|
||||
if has_key(a:args, 'enable')
|
||||
let newObj._enable = a:args['enable']
|
||||
endif
|
||||
endif
|
||||
|
||||
let newObj._locListFunc = function(prefix . 'GetLocList')
|
||||
@ -85,6 +95,11 @@ function! g:SyntasticChecker.getLocListRaw() abort " {{{2
|
||||
|
||||
if has_key(self, '_enable')
|
||||
let status = syntastic#util#var(self._enable, -1)
|
||||
if type(status) != type(0)
|
||||
call syntastic#log#error('checker ' . name . ': invalid value ' . strtrans(string(status)) .
|
||||
\ ' for g:syntastic_' . self._enable . '; try 0 or 1 instead')
|
||||
return []
|
||||
endif
|
||||
if status < 0
|
||||
call syntastic#log#error('checker ' . name . ': checks disabled for security reasons; ' .
|
||||
\ 'set g:syntastic_' . self._enable . ' to 1 to override')
|
||||
|
@ -110,19 +110,21 @@ function! g:SyntasticLoclist.getStatuslineFlag() abort " {{{2
|
||||
"hide stuff wrapped in %B(...) unless there are both errors and warnings
|
||||
let output = substitute(output, '\m\C%B{\([^}]*\)}', (num_warnings && num_errors) ? '\1' : '' , 'g')
|
||||
|
||||
"sub in the total errors/warnings/both
|
||||
let output = substitute(output, '\m\C%w', num_warnings, 'g')
|
||||
let output = substitute(output, '\m\C%e', num_errors, 'g')
|
||||
let output = substitute(output, '\m\C%t', num_issues, 'g')
|
||||
|
||||
"first error/warning line num
|
||||
let output = substitute(output, '\m\C%F', num_issues ? self._rawLoclist[0]['lnum'] : '', 'g')
|
||||
|
||||
"first error line num
|
||||
let output = substitute(output, '\m\C%fe', num_errors ? errors[0]['lnum'] : '', 'g')
|
||||
|
||||
"first warning line num
|
||||
let output = substitute(output, '\m\C%fw', num_warnings ? warnings[0]['lnum'] : '', 'g')
|
||||
let flags = {
|
||||
\ '%': '%',
|
||||
\ 't': num_issues,
|
||||
\ 'e': num_errors,
|
||||
\ 'w': num_warnings,
|
||||
\ 'N': (num_issues ? fnamemodify( bufname(self._rawLoclist[0]['bufnr']), ':t') : ''),
|
||||
\ 'P': (num_issues ? fnamemodify( bufname(self._rawLoclist[0]['bufnr']), ':p:~:.') : ''),
|
||||
\ 'F': (num_issues ? self._rawLoclist[0]['lnum'] : ''),
|
||||
\ 'ne': (num_errors ? fnamemodify( bufname(errors[0]['bufnr']), ':t') : ''),
|
||||
\ 'pe': (num_errors ? fnamemodify( bufname(errors[0]['bufnr']), ':p:~:.') : ''),
|
||||
\ 'fe': (num_errors ? errors[0]['lnum'] : ''),
|
||||
\ 'nw': (num_warnings ? fnamemodify( bufname(warnings[0]['bufnr']), ':t') : ''),
|
||||
\ 'pw': (num_warnings ? fnamemodify( bufname(warnings[0]['bufnr']), ':p:~:.') : ''),
|
||||
\ 'fw': (num_warnings ? warnings[0]['lnum'] : '') }
|
||||
let output = substitute(output, '\v\C\%(-?\d*%(\.\d+)?)([npf][ew]|[NPFtew%])', '\=syntastic#util#wformat(submatch(1), flags[submatch(2)])', 'g')
|
||||
|
||||
let self._stl_flag = output
|
||||
else
|
||||
|
@ -8,7 +8,8 @@ let g:loaded_syntastic_registry = 1
|
||||
let s:_DEFAULT_CHECKERS = {
|
||||
\ 'actionscript': ['mxmlc'],
|
||||
\ 'ada': ['gcc'],
|
||||
\ 'apiblueprint': ['snowcrash'],
|
||||
\ 'ansible': ['ansible_lint'],
|
||||
\ 'apiblueprint': ['drafter'],
|
||||
\ 'applescript': ['osacompile'],
|
||||
\ 'asciidoc': ['asciidoc'],
|
||||
\ 'asm': ['gcc'],
|
||||
@ -29,6 +30,7 @@ let s:_DEFAULT_CHECKERS = {
|
||||
\ 'd': ['dmd'],
|
||||
\ 'dart': ['dartanalyzer'],
|
||||
\ 'docbk': ['xmllint'],
|
||||
\ 'dockerfile': ['dockerfile_lint'],
|
||||
\ 'dustjs': ['swiffer'],
|
||||
\ 'elixir': [],
|
||||
\ 'erlang': ['escript'],
|
||||
@ -42,6 +44,7 @@ let s:_DEFAULT_CHECKERS = {
|
||||
\ 'haxe': ['haxe'],
|
||||
\ 'hss': ['hss'],
|
||||
\ 'html': ['tidy'],
|
||||
\ 'jade': ['jade_lint'],
|
||||
\ 'java': ['javac'],
|
||||
\ 'javascript': ['jshint', 'jslint'],
|
||||
\ 'json': ['jsonlint', 'jsonval'],
|
||||
@ -66,7 +69,9 @@ let s:_DEFAULT_CHECKERS = {
|
||||
\ 'pod': ['podchecker'],
|
||||
\ 'puppet': ['puppet', 'puppetlint'],
|
||||
\ 'python': ['python', 'flake8', 'pylint'],
|
||||
\ 'qml': ['qmllint'],
|
||||
\ 'r': [],
|
||||
\ 'rmd': [],
|
||||
\ 'racket': ['racket'],
|
||||
\ 'rnc': ['rnv'],
|
||||
\ 'rst': ['rst2pseudoxml'],
|
||||
@ -78,6 +83,8 @@ let s:_DEFAULT_CHECKERS = {
|
||||
\ 'slim': ['slimrb'],
|
||||
\ 'sml': ['smlnj'],
|
||||
\ 'spec': ['rpmlint'],
|
||||
\ 'sql': ['sqlint'],
|
||||
\ 'stylus': ['stylint'],
|
||||
\ 'tcl': ['nagelfar'],
|
||||
\ 'tex': ['lacheck', 'chktex'],
|
||||
\ 'texinfo': ['makeinfo'],
|
||||
@ -91,6 +98,7 @@ let s:_DEFAULT_CHECKERS = {
|
||||
\ 'xhtml': ['tidy'],
|
||||
\ 'xml': ['xmllint'],
|
||||
\ 'xslt': ['xmllint'],
|
||||
\ 'xquery': ['basex'],
|
||||
\ 'yacc': ['bison'],
|
||||
\ 'yaml': ['jsyaml'],
|
||||
\ 'z80': ['z80syntaxchecker'],
|
||||
@ -151,8 +159,21 @@ function! g:SyntasticRegistry.Instance() abort " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticRegistry.CreateAndRegisterChecker(args) abort " {{{2
|
||||
let checker = g:SyntasticChecker.New(a:args)
|
||||
let registry = g:SyntasticRegistry.Instance()
|
||||
|
||||
if has_key(a:args, 'redirect')
|
||||
let [ft, name] = split(a:args['redirect'], '/')
|
||||
call registry._loadCheckersFor(ft)
|
||||
|
||||
let clone = get(registry._checkerMap[ft], name, {})
|
||||
if empty(clone)
|
||||
throw 'Syntastic: Checker ' . a:args['redirect'] . ' redirects to unregistered checker ' . ft . '/' . name
|
||||
endif
|
||||
|
||||
let checker = g:SyntasticChecker.New(a:args, clone)
|
||||
else
|
||||
let checker = g:SyntasticChecker.New(a:args)
|
||||
endif
|
||||
call registry._registerChecker(checker)
|
||||
endfunction " }}}2
|
||||
|
||||
@ -187,7 +208,7 @@ function! g:SyntasticRegistry.getCheckersAvailable(ftalias, hints_list) abort "
|
||||
return filter(self.getCheckers(a:ftalias, a:hints_list), 'v:val.isAvailable()')
|
||||
endfunction " }}}2
|
||||
|
||||
" Same as getCheckers(), but keep only the checkers tyhat are available and
|
||||
" Same as getCheckers(), but keep only the checkers that are available and
|
||||
" disabled. This runs the corresponding IsAvailable() functions for all checkers.
|
||||
function! g:SyntasticRegistry.getCheckersDisabled(ftalias, hints_list) abort " {{{2
|
||||
return filter(self.getCheckers(a:ftalias, a:hints_list), 'v:val.isDisabled() && v:val.isAvailable()')
|
||||
|
Reference in New Issue
Block a user