From efcc50dfdc94c82ee0292bf71992ecb7c0123061 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Tue, 14 May 2013 18:39:35 +0200 Subject: Imported Upstream version 1.1 --- misc/vim/plugin/godoc.vim | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'misc/vim/plugin/godoc.vim') 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('') + 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() -- cgit v1.2.3