mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated vimrc
This commit is contained in:
@ -71,12 +71,12 @@ add the appropriate lines and execute the plugin's install command.
|
||||
<
|
||||
|
||||
* https://github.com/junegunn/vim-plug >
|
||||
|
||||
|
||||
Plug 'fatih/vim-go'
|
||||
|
||||
<
|
||||
* https://github.com/Shougo/neobundle.vim >
|
||||
|
||||
|
||||
NeoBundle 'fatih/vim-go'
|
||||
<
|
||||
|
||||
@ -86,7 +86,7 @@ add the appropriate lines and execute the plugin's install command.
|
||||
|
||||
<
|
||||
* Manual >
|
||||
|
||||
|
||||
Copy all of the files into your `~/.vim` directory
|
||||
<
|
||||
|
||||
@ -110,6 +110,14 @@ https://github.com/Shougo/neosnippet.vim.
|
||||
===============================================================================
|
||||
COMMANDS *go-commands*
|
||||
|
||||
*:GoPath*
|
||||
:GoPath [path]
|
||||
|
||||
GoPath sets and ovverides 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.
|
||||
|
||||
*:GoImport*
|
||||
:GoImport [path]
|
||||
|
||||
@ -169,7 +177,7 @@ COMMANDS *go-commands*
|
||||
'xterm-clipboard' otherwise it's get yanked into the `""` register.
|
||||
|
||||
*:GoVet*
|
||||
:GoVet
|
||||
:GoVet[!]
|
||||
|
||||
Run `go vet` for the directory under your current file. Vet examines Go
|
||||
source code and reports suspicious constructs, such as Printf calls whose
|
||||
@ -177,6 +185,8 @@ COMMANDS *go-commands*
|
||||
guarantee all reports are genuine problems, but it can find errors not caught
|
||||
by the compilers.
|
||||
|
||||
If [!] is not given the first error is jumped to.
|
||||
|
||||
*:GoDef*
|
||||
:GoDef [identifier]
|
||||
|
||||
@ -204,6 +214,17 @@ COMMANDS *go-commands*
|
||||
You may optionally pass any valid go build flags/options. For a full list
|
||||
please see `go help build`.
|
||||
|
||||
If [!] is not given the first error is jumped to.
|
||||
|
||||
*:GoGenerate*
|
||||
:GoGenerate[!] [options]
|
||||
|
||||
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`.
|
||||
|
||||
If [!] is not given the first error is jumped to.
|
||||
|
||||
*:GoInfo*
|
||||
@ -214,19 +235,35 @@ COMMANDS *go-commands*
|
||||
|
||||
|
||||
*:GoInstall*
|
||||
:GoInstall
|
||||
:GoInstall[!]
|
||||
|
||||
Install your package with `go install`.
|
||||
|
||||
If [!] is not given the first error is jumped to.
|
||||
|
||||
*:GoTest*
|
||||
:GoTest [expand]
|
||||
: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
|
||||
used as file selector (useful for cases like `:GoTest ./...`).
|
||||
|
||||
If [!] is not given the first error is jumped to.
|
||||
|
||||
*:GoTestFunc*
|
||||
:GoTestFunc[!] [expand]
|
||||
|
||||
Runs :GoTest, but only on the single test function immediate to your
|
||||
cursor using 'go test's '-run' flag.
|
||||
|
||||
Lookup is done starting at the cursor (including that line) moving up till
|
||||
a matching `func Test` pattern is found or top of file is reached. Search
|
||||
will not wrap around when at the top of the file.
|
||||
|
||||
If [!] is not given the first error is jumped to.
|
||||
|
||||
*:GoTestCompile*
|
||||
:GoTestCompile [expand]
|
||||
: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
|
||||
@ -234,12 +271,16 @@ COMMANDS *go-commands*
|
||||
run the tests and capture/fix errors before running the tests or to
|
||||
create test binary.
|
||||
|
||||
If [!] is not given the first error is jumped to.
|
||||
|
||||
*:GoCoverage*
|
||||
:GoCoverage
|
||||
:GoCoverage[!]
|
||||
|
||||
Create a coverage profile and open a browser to display the annotated
|
||||
source code of the current package.
|
||||
|
||||
If [!] is not given the first error is jumped to.
|
||||
|
||||
*:GoErrCheck*
|
||||
:GoErrCheck
|
||||
|
||||
@ -274,13 +315,22 @@ 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 quickfix list.
|
||||
*:GoRename*
|
||||
: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.
|
||||
|
||||
|
||||
*:GoOracleScope*
|
||||
:GoOracleScope [path1] [path2] ...
|
||||
|
||||
Changes the custom |g:go_oracle_scope| setting and overrides it with the
|
||||
given import paths. The custom scope is cleared (unset) if `""` is given
|
||||
as the only path. If no arguments is given it prints the current custom
|
||||
scope.
|
||||
|
||||
*:GoCallees*
|
||||
:GoCallees
|
||||
|
||||
@ -304,27 +354,20 @@ COMMANDS *go-commands*
|
||||
identifier), etc. Almost any piece of syntax may be described, and the
|
||||
oracle will try to print all the useful information it can.
|
||||
|
||||
*:GoCallgraph*
|
||||
:GoCallgraph
|
||||
|
||||
Shows the 'callgraph' for the entire program. For more info about the
|
||||
indentation checkout the Oracle User Manual:
|
||||
golang.org/s/oracle-user-manual
|
||||
|
||||
*:GoCallstack*
|
||||
:GoCallstack
|
||||
|
||||
Shows 'callstack' relation for the selected function. An arbitrary path
|
||||
from the root of the callgrap to the selected function is showed in a
|
||||
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
|
||||
reached in a given program.
|
||||
reached in a given program.
|
||||
|
||||
*:GoFreevars*
|
||||
:GoFreevars
|
||||
|
||||
Enumerates the free variables of the selection. “Free variables” is a
|
||||
technical term meaning the set of variables that are referenced but not
|
||||
defined within the selection, or loosely speaking, its inputs.
|
||||
defined within the selection, or loosely speaking, its inputs.
|
||||
|
||||
This information is useful if you’re considering whether to refactor the
|
||||
selection into a function of its own, as the free variables would be the
|
||||
@ -336,11 +379,11 @@ COMMANDS *go-commands*
|
||||
:GoChannelPeers
|
||||
|
||||
Shows the set of possible sends/receives on the channel operand of the
|
||||
selected send or receive operation; the selection must be a <- token.
|
||||
selected send or receive operation; the selection must be a <- token.
|
||||
|
||||
For example, visually select a channel operand in the form of:
|
||||
For example, visually select a channel operand in the form of:
|
||||
|
||||
"done <- true"
|
||||
"done <- true"
|
||||
|
||||
and call |GoChannelPeers| on it. It will show where it was allocated, and
|
||||
the sending and receiving endings.
|
||||
@ -375,6 +418,10 @@ Calls `go run` for the current file
|
||||
|
||||
Calls `go build` for the current package
|
||||
|
||||
*(go-generate)*
|
||||
|
||||
Calls `go generate` for the current package
|
||||
|
||||
|
||||
*(go-info)*
|
||||
|
||||
@ -390,6 +437,10 @@ Calls `go install` for the current package
|
||||
|
||||
Calls `go test` for the current package
|
||||
|
||||
*(go-test-func)*
|
||||
|
||||
Calls `go test -run '...'` for the test function immediate to cursor
|
||||
|
||||
*(go-test-compile)*
|
||||
|
||||
Calls `go test -c` for the current package
|
||||
@ -477,10 +528,6 @@ Show possible callers of selected function
|
||||
Describe selected syntax: definition, methods, etc
|
||||
|
||||
|
||||
*(go-callgraph)*
|
||||
|
||||
Show the callgraph of the current program.
|
||||
|
||||
*(go-callstack)*
|
||||
|
||||
Show path from callgraph root to selected function
|
||||
@ -541,6 +588,18 @@ By default it's disabled >
|
||||
|
||||
let g:go_auto_type_info = 0
|
||||
<
|
||||
|
||||
*'g:go_jump_to_error'*
|
||||
|
||||
Use this option to enable/disable passing the bang attribute to the mappings
|
||||
|(go-build)|, |(go-run)|, etc.. When enabled it will jump to the first error
|
||||
automatically (means it will NOT pass the bang attribute to the appropriate
|
||||
command, i.e: (go-run) -> :GoRun ). Note, that calling this doesn't have any
|
||||
affect on calling the commands manually. This setting is only useful for
|
||||
changing the behaviour of our custom static mappings. By default it's enabled.
|
||||
>
|
||||
let g:go_jump_to_error = 1
|
||||
<
|
||||
*'g:go_fmt_autosave'*
|
||||
|
||||
Use this option to auto |:GoFmt| on save. By default it's enabled >
|
||||
@ -574,10 +633,10 @@ fails. By default it's disabled. >
|
||||
|
||||
Use this option to enable fmt's experimental mode. This experimental mode is
|
||||
superior to the current mode as it fully saves the undo history, so undo/redo
|
||||
doesn't break. However it's causing problems on some Vim versions. By default
|
||||
it's disabled. >
|
||||
doesn't break. However it's slows (creates/deletes a file for every save) and
|
||||
it's causing problems on some Vim versions. By default it's disabled. >
|
||||
|
||||
let g:go_fmt_experimental = 1
|
||||
let g:go_fmt_experimental = 0
|
||||
<
|
||||
*'g:go_doc_keywordprg_enabled'*
|
||||
|
||||
@ -595,6 +654,14 @@ enabled. Disabling it allows you to map something else to the mapping `gd`.
|
||||
Default is enabled. >
|
||||
|
||||
let g:go_def_mapping_enabled = 1
|
||||
<
|
||||
*'g:go_dispatch_enabled'*
|
||||
|
||||
Use this option to enable/disable the use of Dispatch to execute the
|
||||
`:GoRun`, `:GoBuild` and `:GoGenerate` commands. More information about Dispatch is
|
||||
available at https://github.com/tpope/vim-dispatch. Default is disabled. >
|
||||
|
||||
let g:go_dispatch_enabled = 0
|
||||
<
|
||||
*'g:go_doc_command'*
|
||||
|
||||
@ -630,7 +697,8 @@ is used. Use "neosnippet" for neosnippet.vim: >
|
||||
|
||||
Use this option to define the scope of the analysis to be passed for Oracle
|
||||
related commands, such as |GoImplements|, |GoCallers|, etc.. By default it's
|
||||
not set, so only the current packages go files are passed as scope. For more
|
||||
not set, so only the current packages go files are passed as scope. You can
|
||||
change it on-the-fly with |GoOracleScope|. For more
|
||||
info please have look at Oracle's User Manual:
|
||||
https://docs.google.com/document/d/1SLk36YRjjMgKqe490mSRzOPYEDe0Y_WQNRv-EiFYUyw/view#heading=h.nwso96pj07q8
|
||||
>
|
||||
@ -704,12 +772,25 @@ Highlights build constraints. By default it's disabled. >
|
||||
|
||||
let g:go_highlight_build_constraints = 0
|
||||
<
|
||||
|
||||
*'g:go_autodetect_gopath'*
|
||||
|
||||
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
|
||||
supports will be added. By default it's enabled. >
|
||||
|
||||
let g:go_autodetect_gopath = 1
|
||||
<
|
||||
*'g:go_textobj_enabled'*
|
||||
|
||||
Adds custom text objects. By default it's enabled. >
|
||||
|
||||
let g:go_textobj_enabled = 1
|
||||
|
||||
|
||||
===============================================================================
|
||||
TROUBLESHOOTING *go-troubleshooting*
|
||||
|
||||
|
Reference in New Issue
Block a user