" 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:], {"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(".") - 1 let cmdline = "gogetdoc -pos " . expand("%p") . ":#" . pos let b:gogetdoc_job = job_start(cmdline, { \"in_mode": "nl", \"err_io": "null", \"close_cb": "GoGetDocGot", \}) endfunction nmap :call GoGetDoc()