1
0
mirror of https://github.com/amix/vimrc synced 2025-06-30 11:54:59 +08:00

Updated plugins

This commit is contained in:
Amir Salihefendic
2019-11-16 16:28:42 +01:00
parent 96e10ed101
commit 72bdaba47e
204 changed files with 5936 additions and 1666 deletions

View File

@ -9,30 +9,22 @@ let s:cpo_save = &cpo
set cpo&vim
function! s:checkVersion() abort
" Not using the has('patch-7.4.2009') syntax because that wasn't added until
" 7.4.237, and we want to be sure this works for everyone (this is also why
" we're not using utils#EchoError()).
"
" Version 7.4.2009 was chosen because that's greater than what the most recent Ubuntu LTS
" release (16.04) uses and has a couple of features we need (e.g. execute()
" and :message clear).
let l:unsupported = 0
if go#config#VersionWarning() != 0
if has('nvim')
let l:unsupported = !has('nvim-0.3.2')
else
let l:unsupported = (v:version < 704 || (v:version == 704 && !has('patch2009')))
let l:unsupported = !has('patch-8.0.1453')
endif
if l:unsupported == 1
echohl Error
echom "vim-go requires Vim 7.4.2009 or Neovim 0.3.2, but you're using an older version."
echom "vim-go requires at least Vim 8.0.1453 or Neovim 0.3.2, but you're using an older version."
echom "Please update your Vim for the best vim-go experience."
echom "If you really want to continue you can set this to make the error go away:"
echom " let g:go_version_warning = 0"
echom "Note that some features may error out or behave incorrectly."
echom "Please do not report bugs unless you're using Vim 7.4.2009 or newer or Neovim 0.3.2."
echom "Please do not report bugs unless you're using at least Vim 8.0.1453 or Neovim 0.3.2."
echohl None
" Make sure people see this.
@ -45,28 +37,30 @@ call s:checkVersion()
" these packages are used by vim-go and can be automatically installed if
" needed by the user with GoInstallBinaries.
" NOTE(bc): varying the binary name and the tail of the import path (e.g.
" gocode-gomod) does not yet work in module aware mode.
let s:packages = {
\ 'asmfmt': ['github.com/klauspost/asmfmt/cmd/asmfmt'],
\ 'dlv': ['github.com/go-delve/delve/cmd/dlv'],
\ 'errcheck': ['github.com/kisielk/errcheck'],
\ 'fillstruct': ['github.com/davidrjenni/reftools/cmd/fillstruct'],
\ 'gocode': ['github.com/mdempsky/gocode', {'windows': ['-ldflags', '-H=windowsgui']}],
\ 'asmfmt': ['github.com/klauspost/asmfmt/cmd/asmfmt@master'],
\ 'dlv': ['github.com/go-delve/delve/cmd/dlv@master'],
\ 'errcheck': ['github.com/kisielk/errcheck@master'],
\ 'fillstruct': ['github.com/davidrjenni/reftools/cmd/fillstruct@master'],
\ 'gocode': ['github.com/mdempsky/gocode@master', {'windows': ['-ldflags', '-H=windowsgui']}],
\ 'gocode-gomod': ['github.com/stamblerre/gocode'],
\ 'godef': ['github.com/rogpeppe/godef'],
\ 'gogetdoc': ['github.com/zmb3/gogetdoc'],
\ 'goimports': ['golang.org/x/tools/cmd/goimports'],
\ 'golint': ['golang.org/x/lint/golint'],
\ 'godef': ['github.com/rogpeppe/godef@master'],
\ 'gogetdoc': ['github.com/zmb3/gogetdoc@master'],
\ 'goimports': ['golang.org/x/tools/cmd/goimports@master'],
\ 'golint': ['golang.org/x/lint/golint@master'],
\ 'gopls': ['golang.org/x/tools/gopls@latest', {}, {'after': function('go#lsp#Restart', [])}],
\ 'gometalinter': ['github.com/alecthomas/gometalinter'],
\ 'golangci-lint': ['github.com/golangci/golangci-lint/cmd/golangci-lint'],
\ 'gomodifytags': ['github.com/fatih/gomodifytags'],
\ 'gorename': ['golang.org/x/tools/cmd/gorename'],
\ 'gotags': ['github.com/jstemmer/gotags'],
\ 'guru': ['golang.org/x/tools/cmd/guru'],
\ 'impl': ['github.com/josharian/impl'],
\ 'keyify': ['honnef.co/go/tools/cmd/keyify'],
\ 'motion': ['github.com/fatih/motion'],
\ 'iferr': ['github.com/koron/iferr'],
\ 'golangci-lint': ['github.com/golangci/golangci-lint/cmd/golangci-lint@master'],
\ 'gomodifytags': ['github.com/fatih/gomodifytags@master'],
\ 'gorename': ['golang.org/x/tools/cmd/gorename@master'],
\ 'gotags': ['github.com/jstemmer/gotags@master'],
\ 'guru': ['golang.org/x/tools/cmd/guru@master'],
\ 'impl': ['github.com/josharian/impl@master'],
\ 'keyify': ['honnef.co/go/tools/cmd/keyify@master'],
\ 'motion': ['github.com/fatih/motion@master'],
\ 'iferr': ['github.com/koron/iferr@master'],
\ }
" These commands are available on any filetypes
@ -90,16 +84,14 @@ function! s:GoInstallBinaries(updateBinaries, ...)
endif
if go#path#Default() == ""
echohl Error
echomsg "vim.go: $GOPATH is not set and 'go env GOPATH' returns empty"
echohl None
call go#util#EchoError('$GOPATH is not set and `go env GOPATH` returns empty')
return
endif
let go_bin_path = go#path#BinPath()
" change $GOBIN so go get can automatically install to it
let $GOBIN = go_bin_path
let Restore_gobin = go#util#SetEnv('GOBIN', go_bin_path)
" vim's executable path is looking in PATH so add our go_bin path to it
let Restore_path = go#util#SetEnv('PATH', go_bin_path . go#util#PathListSep() . $PATH)
@ -173,10 +165,17 @@ function! s:GoInstallBinaries(updateBinaries, ...)
execute l:cd . fnameescape(l:tmpdir)
let l:get_cmd = copy(l:get_base_cmd)
" first download the binary
if len(l:pkg) > 1 && get(l:pkg[1], l:platform, []) isnot []
let l:get_cmd += get(l:pkg[1], l:platform, [])
endif
" TODO(bc): how to install the bin to a different name than the
" binary path? go get does not support -o
" let l:get_cmd += ['-o', printf('%s%s%s', go_bin_path, go#util#PathSep(), bin)]
let [l:out, l:err] = go#util#Exec(l:get_cmd + [l:importPath])
if l:err
echom "Error installing " . l:importPath . ": " . l:out
call go#util#EchoError(printf('Error installing %s: %s', l:importPath, l:out))
endif
call call(Restore_modules, [])
@ -191,27 +190,26 @@ function! s:GoInstallBinaries(updateBinaries, ...)
let l:get_cmd += ['-u']
endif
" GO111MODULE must be off to install gometalinter.
let Restore_modules = go#util#SetEnv('GO111MODULE', 'off')
" first download the binary
let [l:out, l:err] = go#util#Exec(l:get_cmd + [l:importPath])
if l:err
echom "Error downloading " . l:importPath . ": " . l:out
call go#util#EchoError(printf('Error downloading %s: %s', l:importPath, l:out))
endif
" and then build and install it
let l:build_cmd = ['go', 'build', '-o', go_bin_path . go#util#PathSep() . bin, l:importPath]
if len(l:pkg) > 1 && get(l:pkg[1], l:platform, '') isnot ''
let l:build_cmd += get(l:pkg[1], l:platform, '')
let l:build_cmd = ['go', 'build']
if len(l:pkg) > 1 && get(l:pkg[1], l:platform, []) isnot []
let l:build_cmd += get(l:pkg[1], l:platform, [])
endif
let l:build_cmd += ['-o', printf('%s%s%s', go_bin_path, go#util#PathSep(), bin), l:importPath]
let [l:out, l:err] = go#util#Exec(l:build_cmd)
if l:err
echom "Error installing " . l:importPath . ": " . l:out
call go#util#EchoError(printf('Error installing %s: %s', l:importPath, l:out))
endif
call call(Restore_modules, [])
endif
@ -223,6 +221,7 @@ function! s:GoInstallBinaries(updateBinaries, ...)
" restore back!
call call(Restore_path, [])
call call(Restore_gobin, [])
if resetshellslash
set shellslash
@ -241,12 +240,12 @@ endfunction
" commands are available.
function! s:CheckBinaries()
if !executable('go')
echohl Error | echomsg "vim-go: go executable not found." | echohl None
call go#util#EchoError('go executable not found.')
return -1
endif
if !executable('git')
echohl Error | echomsg "vim-go: git executable not found." | echohl None
call go#util#EchoError('git executable not found.')
return -1
endif
endfunction