mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated vim plugins
This commit is contained in:
@ -32,10 +32,17 @@ function! s:gocodeCommand(cmd, preargs, args)
|
||||
let old_gopath = $GOPATH
|
||||
let $GOPATH = go#path#Detect()
|
||||
|
||||
let result = go#util#System(printf('%s %s %s %s', go#util#Shellescape(bin_path), join(a:preargs), go#util#Shellescape(a:cmd), join(a:args)))
|
||||
let socket_type = get(g:, 'go_gocode_socket_type', 'unix')
|
||||
let cmd = printf('%s -sock %s %s %s %s',
|
||||
\ go#util#Shellescape(bin_path),
|
||||
\ socket_type,
|
||||
\ join(a:preargs),
|
||||
\ go#util#Shellescape(a:cmd),
|
||||
\ join(a:args)
|
||||
\ )
|
||||
|
||||
let result = go#util#System(cmd)
|
||||
let $GOPATH = old_gopath
|
||||
|
||||
if go#util#ShellError() != 0
|
||||
return "[\"0\", []]"
|
||||
else
|
||||
|
@ -1,6 +1,5 @@
|
||||
" guru.vim -- Vim integration for the Go guru.
|
||||
|
||||
|
||||
func! s:RunGuru(mode, format, selected, needs_scope) range abort
|
||||
"return with a warning if the binary doesn't exist
|
||||
let bin_path = go#path#CheckBinPath("guru")
|
||||
@ -364,6 +363,12 @@ function! go#guru#SameIds(selected)
|
||||
let pos = split(item, ':')
|
||||
call matchaddpos('goSameId', [[str2nr(pos[-2]), str2nr(pos[-1]), str2nr(poslen)]])
|
||||
endfor
|
||||
|
||||
if get(g:, "go_auto_sameids", 0)
|
||||
" re-apply SameIds at the current cursor position at the time the buffer
|
||||
" is redisplayed: e.g. :edit, :GoRename, etc.
|
||||
autocmd BufWinEnter <buffer> nested call go#guru#SameIds(-1)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! go#guru#ClearSameIds()
|
||||
@ -373,6 +378,11 @@ function! go#guru#ClearSameIds()
|
||||
call matchdelete(item['id'])
|
||||
endif
|
||||
endfor
|
||||
|
||||
" remove the autocmds we defined
|
||||
if exists("#BufWinEnter<buffer>")
|
||||
autocmd! BufWinEnter <buffer>
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! go#guru#ToggleSameIds(selected)
|
||||
|
@ -59,7 +59,7 @@ function! go#package#ImportPath(arg)
|
||||
let dirs = go#package#Paths()
|
||||
|
||||
for dir in dirs
|
||||
if len(dir) && match(path, dir) == 0
|
||||
if len(dir) && matchstr(escape(path, '\/'), escape(dir, '\/')) == 0
|
||||
let workspace = dir
|
||||
endif
|
||||
endfor
|
||||
@ -68,8 +68,13 @@ function! go#package#ImportPath(arg)
|
||||
return -1
|
||||
endif
|
||||
|
||||
let srcdir = substitute(workspace . '/src/', '//', '/', '')
|
||||
return substitute(path, srcdir, '', '')
|
||||
if go#util#IsWin()
|
||||
let srcdir = substitute(workspace . '\src\', '//', '/', '')
|
||||
return path[len(srcdir):]
|
||||
else
|
||||
let srcdir = substitute(workspace . '/src/', '//', '/', '')
|
||||
return substitute(path, srcdir, '', '')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! go#package#FromPath(arg)
|
||||
|
Reference in New Issue
Block a user