Skip to content

Commit

Permalink
Add support of g:go_doc_command option (#1420)
Browse files Browse the repository at this point in the history
Add support for the g:go_doc_command option. This was documented, but not implemented.
  • Loading branch information
nk2ge5k authored and arp242 committed Sep 7, 2017
1 parent 67a3e97 commit 506ddaf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ type foo struct{
* `:GoImpl` output would include extra newline, and error would include
trailing newline from shell command: `vim-go: invalid receiver: "} *}"<00>`.
Fixed with [gh-1386]

* Run `:GoMetaLinter` against the package of the open file [gh-1414].
* The `g:go_doc_command` and `g:go_doc_options` to configure the command for
`:GoDoc` were documented but never referenced [gh-1420].

BACKWARDS INCOMPATIBILITIES:

Expand Down
11 changes: 3 additions & 8 deletions autoload/go/doc.vim
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
let s:buf_nr = -1

if !exists("g:go_doc_command")
let g:go_doc_command = "godoc"
endif

if !exists("g:go_doc_options")
let g:go_doc_options = ""
let g:go_doc_command = ["godoc"]
endif

function! go#doc#OpenBrowser(...) abort
Expand Down Expand Up @@ -60,12 +56,11 @@ endfunction
function! go#doc#Open(newmode, mode, ...) abort
" With argument: run "godoc [arg]".
if len(a:000)
let bin_path = go#path#CheckBinPath('godoc')
if empty(bin_path)
if empty(go#path#CheckBinPath(g:go_doc_command[0]))
return
endif

let command = printf("%s %s", go#util#Shellescape(bin_path), join(a:000, ' '))
let command = printf("%s %s", go#util#Shelljoin(g:go_doc_command), join(a:000, ' '))
let out = go#util#System(command)
" Without argument: run gogetdoc on cursor position.
else
Expand Down
14 changes: 4 additions & 10 deletions doc/vim-go.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1190,17 +1190,11 @@ mappings of |:GoDef|. By default it's disabled. >
<
*'g:go_doc_command'*

Use this option to define which tool is used to godoc. By default `godoc` is
used >
let g:go_doc_command = "godoc"
<
*'g:go_doc_options'*

Use this option to add additional options to the |'g:go_doc_command'|. Default
is empty. >
Command to use for |:GoDoc|; only used when invoked with a package name. The
`gogetdoc` command is always used when |:GoDoc| is used on the identifier
under the cursor (i.e. without argument or from |K|). >
let g:go_doc_options = ''
let g:go_doc_command = ["godoc"]
< *'g:go_bin_path'*

Expand Down

0 comments on commit 506ddaf

Please sign in to comment.