mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Updated vim plugins
This commit is contained in:
@ -1,4 +1,8 @@
|
||||
function! go#lint#Gometa(autosave, ...) abort
|
||||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! go#lint#Gometa(bang, autosave, ...) abort
|
||||
if a:0 == 0
|
||||
let goargs = [expand('%:p:h')]
|
||||
else
|
||||
@ -57,7 +61,7 @@ function! go#lint#Gometa(autosave, ...) abort
|
||||
let cmd += goargs
|
||||
|
||||
if go#util#has_job()
|
||||
call s:lint_job({'cmd': cmd}, a:autosave)
|
||||
call s:lint_job({'cmd': cmd}, a:bang, a:autosave)
|
||||
return
|
||||
endif
|
||||
|
||||
@ -85,7 +89,7 @@ function! go#lint#Gometa(autosave, ...) abort
|
||||
let errors = go#list#Get(l:listtype)
|
||||
call go#list#Window(l:listtype, len(errors))
|
||||
|
||||
if !a:autosave
|
||||
if !a:autosave && !a:bang
|
||||
call go#list#JumpToFirst(l:listtype)
|
||||
endif
|
||||
endif
|
||||
@ -93,7 +97,7 @@ endfunction
|
||||
|
||||
" Golint calls 'golint' on the current directory. Any warnings are populated in
|
||||
" the location list
|
||||
function! go#lint#Golint(...) abort
|
||||
function! go#lint#Golint(bang, ...) abort
|
||||
if a:0 == 0
|
||||
let [l:out, l:err] = go#util#Exec([go#config#GolintBin(), go#package#ImportPath()])
|
||||
else
|
||||
@ -109,7 +113,9 @@ function! go#lint#Golint(...) abort
|
||||
call go#list#Parse(l:listtype, l:out, "GoLint")
|
||||
let l:errors = go#list#Get(l:listtype)
|
||||
call go#list#Window(l:listtype, len(l:errors))
|
||||
call go#list#JumpToFirst(l:listtype)
|
||||
if !a:bang
|
||||
call go#list#JumpToFirst(l:listtype)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Vet calls 'go vet' on the current directory. Any warnings are populated in
|
||||
@ -143,7 +149,7 @@ endfunction
|
||||
|
||||
" ErrCheck calls 'errcheck' for the given packages. Any warnings are populated in
|
||||
" the location list
|
||||
function! go#lint#Errcheck(...) abort
|
||||
function! go#lint#Errcheck(bang, ...) abort
|
||||
if a:0 == 0
|
||||
let l:import_path = go#package#ImportPath()
|
||||
if import_path == -1
|
||||
@ -175,7 +181,7 @@ function! go#lint#Errcheck(...) abort
|
||||
if !empty(errors)
|
||||
call go#list#Populate(l:listtype, errors, 'Errcheck')
|
||||
call go#list#Window(l:listtype, len(errors))
|
||||
if !empty(errors)
|
||||
if !a:bang
|
||||
call go#list#JumpToFirst(l:listtype)
|
||||
endif
|
||||
endif
|
||||
@ -196,11 +202,12 @@ function! go#lint#ToggleMetaLinterAutoSave() abort
|
||||
call go#util#EchoProgress("auto metalinter enabled")
|
||||
endfunction
|
||||
|
||||
function! s:lint_job(args, autosave)
|
||||
function! s:lint_job(args, bang, autosave)
|
||||
let l:opts = {
|
||||
\ 'statustype': "gometalinter",
|
||||
\ 'errorformat': '%f:%l:%c:%t%*[^:]:\ %m,%f:%l::%t%*[^:]:\ %m',
|
||||
\ 'for': "GoMetaLinter",
|
||||
\ 'bang': a:bang,
|
||||
\ }
|
||||
|
||||
if a:autosave
|
||||
@ -213,4 +220,8 @@ function! s:lint_job(args, autosave)
|
||||
call go#job#Spawn(a:args.cmd, l:opts)
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
Reference in New Issue
Block a user