mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
# vim-go
|
||||
|
||||
Go (golang) support for Vim. It comes with pre-defined sensible settings (like
|
||||
auto gofmt on save), has autocomplete, snippet support, improved syntax
|
||||
highlighting, go toolchain commands, etc... If needed vim-go installs all
|
||||
Go (golang) support for Vim, which comes with pre-defined sensible settings (like
|
||||
auto gofmt on save), with autocomplete, snippet support, improved syntax
|
||||
highlighting, go toolchain commands, and more. If needed vim-go installs all
|
||||
necessary binaries for providing seamless Vim integration with current
|
||||
commands. It's highly customizable and each individual feature can be
|
||||
disabled/enabled easily.
|
||||
@ -11,40 +11,44 @@ disabled/enabled easily.
|
||||
|
||||
## Features
|
||||
|
||||
* 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.
|
||||
* 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`
|
||||
* `:GoRun` quickly your current file/files
|
||||
* Run `:GoTest` and see any errors in quickfix window
|
||||
* Automatic `GOPATH` detection based on the directory structure (i.e: `godep`
|
||||
vendored projects)
|
||||
* 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 tool with oracle, such as `:GoImplements`,
|
||||
`:GoCallees`, `:GoReferrers`
|
||||
* 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 `:GoErrCheck` for unchecked errors.
|
||||
* Integrated and improved snippets. Supports `ultisnips` or `neosnippet`
|
||||
* 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
|
||||
|
||||
Vim-go follows the standard runtime path structure, so I highly recommend to use
|
||||
a common and well known plugin manager to install vim-go. Do not use vim-go with
|
||||
other Go plugins. For Pathogen just clone the repo, for other plugin managers
|
||||
other Go oriented vim plugins. For Pathogen just clone the repo. For other plugin managers
|
||||
add the appropriate lines and execute the plugin's install command.
|
||||
|
||||
* [Pathogen](https://github.com/tpope/vim-pathogen)
|
||||
@ -57,21 +61,21 @@ add the appropriate lines and execute the plugin's install command.
|
||||
* `Plugin 'fatih/vim-go'`
|
||||
|
||||
Please be sure all necessary binaries are installed (such as `gocode`, `godef`,
|
||||
`goimports`, etc..). You can easily install them with the included
|
||||
`:GoInstallBinaries` command. If you invoke it, all necessary binaries will be
|
||||
`goimports`, etc.). You can easily install them with the included
|
||||
`:GoInstallBinaries` command. If invoked, all necessary binaries will be
|
||||
automatically downloaded and installed to your `$GOBIN` environment (if not set
|
||||
it will use `$GOPATH/bin`). It requires `git` for fetching the individual Go
|
||||
packages.
|
||||
it will use `$GOPATH/bin`). Note that this command requires `git` for fetching the individual Go
|
||||
packages. Additionally, use `:GoUpdateBinaries` to update the installed binaries.
|
||||
|
||||
### Optional
|
||||
|
||||
* Autocompletion is enabled by default via `<C-x><C-o>`, to get real-time
|
||||
* Autocompletion is enabled by default via `<C-x><C-o>`. To get real-time
|
||||
completion (completion by type) install:
|
||||
[YCM](https://github.com/Valloric/YouCompleteMe) or
|
||||
[neocomplete](https://github.com/Shougo/neocomplete.vim).
|
||||
* To get displayed source code tag informations on a sidebar install
|
||||
* To display source code tag information on a sidebar install
|
||||
[tagbar](https://github.com/majutsushi/tagbar).
|
||||
* For snippet feature install:
|
||||
* For snippet features install:
|
||||
[ultisnips](https://github.com/SirVer/ultisnips) or
|
||||
[neosnippet](https://github.com/Shougo/neosnippet.vim).
|
||||
* Screenshot color scheme is a slightly modified molokai: [fatih/molokai](https://github.com/fatih/molokai).
|
||||
@ -79,7 +83,7 @@ completion (completion by type) install:
|
||||
|
||||
## Usage
|
||||
|
||||
Many of the [features](#features) are enabled by default. There are no
|
||||
Many of the plugin's [features](#features) are enabled by default. There are no
|
||||
additional settings needed. All usages and commands are listed in
|
||||
`doc/vim-go.txt`. Note that help tags needs to be populated. Check your plugin
|
||||
manager settings to generate the documentation (some do it automatically).
|
||||
@ -92,9 +96,9 @@ After that just open the help page to see all commands:
|
||||
vim-go has several `<Plug>` mappings which can be used to create custom
|
||||
mappings. Below are some examples you might find useful:
|
||||
|
||||
Run commands, such as `go run` with `<leader>r` for the current file or `go
|
||||
build` and `go test` for the current package with `<leader>b` and `<leader>t`.
|
||||
Display a beautiful annotated source code to see which functions are covered
|
||||
Run commands such as `go run` for the current file with `<leader>r` or `go
|
||||
build` and `go test` for the current package with `<leader>b` and `<leader>t` respectively.
|
||||
Display beautifully annotated source code to see which functions are covered
|
||||
with `<leader>c`.
|
||||
|
||||
```vim
|
||||
@ -104,9 +108,9 @@ au FileType go nmap <leader>t <Plug>(go-test)
|
||||
au FileType go nmap <leader>c <Plug>(go-coverage)
|
||||
```
|
||||
|
||||
By default the mapping `gd` is enabled which opens the target identifier in
|
||||
current buffer. You can also open the definition/declaration in a new vertical,
|
||||
horizontal or tab for the word under your cursor:
|
||||
By default the mapping `gd` is enabled, which opens the target identifier in
|
||||
current buffer. You can also open the definition/declaration, in a new vertical,
|
||||
horizontal, or tab, for the word under your cursor:
|
||||
|
||||
```vim
|
||||
au FileType go nmap <Leader>ds <Plug>(go-def-split)
|
||||
@ -152,6 +156,19 @@ More `<Plug>` mappings can be seen with `:he go-mappings`. Also these are just
|
||||
recommendations, you are free to create more advanced mappings or functions
|
||||
based on `:he go-commands`.
|
||||
|
||||
### Location list navigation
|
||||
|
||||
All commands support collecting and displaying errors in Vim's location
|
||||
list.
|
||||
|
||||
Quickly navigate through these location lists with `:lne` for next error and `:lp`
|
||||
for previous. You can also bind these to keys, for example:
|
||||
|
||||
```vim
|
||||
map <C-n> :lne<CR>
|
||||
map <C-m> :lp<CR>
|
||||
```
|
||||
|
||||
## Settings
|
||||
Below are some settings you might find useful. For the full list see `:he go-settings`.
|
||||
|
||||
@ -183,7 +200,7 @@ Disable auto fmt on save:
|
||||
let g:go_fmt_autosave = 0
|
||||
```
|
||||
|
||||
Disable opening browser after posting to your snippet to `play.golang.org`:
|
||||
Disable opening browser after posting your snippet to `play.golang.org`:
|
||||
|
||||
```vim
|
||||
let g:go_play_open_browser = 0
|
||||
@ -197,23 +214,19 @@ let g:go_bin_path = expand("~/.gotools")
|
||||
let g:go_bin_path = "/home/fatih/.mypath" "or give absolute path
|
||||
```
|
||||
|
||||
## Using with Syntastic
|
||||
Sometimes when using both `vim-go` and `syntastic` Vim will start lagging while saving and opening
|
||||
files. The following fixes this:
|
||||
|
||||
```vim
|
||||
let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
|
||||
let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
|
||||
```
|
||||
|
||||
## More info
|
||||
|
||||
Check out the Wiki page for more information. It includes Screencasts, FAQ
|
||||
section and many various piece of information:
|
||||
|
||||
[https://github.com/fatih/vim-go/wiki](https://github.com/fatih/vim-go/wiki)
|
||||
|
||||
|
||||
## Donations
|
||||
|
||||
Vim-go is an open source project and I'm working on it on my free times. I'm
|
||||
spending a lot of time and thoughts to make it stable, fixing bugs, adding new
|
||||
features, etc... If you like vim-go and find it helpful, you might give me a
|
||||
gift from some of the books (kindle) I have in my wish list:
|
||||
|
||||
[Amazon.com Fatih's Wish List](http://amzn.com/w/3RUTKZC0U30P6). Thanks!
|
||||
Check out the [Wiki](https://github.com/fatih/vim-go/wiki) page for more information. It includes [Screencasts](https://github.com/fatih/vim-go/wiki/Screencasts), an [FAQ
|
||||
section](https://github.com/fatih/vim-go/wiki/FAQ-Troubleshooting), and many other [various pieces](https://github.com/fatih/vim-go/wiki) of information.
|
||||
|
||||
## Credits
|
||||
|
||||
|
Reference in New Issue
Block a user