File opensuse-vim.patch of Package go.868
diff --git a/misc/vim/autoload/go/complete.vim b/misc/vim/autoload/go/complete.vim
index d4ae3b9..ae554bc 100644
--- a/misc/vim/autoload/go/complete.vim
+++ b/misc/vim/autoload/go/complete.vim
@@ -29,21 +29,35 @@ if len(s:goarch) == 0
endif
function! go#complete#Package(ArgLead, CmdLine, CursorPos)
+ let dirs = []
+
+ let workspaces = split( $GOPATH, ':' )
+ if workspaces != []
+ let dirs += workspaces
+ endif
+
let goroot = $GOROOT
- if len(goroot) == 0
- " should not occur.
- return []
+ if len(goroot) != 0
+ let dirs += [ goroot ]
endif
+
+ if len( dirs ) == 0
+ " should not happen
+ return []
+ endif
+
let ret = {}
- let root = expand(goroot.'/pkg/'.s:goos.'_'.s:goarch)
- for i in split(globpath(root, a:ArgLead.'*'), "\n")
- if isdirectory(i)
- let i .= '/'
- elseif i !~ '\.a$'
- continue
- endif
- let i = substitute(substitute(i[len(root)+1:], '[\\]', '/', 'g'), '\.a$', '', 'g')
- let ret[i] = i
+ for dir in dirs
+ let root = expand(dir.'/pkg/'.s:goos.'_'.s:goarch)
+ for i in split(globpath(root, a:ArgLead.'*'), "\n")
+ if isdirectory(i)
+ let i .= '/'
+ elseif i !~ '\.a$'
+ continue
+ endif
+ let i = substitute(substitute(i[len(root)+1:], '[\\]', '/', 'g'), '\.a$', '', 'g')
+ let ret[i] = i
+ endfor
endfor
return sort(keys(ret))
endfunction
diff --git a/misc/vim/plugin/godoc.vim b/misc/vim/plugin/godoc.vim
index fdb4966..a43d99d 100644
--- a/misc/vim/plugin/godoc.vim
+++ b/misc/vim/plugin/godoc.vim
@@ -72,7 +72,7 @@ function! s:Godoc(...)
if !len(word)
let word = expand('<cword>')
endif
- let word = substitute(word, '[^a-zA-Z0-9\/]', '', 'g')
+ let word = substitute(word, '[^a-zA-Z0-9\/.-]', '', 'g')
if !len(word)
return
endif