mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -3,9 +3,22 @@ if !exists("g:go_jump_to_error")
|
||||
endif
|
||||
|
||||
function! go#cmd#Run(bang, ...)
|
||||
let goFiles = '"' . join(go#tool#Files(), '" "') . '"'
|
||||
|
||||
if IsWin()
|
||||
exec '!go run ' . goFiles
|
||||
if v:shell_error
|
||||
redraws! | echon "vim-go: [run] " | echohl ErrorMsg | echon "FAILED"| echohl None
|
||||
else
|
||||
redraws! | echon "vim-go: [run] " | echohl Function | echon "SUCCESS"| echohl None
|
||||
endif
|
||||
|
||||
return
|
||||
endif
|
||||
|
||||
let default_makeprg = &makeprg
|
||||
if !len(a:000)
|
||||
let &makeprg = "go run " . join(go#tool#Files(), ' ')
|
||||
let &makeprg = 'go run ' . goFiles
|
||||
else
|
||||
let &makeprg = "go run " . expand(a:1)
|
||||
endif
|
||||
@ -25,8 +38,8 @@ function! go#cmd#Run(bang, ...)
|
||||
endfunction
|
||||
|
||||
function! go#cmd#Install(...)
|
||||
let pkgs = join(a:000, ' ')
|
||||
let command = 'go install '.pkgs
|
||||
let pkgs = join(a:000, '" "')
|
||||
let command = 'go install "' . pkgs . '"'
|
||||
let out = go#tool#ExecuteInDir(command)
|
||||
if v:shell_error
|
||||
call go#tool#ShowErrors(out)
|
||||
@ -41,13 +54,13 @@ function! go#cmd#Install(...)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! go#cmd#Build(bang)
|
||||
function! go#cmd#Build(bang, ...)
|
||||
let default_makeprg = &makeprg
|
||||
let gofiles = join(go#tool#Files(), ' ')
|
||||
let gofiles = join(go#tool#Files(), '" "')
|
||||
if v:shell_error
|
||||
let &makeprg = "go build . errors"
|
||||
else
|
||||
let &makeprg = "go build -o /dev/null " . gofiles
|
||||
let &makeprg = "go build -o /dev/null " . join(a:000, ' ') . ' "' . gofiles . '"'
|
||||
endif
|
||||
|
||||
echon "vim-go: " | echohl Identifier | echon "building ..."| echohl None
|
||||
@ -60,7 +73,7 @@ function! go#cmd#Build(bang)
|
||||
if g:go_jump_to_error
|
||||
cc 1 "jump to first error if there is any
|
||||
endif
|
||||
else
|
||||
else
|
||||
redraws! | echon "vim-go: " | echohl Function | echon "[build] SUCCESS"| echohl None
|
||||
endif
|
||||
endif
|
||||
@ -75,21 +88,22 @@ function! go#cmd#Test(...)
|
||||
endif
|
||||
|
||||
echon "vim-go: " | echohl Identifier | echon "testing ..." | echohl None
|
||||
redraw
|
||||
let out = go#tool#ExecuteInDir(command)
|
||||
if v:shell_error
|
||||
call go#tool#ShowErrors(out)
|
||||
cwindow
|
||||
let errors = getqflist()
|
||||
if !empty(errors)
|
||||
if g:go_jump_to_error
|
||||
cc 1 "jump to first error if there is any
|
||||
endif
|
||||
endif
|
||||
echon "vim-go: " | echohl ErrorMsg | echon "[test] FAIL" | echohl None
|
||||
else
|
||||
call setqflist([])
|
||||
endif
|
||||
cwindow
|
||||
|
||||
let errors = getqflist()
|
||||
if !empty(errors)
|
||||
if g:go_jump_to_error
|
||||
cc 1 "jump to first error if there is any
|
||||
endif
|
||||
else
|
||||
redraw | echon "vim-go: " | echohl Function | echon "[test] PASS" | echohl None
|
||||
cwindow
|
||||
echon "vim-go: " | echohl Function | echon "[test] PASS" | echohl None
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
Reference in New Issue
Block a user