1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 01:25:00 +08:00

Updated plugins

This commit is contained in:
amix
2015-02-04 10:43:54 +00:00
parent e7a01094b6
commit a4b4587019
71 changed files with 2076 additions and 1112 deletions

View File

@ -19,7 +19,12 @@ fu! s:gocodeCurrentBuffer()
return file
endf
let s:vim_system = get(g:, 'gocomplete#system_function', 'system')
if go#vimproc#has_vimproc()
let s:vim_system = get(g:, 'gocomplete#system_function', 'vimproc#system2')
else
let s:vim_system = get(g:, 'gocomplete#system_function', 'system')
endif
fu! s:system(str, ...)
return call(s:vim_system, [a:str] + a:000)

View File

@ -5,6 +5,10 @@ endif
function! go#errcheck#Run(...) abort
if a:0 == 0
let package = go#package#ImportPath(expand('%:p:h'))
if package == -1
echohl Error | echomsg "vim-go: package is not inside GOPATH src" | echohl None
return
endif
else
let package = a:1
end
@ -14,6 +18,7 @@ function! go#errcheck#Run(...) abort
return
endif
echon "vim-go: " | echohl Identifier | echon "errcheck analysing ..." | echohl None
let out = system(bin_path . ' ' . package)
if v:shell_error
let errors = []
@ -28,15 +33,21 @@ function! go#errcheck#Run(...) abort
\"text": tokens[4]})
endif
endfor
if empty(errors)
% | " Couldn't detect error format, output errors
echohl Error | echomsg "GoErrCheck returned error" | echohl None
echo out
endif
if !empty(errors)
redraw | echo
call setqflist(errors, 'r')
endif
echohl Error | echomsg "GoErrCheck returned error" | echohl None
else
call setqflist([])
endif
cwindow
endfunction
" vim:ts=4:sw=4:et

View File

@ -74,8 +74,15 @@ function! go#fmt#Format(withGoimport)
" get the command first so we can test it
let fmt_command = g:go_fmt_command
if a:withGoimport == 1
let fmt_command = g:go_goimports_bin
endif
" if it's something else than gofmt, we need to check the existing of that
" binary. For example if it's goimports, let us check if it's installed,
" if not the user get's a warning via go#tool#BinPath()
if fmt_command != "gofmt"
" check if the user has installed goimports
let bin_path = go#tool#BinPath(g:go_goimports_bin)
let bin_path = go#tool#BinPath(fmt_command)
if empty(bin_path)
return
endif

View File

@ -32,7 +32,8 @@ function! go#tool#Imports()
endif
for package_path in split(out, '\n')
let package_name = fnamemodify(package_path, ":t:r")
let cmd = "go list -f {{.Name}} " . package_path
let package_name = substitute(go#tool#ExecuteInDir(cmd), '\n$', '', '')
let imports[package_name] = package_path
endfor

View File

@ -0,0 +1,21 @@
"Check if has vimproc
function! go#vimproc#has_vimproc()
if !exists('g:go#use_vimproc')
if IsWin()
try
call vimproc#version()
let exists_vimproc = 1
catch
let exists_vimproc = 0
endtry
else
let exists_vimproc = 0
endif
let g:go#use_vimproc = exists_vimproc
endif
return g:go#use_vimproc
endfunction
" vim:ts=4:sw=4:et