mirror of
https://github.com/amix/vimrc
synced 2025-06-23 23:15:01 +08:00
Updated plugins
This commit is contained in:
@ -190,7 +190,7 @@ let g:syntastic_check_on_wq = 0
|
||||
__4.1. Q. I installed syntastic but it isn't reporting any errors...__
|
||||
|
||||
A. The most likely reason is that none of the syntax checkers that it requires
|
||||
is installed. For example: by default, python requires either `flake8` or
|
||||
are installed. For example: by default, python requires either `flake8` or
|
||||
`pylint` to be installed and in your `$PATH`. To see which executables are
|
||||
supported, look at the [wiki][3]. Note that aliases do not work; the actual
|
||||
executables must be available in your `$PATH`. Symbolic links are okay though.
|
||||
|
@ -227,12 +227,12 @@ function! syntastic#preprocess#prospector(errors) abort " {{{2
|
||||
|
||||
call add(out, msg)
|
||||
catch /\m^Vim\%((\a\+)\)\=:E716/
|
||||
call syntastic#log#warn('checker python/prospector: unrecognized error format')
|
||||
call syntastic#log#warn('checker python/prospector: unrecognized error item ' . string(e))
|
||||
let out = []
|
||||
break
|
||||
endtry
|
||||
else
|
||||
call syntastic#log#warn('checker python/prospector: unrecognized error format')
|
||||
call syntastic#log#warn('checker python/prospector: unrecognized error item ' . string(e))
|
||||
let out = []
|
||||
break
|
||||
endif
|
||||
@ -394,12 +394,12 @@ function! syntastic#preprocess#vint(errors) abort " {{{2
|
||||
|
||||
call add(out, msg)
|
||||
catch /\m^Vim\%((\a\+)\)\=:E716/
|
||||
call syntastic#log#warn('checker vim/vint: unrecognized error format')
|
||||
call syntastic#log#warn('checker vim/vint: unrecognized error item ' . string(e))
|
||||
let out = []
|
||||
break
|
||||
endtry
|
||||
else
|
||||
call syntastic#log#warn('checker vim/vint: unrecognized error format')
|
||||
call syntastic#log#warn('checker vim/vint: unrecognized error item ' . string(e))
|
||||
let out = []
|
||||
break
|
||||
endif
|
||||
|
@ -334,6 +334,12 @@ function! syntastic#util#stamp() abort " {{{2
|
||||
return split( split(reltimestr(reltime(g:_SYNTASTIC_START)))[0], '\.' )
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#util#setChangedtick() abort " {{{2
|
||||
unlockvar! b:syntastic_changedtick
|
||||
let b:syntastic_changedtick = b:changedtick
|
||||
lockvar! b:syntastic_changedtick
|
||||
endfunction " }}}2
|
||||
|
||||
let s:_wid_base = 'syntastic_' . getpid() . '_' . reltimestr(g:_SYNTASTIC_START) . '_'
|
||||
let s:_wid_pool = 0
|
||||
|
||||
|
@ -19,7 +19,7 @@ if has('reltime')
|
||||
lockvar! g:_SYNTASTIC_START
|
||||
endif
|
||||
|
||||
let g:_SYNTASTIC_VERSION = '3.7.0-106'
|
||||
let g:_SYNTASTIC_VERSION = '3.7.0-112'
|
||||
lockvar g:_SYNTASTIC_VERSION
|
||||
|
||||
" Sanity checks {{{1
|
||||
@ -94,7 +94,7 @@ let g:_SYNTASTIC_DEFAULTS = {
|
||||
\ 'loc_list_height': 10,
|
||||
\ 'nested_autocommands': 0,
|
||||
\ 'quiet_messages': {},
|
||||
\ 'reuse_loc_lists': 0,
|
||||
\ 'reuse_loc_lists': 1,
|
||||
\ 'shell': &shell,
|
||||
\ 'sort_aggregated_errors': 1,
|
||||
\ 'stl_format': '[Syntax: line:%F (%t)]',
|
||||
@ -292,7 +292,7 @@ function! s:BufEnterHook() abort " {{{2
|
||||
let loclist = filter(copy(getloclist(0)), 'v:val["valid"] == 1')
|
||||
let owner = str2nr(getbufvar(bufnr(''), 'syntastic_owner_buffer'))
|
||||
let buffers = syntastic#util#unique(map(loclist, 'v:val["bufnr"]') + (owner ? [owner] : []))
|
||||
if get(w:, 'syntastic_loclist_set', 0) && !empty(loclist) && empty(filter( buffers, 'syntastic#util#bufIsActive(v:val)' ))
|
||||
if !empty(get(w:, 'syntastic_loclist_set', [])) && !empty(loclist) && empty(filter( buffers, 'syntastic#util#bufIsActive(v:val)' ))
|
||||
call SyntasticLoclistHide()
|
||||
endif
|
||||
endif
|
||||
@ -307,7 +307,7 @@ function! s:QuitPreHook(fname) abort " {{{2
|
||||
call add(s:_quit_pre, buf . '_' . getbufvar(buf, 'changetick') . '_' . w:syntastic_wid)
|
||||
endif
|
||||
|
||||
if get(w:, 'syntastic_loclist_set', 0)
|
||||
if !empty(get(w:, 'syntastic_loclist_set', []))
|
||||
call SyntasticLoclistHide()
|
||||
endif
|
||||
endfunction " }}}2
|
||||
@ -333,9 +333,7 @@ function! s:UpdateErrors(auto_invoked, checker_names) abort " {{{2
|
||||
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
|
||||
call syntastic#util#setChangedtick()
|
||||
else
|
||||
if a:auto_invoked
|
||||
return
|
||||
@ -358,11 +356,14 @@ function! s:UpdateErrors(auto_invoked, checker_names) abort " {{{2
|
||||
let do_jump = 0
|
||||
endif
|
||||
|
||||
let w:syntastic_loclist_set = 0
|
||||
let w:syntastic_loclist_set = []
|
||||
if syntastic#util#var('always_populate_loc_list') || do_jump
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: setloclist (new)')
|
||||
call setloclist(0, loclist.getRaw())
|
||||
let w:syntastic_loclist_set = 1
|
||||
if !exists('b:syntastic_changedtick')
|
||||
call syntastic#util#setChangedtick()
|
||||
endif
|
||||
let w:syntastic_loclist_set = [bufnr(''), b:syntastic_changedtick]
|
||||
if run_checks && do_jump && !loclist.isEmpty()
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: jump')
|
||||
execute 'silent! lrewind ' . do_jump
|
||||
|
@ -291,12 +291,15 @@ endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.setloclist() abort " {{{2
|
||||
if !exists('w:syntastic_loclist_set')
|
||||
let w:syntastic_loclist_set = 0
|
||||
let w:syntastic_loclist_set = []
|
||||
endif
|
||||
if empty(w:syntastic_loclist_set) || w:syntastic_loclist_set != [bufnr(''), b:changedtick]
|
||||
let replace = g:syntastic_reuse_loc_lists && !empty(w:syntastic_loclist_set)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: setloclist ' . (replace ? '(replace)' : '(new)'))
|
||||
call setloclist(0, self.getRaw(), replace ? 'r' : ' ')
|
||||
call syntastic#util#setChangedtick()
|
||||
let w:syntastic_loclist_set = [bufnr(''), b:syntastic_changedtick]
|
||||
endif
|
||||
let replace = g:syntastic_reuse_loc_lists && w:syntastic_loclist_set
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: setloclist ' . (replace ? '(replace)' : '(new)'))
|
||||
call setloclist(0, self.getRaw(), replace ? 'r' : ' ')
|
||||
let w:syntastic_loclist_set = 1
|
||||
endfunction " }}}2
|
||||
|
||||
"display the cached errors for this buf in the location list
|
||||
|
@ -24,22 +24,28 @@ if !exists('g:syntastic_d_compiler_options')
|
||||
let g:syntastic_d_compiler_options = ''
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_d_use_dub')
|
||||
let g:syntastic_d_use_dub = 1
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_d_dub_exec')
|
||||
let g:syntastic_d_dub_exec = 'dub'
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_d_dmd_IsAvailable() dict
|
||||
function! SyntaxCheckers_d_dmd_IsAvailable() dict " {{{1
|
||||
if !exists('g:syntastic_d_compiler')
|
||||
let g:syntastic_d_compiler = self.getExec()
|
||||
endif
|
||||
call self.log('g:syntastic_d_compiler =', g:syntastic_d_compiler)
|
||||
return executable(expand(g:syntastic_d_compiler, 1))
|
||||
endfunction
|
||||
endfunction " }}}1
|
||||
|
||||
function! SyntaxCheckers_d_dmd_GetLocList() dict
|
||||
function! SyntaxCheckers_d_dmd_GetLocList() dict " {{{1
|
||||
if !exists('g:syntastic_d_include_dirs')
|
||||
let g:syntastic_d_include_dirs = filter(glob($HOME . '/.dub/packages/*', 1, 1), 'isdirectory(v:val)')
|
||||
call map(g:syntastic_d_include_dirs, 'isdirectory(v:val . "/source") ? v:val . "/source" : v:val')
|
||||
call add(g:syntastic_d_include_dirs, './source')
|
||||
let g:syntastic_d_include_dirs = s:GetIncludes(self, expand('%:p:h'))
|
||||
endif
|
||||
|
||||
return syntastic#c#GetLocList('d', 'dmd', {
|
||||
@ -48,7 +54,73 @@ function! SyntaxCheckers_d_dmd_GetLocList() dict
|
||||
\ '%f:%l: %m',
|
||||
\ 'main_flags': '-c -of' . syntastic#util#DevNull(),
|
||||
\ 'header_names': '\m\.di$' })
|
||||
endfunction
|
||||
endfunction " }}}1
|
||||
|
||||
" Utilities {{{1
|
||||
|
||||
function! s:GetIncludes(checker, base) " {{{2
|
||||
let includes = []
|
||||
|
||||
if g:syntastic_d_use_dub && !exists('s:dub_ok')
|
||||
let s:dub_ok = s:ValidateDub(a:checker)
|
||||
endif
|
||||
|
||||
if g:syntastic_d_use_dub && s:dub_ok
|
||||
let where = escape(a:base, ' ') . ';'
|
||||
|
||||
let old_suffixesadd = &suffixesadd
|
||||
let dirs = syntastic#util#unique(map(filter(
|
||||
\ findfile('dub.json', where, -1) +
|
||||
\ findfile('dub.sdl', where, -1) +
|
||||
\ findfile('package.json', where, -1),
|
||||
\ 'filereadable(v:val)'), 'fnamemodify(v:val, ":h")'))
|
||||
let &suffixesadd = old_suffixesadd
|
||||
call a:checker.log('using dub: looking for includes in', dirs)
|
||||
|
||||
for dir in dirs
|
||||
try
|
||||
execute 'silent lcd ' . fnameescape(dir)
|
||||
let paths = split(syntastic#util#system(syntastic#util#shescape(g:syntastic_d_dub_exec) . ' describe --import-paths'), "\n")
|
||||
silent lcd -
|
||||
if v:shell_error == 0
|
||||
call extend(includes, paths)
|
||||
call a:checker.log('using dub: found includes', paths)
|
||||
endif
|
||||
catch /\m^Vim\%((\a\+)\)\=:E472/
|
||||
" evil directory is evil
|
||||
endtry
|
||||
endfor
|
||||
endif
|
||||
|
||||
if empty(includes)
|
||||
let includes = filter(glob($HOME . '/.dub/packages/*', 1, 1), 'isdirectory(v:val)')
|
||||
call map(includes, 'isdirectory(v:val . "/source") ? v:val . "/source" : v:val')
|
||||
call add(includes, './source')
|
||||
endif
|
||||
|
||||
return syntastic#util#unique(includes)
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:ValidateDub(checker) " {{{2
|
||||
let ok = 0
|
||||
|
||||
if executable(g:syntastic_d_dub_exec)
|
||||
let command = syntastic#util#shescape(g:syntastic_d_dub_exec) . ' --version'
|
||||
let version_output = syntastic#util#system(command)
|
||||
call a:checker.log('getVersion: ' . string(command) . ': ' .
|
||||
\ string(split(version_output, "\n", 1)) .
|
||||
\ (v:shell_error ? ' (exit code ' . v:shell_error . ')' : '') )
|
||||
let parsed_ver = syntastic#util#parseVersion(version_output)
|
||||
call a:checker.log(g:syntastic_d_dub_exec . ' version =', parsed_ver)
|
||||
if len(parsed_ver)
|
||||
let ok = syntastic#util#versionIsAtLeast(parsed_ver, [0, 9, 24])
|
||||
endif
|
||||
endif
|
||||
|
||||
return ok
|
||||
endfunction " }}}2
|
||||
|
||||
" }}}1
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'd',
|
||||
|
Reference in New Issue
Block a user