X-Git-Url: http://www.git.stargrave.org/?p=dotfiles.git;a=blobdiff_plain;f=vim%2F.vim%2Fftplugin%2Fgo%2Fgogetdoc.vim;h=82496e5964163605905b61ee25090649cce3c090;hp=9105258bc3288fad8369abe68cc2007f1e7c8248;hb=1280549be01e3ce72d9e0aeef6254a1ff14a25a3;hpb=86cacc081de452eb66d50f13261310b07f8ca2d4 diff --git a/vim/.vim/ftplugin/go/gogetdoc.vim b/vim/.vim/ftplugin/go/gogetdoc.vim index 9105258..82496e5 100644 --- a/vim/.vim/ftplugin/go/gogetdoc.vim +++ b/vim/.vim/ftplugin/go/gogetdoc.vim @@ -1,35 +1,3 @@ -" Popup documentation of specified object under the cursor -" Requires github.com/zmb3/gogetdoc in the $PATH - -function! LintStatus() - if exists("b:gogetdoc_job") && job_status(b:gogetdoc_job) == "run" | return "GD" | endif - return "" -endfunction - -function! GoGetDocGot(ch) - let msgs = [] - while ch_status(a:ch) == "buffered" - let msgs = add(msgs, ch_read(a:ch)) - endwhile - if exists("b:godocid") | call popup_close(b:godocid) | endif - if len(msgs) == 0 - echohl WarningMsg | echomsg "No go doc" | echohl None - return - endif - let msgs = msgs[2:] - let b:godocid = popup_atcursor(msgs[2:-2], {"wrap": 0, "title": msgs[0], "move": "word"}) -endfunction - -function! s:GoGetDoc() - if exists("b:gogetdoc_job") && job_status(b:gogetdoc_job) == "run" | return | endif - let pos = line2byte(line(".")) + col(".") - 2 - let cmdline = "gogetdoc -pos " . expand("%p") . ":#" . pos - echomsg cmdline - let b:gogetdoc_job = job_start(cmdline, { - \"in_mode": "nl", - \"err_io": "null", - \"close_cb": "GoGetDocGot", - \}) -endfunction - -nmap :call GoGetDoc() +if exists("*go#getdoc#do") | finish | endif +let b:lint_status_func=function("go#getdoc#status") +nmap :call go#getdoc#do()