summaryrefslogtreecommitdiff
path: root/misc/vim/plugin/godoc.vim
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@debian.org>2013-05-14 18:39:35 +0200
committerMichael Stapelberg <michael@stapelberg.de>2013-05-14 18:39:35 +0200
commitefcc50dfdc94c82ee0292bf71992ecb7c0123061 (patch)
tree17dca99d1dc7fc4e9fe49c2cf6a99d337d4c039f /misc/vim/plugin/godoc.vim
parent04b08da9af0c450d645ab7389d1467308cfc2db8 (diff)
downloadgolang-efcc50dfdc94c82ee0292bf71992ecb7c0123061.tar.gz
Imported Upstream version 1.1upstream/1.1
Diffstat (limited to 'misc/vim/plugin/godoc.vim')
-rw-r--r--misc/vim/plugin/godoc.vim17
1 files changed, 15 insertions, 2 deletions
diff --git a/misc/vim/plugin/godoc.vim b/misc/vim/plugin/godoc.vim
index a9abb7ae6..a7b84de74 100644
--- a/misc/vim/plugin/godoc.vim
+++ b/misc/vim/plugin/godoc.vim
@@ -70,13 +70,26 @@ endfunction
function! s:Godoc(...)
let word = join(a:000, ' ')
if !len(word)
+ let oldiskeyword = &iskeyword
+ setlocal iskeyword+=.
let word = expand('<cword>')
+ let &iskeyword = oldiskeyword
endif
let word = substitute(word, '[^a-zA-Z0-9\\/._~-]', '', 'g')
- if !len(word)
+ let words = split(word, '\.')
+ if !len(words)
return
endif
- call s:GodocWord(word)
+ call s:GodocWord(words[0])
+ if len(words) > 1
+ if search('^\%(const\|var\|type\|\s\+\) ' . words[1] . '\s\+=\s')
+ return
+ endif
+ if search('^func ' . words[1] . '(')
+ return
+ endif
+ echo 'No documentation found for "' . word . '".'
+ endif
endfunction
command! -nargs=* -range -complete=customlist,go#complete#Package Godoc :call s:Godoc(<q-args>)