Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of g:go_doc_command and g:go_doc_options parameters #1420

Merged
merged 6 commits into from
Sep 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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