mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -33,29 +33,38 @@ support, improved syntax highlighting, go toolchain commands, etc... It's
|
||||
highly customizable and each individual feature can be disabled/enabled
|
||||
easily.
|
||||
|
||||
* Improved Syntax highlighting, such as Functions, Operators, Methods..
|
||||
* Improved Syntax highlighting with items such as Functions, Operators, Methods.
|
||||
* Auto completion support via `gocode`
|
||||
* Better `gofmt` on save, keeps cursor position and doesn't break your undo
|
||||
* Better `gofmt` on save, which keeps cursor position and doesn't break your undo
|
||||
history
|
||||
* Go to symbol/declaration with `godef`
|
||||
* Look up documentation with `godoc` inside Vim or open it in browser.
|
||||
* Automatically import packages via `goimports`
|
||||
* Compile and `go build` your package, install it with `go install`
|
||||
* `go run` quickly your current file/files
|
||||
* Run `go test` and see any errors in quickfix window
|
||||
* Create a coverage profile and display annotated source code in browser to
|
||||
see which functions are covered.
|
||||
* Lint your code with `golint`
|
||||
* Run your code trough `go vet` to catch static errors.
|
||||
* Advanced source analysis tool with `oracle`
|
||||
* Precise type-safe renaming of identifiers with `gorename`
|
||||
* Go to symbol/declaration with `:GoDef`
|
||||
* Look up documentation with `:GoDoc` inside Vim or open it in browser
|
||||
* Automatically import packages via `:GoImport` or plug it into autosave
|
||||
* Compile your package with `:GoBuild`, install it with `:GoInstall` or test
|
||||
them with `:GoTest` (also supports running single tests via `:GoTestFunc`)
|
||||
* Quickly execute your current file/files with `:GoRun`
|
||||
* Automatic `GOPATH` detection based on the directory structure (i.e. `gb`
|
||||
projects, `godep` vendored projects)
|
||||
* Change or display `GOPATH` with `:GoPath`
|
||||
* Create a coverage profile and display annotated source code in browser to see
|
||||
which functions are covered with `:GoCoverage`
|
||||
* Call `gometalinter` with `:GoMetaLinter`, which invokes all possible linters
|
||||
(golint, vet, errcheck, deadcode, etc..) and shows the warnings/errors
|
||||
* Lint your code with `:GoLint`
|
||||
* Run your code through `:GoVet` to catch static errors
|
||||
* Advanced source analysis tools utilizing oracle, such as `:GoImplements`,
|
||||
`:GoCallees`, and `:GoReferrers`
|
||||
* Precise type-safe renaming of identifiers with `:GoRename`
|
||||
* List all source files and dependencies
|
||||
* Checking with `errcheck` for unchecked errors.
|
||||
* Integrated and improved snippets. Supports `ultisnips` or `neosnippet`
|
||||
* Share your current code to play.golang.org
|
||||
* On-the-fly type information about the word under the cursor
|
||||
* Unchecked error checking with `:GoErrCheck`
|
||||
* Integrated and improved snippets, supporting `ultisnips` or `neosnippet`
|
||||
* Share your current code to [play.golang.org](http://play.golang.org) with `:GoPlay`
|
||||
* On-the-fly type information about the word under the cursor. Plug it into
|
||||
your custom vim function.
|
||||
* Tagbar support to show tags of the source code in a sidebar with `gotags`
|
||||
* Custom vim text objects, such a `a function` or `inner function`
|
||||
* Custom vim text objects such as `a function` or `inner function`
|
||||
* All commands support collecting and displaying errors in Vim's location
|
||||
list.
|
||||
|
||||
===============================================================================
|
||||
INSTALL *go-install*
|
||||
@ -113,18 +122,20 @@ COMMANDS *go-commands*
|
||||
*:GoPath*
|
||||
:GoPath [path]
|
||||
|
||||
GoPath sets and ovverides GOPATH with the given {path}. If no {path} is
|
||||
GoPath sets and overrides GOPATH with the given {path}. If no {path} is
|
||||
given it shows the current GOPATH. If `""` is given as path, it clears
|
||||
current `GOPATH` which was set with |GoPath| and restores `GOPATH` back to
|
||||
the inital value which was sourced when Vim was started.
|
||||
the initial value which was sourced when Vim was started.
|
||||
|
||||
*:GoImport*
|
||||
:GoImport [path]
|
||||
:GoImport[!] [path]
|
||||
|
||||
Import ensures that the provided package {path} is imported in the current
|
||||
Go buffer, using proper style and ordering. If {path} is already being
|
||||
Go buffer, using proper style and ordering. If {path} is already being
|
||||
imported, an error will be displayed and the buffer will be untouched.
|
||||
|
||||
If [!] is given it will download the package with `go get`
|
||||
|
||||
*:GoImportAs*
|
||||
:GoImportAs [localname] [path]
|
||||
|
||||
@ -138,9 +149,9 @@ COMMANDS *go-commands*
|
||||
displayed and the buffer will be untouched.
|
||||
|
||||
*:GoLint*
|
||||
:GoLint
|
||||
:GoLint [packages]
|
||||
|
||||
Run golint for the current Go file.
|
||||
Run golint for the current Go file, or for given packages.
|
||||
|
||||
*:GoDoc*
|
||||
:GoDoc [word]
|
||||
@ -177,7 +188,7 @@ COMMANDS *go-commands*
|
||||
'xterm-clipboard' otherwise it's get yanked into the `""` register.
|
||||
|
||||
*:GoVet*
|
||||
:GoVet[!]
|
||||
:GoVet[!] [options]
|
||||
|
||||
Run `go vet` for the directory under your current file. Vet examines Go
|
||||
source code and reports suspicious constructs, such as Printf calls whose
|
||||
@ -185,6 +196,10 @@ COMMANDS *go-commands*
|
||||
guarantee all reports are genuine problems, but it can find errors not caught
|
||||
by the compilers.
|
||||
|
||||
You may optionally pass any valid go tool vet flags/options. In this case,
|
||||
`go tool vet` is run in place of `go vet`. For a full list please see
|
||||
`go tool vet -h`.
|
||||
|
||||
If [!] is not given the first error is jumped to.
|
||||
|
||||
*:GoDef*
|
||||
@ -202,42 +217,48 @@ COMMANDS *go-commands*
|
||||
current file is used. If an argument is passed, 'expand' is used as file
|
||||
selector. For example use `:GoRun %` to select the current file only.
|
||||
|
||||
You may optionally pass any valid go run flags/options. For a full list
|
||||
please see `go help run`.
|
||||
|
||||
If [!] is not given the first error is jumped to.
|
||||
|
||||
*:GoBuild*
|
||||
:GoBuild[!] [options]
|
||||
:GoBuild[!] [expand]
|
||||
|
||||
Build your package with `go build`. It automatically builds only the files
|
||||
that depends on the current file. GoBuild doesn't produce a result file.
|
||||
Use 'make' to create a result file.
|
||||
|
||||
You may optionally pass any valid go build flags/options. For a full list
|
||||
please see `go help build`.
|
||||
please see `go help build`. Options are expanded with 'expand'.
|
||||
|
||||
If [!] is not given the first error is jumped to.
|
||||
|
||||
*:GoGenerate*
|
||||
:GoGenerate[!] [options]
|
||||
:GoGenerate[!] [expand]
|
||||
|
||||
Creates or updates your auto-generated source files by running `go
|
||||
generate`.
|
||||
|
||||
You may optionally pass any valid go generate flags/options. For a full list
|
||||
please see `go help generate`.
|
||||
please see `go help generate`. Options are expanded with 'expand'.
|
||||
|
||||
If [!] is not given the first error is jumped to.
|
||||
|
||||
*:GoInfo*
|
||||
:GoInfo
|
||||
Show type information about the identifer under the cursor. For example
|
||||
Show type information about the identifier under the cursor. For example
|
||||
putting it above a function call is going to show the full function
|
||||
signature. It uses gocode to get the type informations.
|
||||
|
||||
|
||||
*:GoInstall*
|
||||
:GoInstall[!]
|
||||
:GoInstall[!] [options]
|
||||
|
||||
Install your package with `go install`.
|
||||
Install your package with `go install`.
|
||||
|
||||
You may optionally pass any valid go install flags/options. For a full list
|
||||
please see `go help install`.
|
||||
|
||||
If [!] is not given the first error is jumped to.
|
||||
|
||||
@ -245,9 +266,16 @@ COMMANDS *go-commands*
|
||||
:GoTest[!] [expand]
|
||||
|
||||
Run the tests on your _test.go files via in your current directory. Errors
|
||||
are populated in quickfix window. If an argument is passed, 'expand' is
|
||||
are populated in location list. If an argument is passed, 'expand' is
|
||||
used as file selector (useful for cases like `:GoTest ./...`).
|
||||
|
||||
You may optionally pass any valid go test flags/options. For a full list
|
||||
please see `go help test`.
|
||||
|
||||
GoTest timesout automatically after 10 seconds. To customize the timeout
|
||||
use |g:go_test_timeout|. This feature is disabled if any arguments are
|
||||
passed to the `:GoTest` command.
|
||||
|
||||
If [!] is not given the first error is jumped to.
|
||||
|
||||
*:GoTestFunc*
|
||||
@ -266,7 +294,7 @@ COMMANDS *go-commands*
|
||||
:GoTestCompile[!] [expand]
|
||||
|
||||
Compile your _test.go files via in your current directory. Errors are
|
||||
populated in quickfix window. If an argument is passed, 'expand' is used
|
||||
populated in location list. If an argument is passed, 'expand' is used
|
||||
as file selector (useful for cases like `:GoTest ./...`). Useful to not
|
||||
run the tests and capture/fix errors before running the tests or to
|
||||
create test binary.
|
||||
@ -274,18 +302,24 @@ COMMANDS *go-commands*
|
||||
If [!] is not given the first error is jumped to.
|
||||
|
||||
*:GoCoverage*
|
||||
:GoCoverage[!]
|
||||
:GoCoverage[!] [options]
|
||||
|
||||
Create a coverage profile and open a browser to display the annotated
|
||||
source code of the current package.
|
||||
|
||||
You may optionally pass any valid go test flags/options, such as
|
||||
`-covermode set,count,atomic`. For a full list please see `go help test`.
|
||||
|
||||
If [!] is not given the first error is jumped to.
|
||||
|
||||
*:GoErrCheck*
|
||||
:GoErrCheck
|
||||
:GoErrCheck [options]
|
||||
|
||||
Check for unchecked errors in you current package. Errors are populated in
|
||||
quickfix window.
|
||||
location list.
|
||||
|
||||
You may optionally pass any valid errcheck flags/options. For a full list
|
||||
please see `errcheck -h`.
|
||||
|
||||
*:GoFiles*
|
||||
:GoFiles
|
||||
@ -315,13 +349,15 @@ COMMANDS *go-commands*
|
||||
|
||||
Show 'implements' relation for a selected package. A list of interfaces
|
||||
for the type that implements an interface under the cursor (or selected
|
||||
package) is shown quickfix list.
|
||||
package) is shown location list.
|
||||
*:GoRename*
|
||||
:GoRename [to]
|
||||
:GoRename[!] [to]
|
||||
|
||||
Rename the identifier under the cursor to the desired new name. If no
|
||||
argument is given a prompt will ask for the desired identifier.
|
||||
|
||||
If [!] is not given the first error is jumped to.
|
||||
|
||||
|
||||
*:GoOracleScope*
|
||||
:GoOracleScope [path1] [path2] ...
|
||||
@ -336,13 +372,13 @@ COMMANDS *go-commands*
|
||||
|
||||
Show 'callees' relation for a selected package. A list of possible call
|
||||
targets for the type under the cursor (or selected package) is shown in a
|
||||
quickfix list.
|
||||
location list.
|
||||
|
||||
*:GoCallers*
|
||||
:GoCallers
|
||||
|
||||
Show 'callers' relation for a selected function. A list of possible
|
||||
callers for the selected function under the cursor is shown in a quickfix
|
||||
callers for the selected function under the cursor is shown in a location
|
||||
list.
|
||||
|
||||
*:GoDescribe*
|
||||
@ -359,7 +395,7 @@ COMMANDS *go-commands*
|
||||
|
||||
Shows 'callstack' relation for the selected function. An arbitrary path
|
||||
from the root of the callgraph to the selected function is showed in a
|
||||
quickfix list. This may be useful to understand how the function is
|
||||
location list. This may be useful to understand how the function is
|
||||
reached in a given program.
|
||||
|
||||
*:GoFreevars*
|
||||
@ -395,6 +431,26 @@ COMMANDS *go-commands*
|
||||
object as does the selected identifier, within any package in the analysis
|
||||
scope.
|
||||
|
||||
*:GoMetaLinter*
|
||||
:GoMetaLinter [path]
|
||||
|
||||
Calls the underlying `gometalinter` tool and displays all warnings and
|
||||
errors in a location list. By default the following linters are enabled:
|
||||
"'vet', 'golint', 'errcheck'". This can be changed with the
|
||||
|g:go_metalinter_enabled| variable. To override the command completely use
|
||||
the variable |g:go_metalinter_command|. To override the maximum linters
|
||||
execution time use |g:go_metalinter_deadline| variable.
|
||||
|
||||
*:GoOracleTags*
|
||||
:GoOracleTags [tags]
|
||||
|
||||
Changes the custom |g:go_oracle_tags| setting and overrides it with the
|
||||
given build tags. This command cooperate with GoReferrers command when
|
||||
there exist mulitiple build tags in your project,then you can set one
|
||||
of the build tags for GoReferrers to find more accurate.
|
||||
The custom build tags is cleared (unset) if `""` is given. If no arguments
|
||||
is given it prints the current custom build tags.
|
||||
|
||||
|
||||
===============================================================================
|
||||
MAPPINGS *go-mappings*
|
||||
@ -544,6 +600,9 @@ Show send/receive corresponding to selected channel op
|
||||
|
||||
Show all refs to entity denoted by selected identifier
|
||||
|
||||
*(go-metalinter)*
|
||||
|
||||
Calls `go-metalinter` for the current directory
|
||||
|
||||
===============================================================================
|
||||
TEXT OBJECTS *go-text-objects*
|
||||
@ -564,6 +623,14 @@ if "inside a function", select contents of a function,
|
||||
===============================================================================
|
||||
SETTINGS *go-settings*
|
||||
|
||||
*'g:go_test_timeout'*
|
||||
|
||||
Use this option to change the test timeout of |:GoTest|. By default it is
|
||||
set to 10 seconds . >
|
||||
|
||||
let g:go_test_timeout= '10s'
|
||||
<
|
||||
|
||||
*'g:go_play_browser_command'*
|
||||
|
||||
Use this option to change the browser that is used to open the snippet url
|
||||
@ -571,7 +638,7 @@ posted to play.golang.org with |:GoPlay| or for the relevant documentation
|
||||
used with |:GoDocBrowser|. By default it tries to find it automatically for
|
||||
the current OS. >
|
||||
|
||||
let g:play_browser_command = ''
|
||||
let g:go_play_browser_command = ''
|
||||
<
|
||||
*'g:go_play_open_browser'*
|
||||
|
||||
@ -623,7 +690,7 @@ is empty. >
|
||||
|
||||
*'g:go_fmt_fail_silently'*
|
||||
|
||||
Use this option to disable showing a quickfix window when |g:go_fmt_command|
|
||||
Use this option to disable showing a location list when |g:go_fmt_command|
|
||||
fails. By default it's disabled. >
|
||||
|
||||
let g:go_fmt_fail_silently = 0
|
||||
@ -772,6 +839,13 @@ Highlights build constraints. By default it's disabled. >
|
||||
|
||||
let g:go_highlight_build_constraints = 0
|
||||
<
|
||||
*'g:go_highlight_string_spellcheck*
|
||||
|
||||
Specifies spell checking enabled for strings. Spelling errors are highlighted
|
||||
if |spell| is enabled. By default it's enabled. >
|
||||
|
||||
let g:go_highlight_string_spellcheck = 1
|
||||
<
|
||||
|
||||
*'g:go_autodetect_gopath'*
|
||||
|
||||
@ -779,7 +853,7 @@ Automatically modifies GOPATH for certain directory structures, such as for
|
||||
the tool godep which has his own dependencies via the `Godeps` folder. What
|
||||
this means is that all tools are now working with the newly modified GOPATH.
|
||||
So |GoDef| for example jumps to the source inside the `Godeps` (vendored)
|
||||
source. Currently only `godep` is supported, in the near future more tool
|
||||
source. Currently `godep` and `gb` is supported, in the near future more tool
|
||||
supports will be added. By default it's enabled. >
|
||||
|
||||
let g:go_autodetect_gopath = 1
|
||||
@ -789,12 +863,56 @@ supports will be added. By default it's enabled. >
|
||||
Adds custom text objects. By default it's enabled. >
|
||||
|
||||
let g:go_textobj_enabled = 1
|
||||
<
|
||||
*'g:go_metalinter_autosave'*
|
||||
|
||||
Use this option to auto |:GoMetaLinter| on save. Only linter messages for
|
||||
the active buffer will be shown. By default it's disabled >
|
||||
|
||||
let g:go_metalinter_autosave = 0
|
||||
<
|
||||
*'g:go_metalinter_autosave_enabled'*
|
||||
|
||||
Specifies the enabled linters for auto |GoMetaLinter| on save. By
|
||||
default it's using `vet` and `golint`
|
||||
>
|
||||
let g:go_metalinter_autosave_enabled = ['vet', 'golint']
|
||||
<
|
||||
*'g:go_metalinter_enabled'*
|
||||
|
||||
Specifies the currently enabled linters for the |GoMetaLinter| command. By
|
||||
default it's using `vet`, `golint` and `errcheck`
|
||||
>
|
||||
let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck']
|
||||
<
|
||||
*'g:go_metalinter_command'*
|
||||
|
||||
Overrides the command to be executed when |GoMetaLinter| is called. This is
|
||||
an advanced settings and is for users who want to have a complete control
|
||||
over of how `gometalinter` should be executed. By default it's empty.
|
||||
>
|
||||
let g:go_metalinter_command = ""
|
||||
<
|
||||
*'g:go_metalinter_deadline'*
|
||||
|
||||
Overrides the maximum time the linters have to complete. By default it's 5
|
||||
seconds.
|
||||
>
|
||||
let g:go_metalinter_deadline = "5s"
|
||||
<
|
||||
*'g:go_loclist_height'*
|
||||
|
||||
Specifies the current location list height for all location lists. The default
|
||||
value (empty) sets automatically the height to the number of errors (maximum
|
||||
up to 10 errors to prevent large heights). Setting the value explicitly
|
||||
overrides this behavior. To get default Vim behavior set it to 10.
|
||||
>
|
||||
let g:go_loclist_height = 0
|
||||
|
||||
===============================================================================
|
||||
TROUBLESHOOTING *go-troubleshooting*
|
||||
|
||||
I'm using Fish shell but have some problems using Vim-go~
|
||||
I'm using Fish shell but have some problems using vim-go~
|
||||
|
||||
First environment variables in Fish are applied differently, it should be like:
|
||||
>
|
||||
@ -802,7 +920,7 @@ First environment variables in Fish are applied differently, it should be like:
|
||||
<
|
||||
Second, Vim needs a POSIX compatible shell (more info here:
|
||||
https://github.com/dag/vim-fish#teach-a-vim-to-fish). If you use Fish to open
|
||||
vim, it will make certainx shell based commands fail (means vim-go will fail
|
||||
Vim, it will make certain shell based commands fail (means vim-go will fail
|
||||
too). To overcome this problem change the default shell by adding the
|
||||
following into your .vimrc (on the top of the file):
|
||||
>
|
||||
@ -815,7 +933,7 @@ or
|
||||
set shell='/bin/sh'
|
||||
>
|
||||
|
||||
I'm seeing weirds errors during installation of binaries with
|
||||
I'm seeing weird errors during installation of binaries with
|
||||
GoInstallBinaries:
|
||||
|
||||
If you see errors like this:
|
||||
@ -835,7 +953,7 @@ You'll see a more detailed error. If this works, vim-go will work too.
|
||||
===============================================================================
|
||||
CREDITS *go-credits*
|
||||
|
||||
* Go Authors for offical vim plugins
|
||||
* Go Authors for official vim plugins
|
||||
* Gocode, Godef, Golint, Oracle, Goimports, Errcheck projects and authors of
|
||||
those projects.
|
||||
* Other vim-plugins, thanks for inspiration (vim-golang, go.vim, vim-gocode,
|
||||
|
Reference in New Issue
Block a user