mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -27,7 +27,6 @@ command! GoInstallBinaries call s:GoInstallBinaries(-1)
|
||||
command! GoUpdateBinaries call s:GoInstallBinaries(1)
|
||||
command! -nargs=? -complete=dir GoPath call go#path#GoPath(<f-args>)
|
||||
|
||||
|
||||
" GoInstallBinaries downloads and install all necessary binaries stated in the
|
||||
" packages variable. It uses by default $GOBIN or $GOPATH/bin as the binary
|
||||
" target install directory. GoInstallBinaries doesn't install binaries if they
|
||||
@ -143,44 +142,64 @@ function! s:echo_go_info()
|
||||
redraws! | echo "vim-go: " | echohl Function | echon item.info | echohl None
|
||||
endfunction
|
||||
|
||||
function! s:auto_type_info()
|
||||
" GoInfo automatic update
|
||||
if get(g:, "go_auto_type_info", 0)
|
||||
call go#complete#Info(1)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:auto_sameids()
|
||||
" GoSameId automatic update
|
||||
if get(g:, "go_auto_sameids", 0)
|
||||
call go#guru#SameIds(-1)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:fmt_autosave()
|
||||
" Go code formatting on save
|
||||
if get(g:, "go_fmt_autosave", 1)
|
||||
call go#fmt#Format(-1)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:asmfmt_autosave()
|
||||
" Go asm formatting on save
|
||||
if get(g:, "go_asmfmt_autosave", 1)
|
||||
call go#asmfmt#Format()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:metalinter_autosave()
|
||||
" run gometalinter on save
|
||||
if get(g:, "go_metalinter_autosave", 0)
|
||||
call go#lint#Gometa(1)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:template_autocreate()
|
||||
" create new template from scratch
|
||||
if get(g:, "go_template_autocreate", 1)
|
||||
call go#template#create()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
augroup vim-go
|
||||
autocmd!
|
||||
|
||||
" GoInfo automatic update
|
||||
if get(g:, "go_auto_type_info", 0)
|
||||
autocmd CursorHold *.go nested call go#complete#Info(1)
|
||||
endif
|
||||
|
||||
" GoSameId automatic update
|
||||
if get(g:, "go_auto_sameids", 0)
|
||||
autocmd CursorMoved *.go nested call go#guru#SameIds(-1)
|
||||
endif
|
||||
autocmd CursorHold *.go call s:auto_type_info()
|
||||
autocmd CursorHold *.go call s:auto_sameids()
|
||||
|
||||
" Echo the identifier information when completion is done. Useful to see
|
||||
" the signature of a function, etc...
|
||||
if exists('##CompleteDone')
|
||||
autocmd CompleteDone *.go nested call s:echo_go_info()
|
||||
autocmd CompleteDone *.go call s:echo_go_info()
|
||||
endif
|
||||
|
||||
" Go code formatting on save
|
||||
if get(g:, "go_fmt_autosave", 1)
|
||||
autocmd BufWritePre *.go call go#fmt#Format(-1)
|
||||
endif
|
||||
|
||||
" Go asm formatting on save
|
||||
if get(g:, "go_asmfmt_autosave", 1)
|
||||
autocmd BufWritePre *.s call go#asmfmt#Format()
|
||||
endif
|
||||
|
||||
" run gometalinter on save
|
||||
if get(g:, "go_metalinter_autosave", 0)
|
||||
autocmd BufWritePost *.go call go#lint#Gometa(1)
|
||||
endif
|
||||
|
||||
" create new template from scratch
|
||||
if get(g:, "go_template_autocreate", 1)
|
||||
autocmd BufNewFile *.go call go#template#create()
|
||||
endif
|
||||
autocmd BufWritePre *.go call s:fmt_autosave()
|
||||
autocmd BufWritePre *.s call s:asmfmt_autosave()
|
||||
autocmd BufWritePost *.go call s:metalinter_autosave()
|
||||
autocmd BufNewFile *.go call s:template_autocreate()
|
||||
augroup END
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
Reference in New Issue
Block a user