From f54d3255560975eb3b8dab0d014e29703abd4659 Mon Sep 17 00:00:00 2001 From: Billie Cleek Date: Thu, 22 Apr 2021 19:15:32 -0700 Subject: [PATCH 1/2] doc: edit :GoImports documentation --- doc/vim-go.txt | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/doc/vim-go.txt b/doc/vim-go.txt index c3aeb937ea..f98738da98 100644 --- a/doc/vim-go.txt +++ b/doc/vim-go.txt @@ -227,10 +227,9 @@ COMMANDS *go-commands* *:GoImports* :GoImports - Filter the current Go buffer through goimports (needs to be installed). - `goimports` automatically discards/add import path based on the code. Like - |:GoFmt|, It tries to preserve cursor position and avoids replacing the - buffer with stderr output. + Adjust imports using the setting of `g:go_imports_mode`. Like |:GoFmt|, It + tries to preserve cursor position and avoids replacing the buffer with + stderr output. *:GoPlay* :[range]GoPlay @@ -935,7 +934,7 @@ documentation in the |go-commands| section. Available keys are: *(go-run)* -Calls `go run` for the current main package +Calls `go run` for the current main package. *(go-run-tab)* @@ -954,23 +953,23 @@ This option is neovim only. *(go-build)* -Calls `go build` for the current package +Calls `go build` for the current package. *(go-generate)* -Calls `go generate` for the current package +Calls `go generate` for the current package. *(go-info)* -Shows type information for the word under the cursor +Shows type information for the word under the cursor. *(go-install)* -Calls `go install` for the current package +Calls `go install` for the current package. *(go-test)* -Calls `go test` for the current package +Calls `go test` for the current package. *(go-test-func)* @@ -978,7 +977,7 @@ Calls `go test -run '...'` for the test function immediate to cursor *(go-test-compile)* -Calls `go test -c` for the current package +Calls `go test -c` for the current package. *(go-coverage)* @@ -987,7 +986,7 @@ coverage annotation. *(go-coverage-clear)* -Clears the coverage annotation +Clears the coverage annotation. *(go-coverage-toggle)* @@ -997,25 +996,25 @@ annotation. *(go-imports)* -Calls `goimports` for the current package +Adjust imports for the current buffer. *(go-lint)* -Calls `golint` for the current package +Calls `golint` for the current package. *(go-vet)* -Calls `go vet` for the current package +Calls `go vet` for the current package. *(go-files)* -Show source files that depends for the current package +Show source files that depends for the current package. *(go-deps)* -Show dependencies for the current package +Show dependencies for the current package. *(go-doc)* From c7d94a6f6156fc5c365ce59603513ff143a4c99a Mon Sep 17 00:00:00 2001 From: Billie Cleek Date: Thu, 22 Apr 2021 19:17:45 -0700 Subject: [PATCH 2/2] mapping: add go-fmt --- doc/vim-go.txt | 3 +++ ftplugin/go/commands.vim | 2 +- ftplugin/go/mappings.vim | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/vim-go.txt b/doc/vim-go.txt index f98738da98..93e8c03ece 100644 --- a/doc/vim-go.txt +++ b/doc/vim-go.txt @@ -994,6 +994,9 @@ Calls `go test -coverprofile-temp.out` for the current package and shows the coverage annotation. If run again it acts as a toggle and clears the annotation. + *(go-fmt)* + +Format the current buffer. *(go-imports)* Adjust imports for the current buffer. diff --git a/ftplugin/go/commands.vim b/ftplugin/go/commands.vim index 8713f6a3e6..8b1ca98e9c 100644 --- a/ftplugin/go/commands.vim +++ b/ftplugin/go/commands.vim @@ -70,7 +70,7 @@ command! -nargs=* -range -complete=customlist,go#package#Complete GoDoc call go# command! -nargs=* -range -complete=customlist,go#package#Complete GoDocBrowser call go#doc#OpenBrowser() " -- fmt -command! -nargs=0 GoFmt call go#fmt#Format(-1) +command! -nargs=0 GoFmt call go#fmt#Format(0) command! -nargs=0 GoFmtAutoSaveToggle call go#fmt#ToggleFmtAutoSave() command! -nargs=0 GoImports call go#fmt#Format(1) diff --git a/ftplugin/go/mappings.vim b/ftplugin/go/mappings.vim index c7a0d5c22d..ea8fdf5aa6 100644 --- a/ftplugin/go/mappings.vim +++ b/ftplugin/go/mappings.vim @@ -34,6 +34,7 @@ nnoremap (go-deps) :call go#tool#Deps() nnoremap (go-info) :call go#tool#Info(1) nnoremap (go-import) :call go#import#SwitchImport(1, '', expand(''), '') nnoremap (go-imports) :call go#fmt#Format(1) +nnoremap (go-fmt) :call go#fmt#Format(0) nnoremap (go-implements) :call go#implements#Implements(-1) nnoremap (go-callees) :call go#guru#Callees(-1)