mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -18,8 +18,9 @@ function! go#cmd#Build(bang, ...)
|
||||
let goargs = map(copy(a:000), "expand(v:val)")
|
||||
|
||||
" escape all shell arguments before we pass it to make
|
||||
let goargs = go#util#Shelllist(goargs, 1)
|
||||
|
||||
if !has('nvim')
|
||||
let goargs = go#util#Shelllist(goargs, 1)
|
||||
endif
|
||||
" create our command arguments. go build discards any results when it
|
||||
" compiles multiple packages. So we pass the `errors` package just as an
|
||||
" placeholder with the current folder (indicated with '.')
|
||||
|
@ -1,3 +1,5 @@
|
||||
let s:sock_type = (has('win32') || has('win64')) ? 'tcp' : 'unix'
|
||||
|
||||
function! s:gocodeCurrentBuffer()
|
||||
let buf = getline(1, '$')
|
||||
if &encoding != 'utf-8'
|
||||
@ -32,7 +34,7 @@ function! s:gocodeCommand(cmd, preargs, args)
|
||||
let old_gopath = $GOPATH
|
||||
let $GOPATH = go#path#Detect()
|
||||
|
||||
let socket_type = get(g:, 'go_gocode_socket_type', 'unix')
|
||||
let socket_type = get(g:, 'go_gocode_socket_type', s:sock_type)
|
||||
let cmd = printf('%s -sock %s %s %s %s',
|
||||
\ go#util#Shellescape(bin_path),
|
||||
\ socket_type,
|
||||
|
@ -113,8 +113,8 @@ function! s:jump_to_declaration(out, mode)
|
||||
" modes of switchbuf which we need based on the split mode
|
||||
let old_switchbuf = &switchbuf
|
||||
|
||||
let l:fname = fnamemodify(expand("%"), ':p:gs?\\?/?')
|
||||
if filename != l:fname
|
||||
normal! m'
|
||||
if filename != fnamemodify(expand("%"), ':p:gs?\\?/?')
|
||||
" jump to existing buffer if, 1. we have enabled it, 2. the buffer is loaded
|
||||
" and 3. there is buffer window number we switch to
|
||||
if get(g:, 'go_def_reuse_buffer', 0) && bufloaded(filename) != 0 && bufwinnr(filename) != -1
|
||||
@ -134,7 +134,7 @@ function! s:jump_to_declaration(out, mode)
|
||||
endif
|
||||
|
||||
" open the file and jump to line and column
|
||||
exec 'edit '.filename
|
||||
exec 'edit' filename
|
||||
endif
|
||||
call cursor(line, col)
|
||||
|
||||
@ -248,7 +248,7 @@ function! go#def#Stack(...)
|
||||
let target = s:go_stack[s:go_stack_level]
|
||||
|
||||
" jump
|
||||
exec 'edit '.target["file"]
|
||||
exec 'edit' target["file"]
|
||||
call cursor(target["line"], target["col"])
|
||||
normal! zz
|
||||
else
|
||||
|
@ -85,6 +85,7 @@ function! go#doc#Open(newmode, mode, ...)
|
||||
endif
|
||||
|
||||
let command = printf("%s %s", bin_path, join(a:000, ' '))
|
||||
let out = go#util#System(command)
|
||||
else
|
||||
" check if we have 'gogetdoc' and use it automatically
|
||||
let bin_path = go#path#CheckBinPath('gogetdoc')
|
||||
@ -95,11 +96,27 @@ function! go#doc#Open(newmode, mode, ...)
|
||||
let offset = go#util#OffsetCursor()
|
||||
let fname = expand("%:p:gs!\\!/!")
|
||||
let pos = shellescape(fname.':#'.offset)
|
||||
|
||||
let command = printf("%s -pos %s", bin_path, pos)
|
||||
|
||||
if &modified
|
||||
" gogetdoc supports the same archive format as guru for dealing with
|
||||
" modified buffers.
|
||||
" use the -modified flag
|
||||
" write each archive entry on stdin as:
|
||||
" filename followed by newline
|
||||
" file size followed by newline
|
||||
" file contents
|
||||
let in = ""
|
||||
let sep = go#util#LineEnding()
|
||||
let content = join(getline(1, '$'), sep)
|
||||
let in = fname . "\n" . strlen(content) . "\n" . content
|
||||
let command .= " -modified"
|
||||
let out = go#util#System(command, in)
|
||||
else
|
||||
let out = go#util#System(command)
|
||||
endif
|
||||
endif
|
||||
|
||||
let out = go#util#System(command)
|
||||
if go#util#ShellError() != 0
|
||||
call go#util#EchoError(out)
|
||||
return
|
||||
|
@ -115,7 +115,7 @@ function! go#fmt#Format(withGoimport)
|
||||
if !exists('b:goimports_vendor_compatible')
|
||||
let out = go#util#System(bin_path . " --help")
|
||||
if out !~ "-srcdir"
|
||||
call go#util#EchoWarning("vim-go: goimports does not support srcdir. update with: :GoUpdateBinaries")
|
||||
call go#util#EchoWarning(printf("vim-go: goimports (%s) does not support srcdir. Update with: :GoUpdateBinaries", bin_path))
|
||||
else
|
||||
let b:goimports_vendor_compatible = 1
|
||||
endif
|
||||
|
@ -151,7 +151,7 @@ function! go#path#CheckBinPath(binpath)
|
||||
|
||||
" if it's in PATH just return it
|
||||
if executable(binpath)
|
||||
if v:version == 704 && has('patch235')
|
||||
if exists('*exepath')
|
||||
let binpath = exepath(binpath)
|
||||
endif
|
||||
let $PATH = old_path
|
||||
|
Reference in New Issue
Block a user