diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2013-09-12 17:22:37 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2013-09-12 17:22:37 +0200 |
commit | 4c2025af5cee3fcd08321c2f23c38e460d3991a9 (patch) | |
tree | 70e89149aa9778b5aa4950d456ea3b736e965625 /autoload/go | |
parent | 35433aa23c6f7753fe96c67ed2ffdbb5291085a0 (diff) | |
download | vim-polyglot-4c2025af5cee3fcd08321c2f23c38e460d3991a9.tar.gz vim-polyglot-4c2025af5cee3fcd08321c2f23c38e460d3991a9.zip |
vim-go -> vim-golang
Diffstat (limited to 'autoload/go')
-rw-r--r-- | autoload/go/complete.vim | 45 |
1 files changed, 19 insertions, 26 deletions
diff --git a/autoload/go/complete.vim b/autoload/go/complete.vim index 80fa4515..cc1013b7 100644 --- a/autoload/go/complete.vim +++ b/autoload/go/complete.vim @@ -32,46 +32,39 @@ function! go#complete#Package(ArgLead, CmdLine, CursorPos) let dirs = [] if executable('go') - let goroot = substitute(system('go env GOROOT'), '\n', '', 'g') - if v:shell_error - echomsg '\'go env GOROOT\' failed' - endif + let goroot = substitute(system('go env GOROOT'), '\n', '', 'g') + if v:shell_error + echo '\'go env GOROOT\' failed' + endif else - let goroot = $GOROOT + let goroot = $GOROOT endif if len(goroot) != 0 && isdirectory(goroot) - let dirs += [goroot] + let dirs += [ goroot ] endif - let pathsep = ':' - if s:goos == 'windows' - let pathsep = ';' - endif - let workspaces = split($GOPATH, pathsep) + let workspaces = split($GOPATH, ':') if workspaces != [] - let dirs += workspaces + let dirs += workspaces endif if len(dirs) == 0 - " should not happen - return [] + " should not happen + return [] endif let ret = {} for dir in dirs - " this may expand to multiple lines - let root = split(expand(dir . '/pkg/' . s:goos . '_' . s:goarch), "\n") - for r in root - for i in split(globpath(r, a:ArgLead.'*'), "\n") - if isdirectory(i) - let i .= '/' - elseif i !~ '\.a$' - continue - endif - let i = substitute(substitute(i[len(r)+1:], '[\\]', '/', 'g'), '\.a$', '', 'g') - let ret[i] = i - endfor + 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)) |