2017-08-03 11:21:37 -04:00
|
|
|
# vim-go [![Build Status](http://img.shields.io/travis/fatih/vim-go.svg?style=flat-square)](https://travis-ci.org/fatih/vim-go)
|
2014-10-31 17:30:24 -04:00
|
|
|
|
2016-10-02 07:37:21 -04:00
|
|
|
<p align="center">
|
|
|
|
<img style="float: right;" src="assets/vim-go.png" alt="Vim-go logo"/>
|
|
|
|
</p>
|
|
|
|
|
2014-10-31 17:30:24 -04:00
|
|
|
## Features
|
|
|
|
|
2017-08-03 11:21:37 -04:00
|
|
|
This plugin adds Go language support for Vim, with the following main features:
|
|
|
|
|
|
|
|
* Build with `:GoBuild`, install with `:GoInstall` or test
|
|
|
|
with `:GoTest` (run single tests via `:GoTestFunc`)
|
|
|
|
* Show test coverage with `:GoCoverage` or in browser with `:GoCoverageBrowser`
|
|
|
|
* Goto definition with `:GoDef`
|
|
|
|
* Quick jump to declarations with `:GoDecls` or `:GoDeclsDir`
|
|
|
|
* Show documentation with `:GoDoc` inside or in browser with `:GoDocBrowser`
|
2015-12-08 08:20:04 -05:00
|
|
|
* Quickly execute your current file/files with `:GoRun`
|
2016-05-14 07:57:54 -04:00
|
|
|
* Advanced source analysis tools utilizing guru, such as `:GoImplements`,
|
2015-12-08 08:20:04 -05:00
|
|
|
`:GoCallees`, and `:GoReferrers`
|
2017-08-03 11:21:37 -04:00
|
|
|
* Change or display `GOPATH` with `:GoPath`
|
|
|
|
* Multiple 3rd linter support with `:GoMetaLinter`
|
|
|
|
* Renaming identifiers with `:GoRename`
|
|
|
|
* Share your code to [play.golang.org](http://play.golang.org) with `:GoPlay`
|
|
|
|
* Switch between `*.go` and `*_test.go` code with `:GoAlternate`
|
|
|
|
* Add/Remove tags on struct fields with `:GoAddTags`
|
|
|
|
* Add import paths via `:GoImport` or remove them with `:GoDrop`
|
|
|
|
* Custom vim text objects such as `a function (af)` or `inner function (if)`
|
|
|
|
* ... and many more! Please see [doc/vim-go.txt](doc/vim-go.txt) for more information.
|
2014-10-31 17:30:24 -04:00
|
|
|
|
2016-08-02 08:48:32 -04:00
|
|
|
|
2014-10-31 17:30:24 -04:00
|
|
|
## Install
|
|
|
|
|
2017-08-03 11:21:37 -04:00
|
|
|
Master branch is a **development** branch. Please use with caution.
|
|
|
|
I recommend to use the [**latest stable release**](https://github.com/fatih/vim-go/releases/latest)
|
2016-05-14 07:57:54 -04:00
|
|
|
|
2017-08-03 11:21:37 -04:00
|
|
|
Vim-go follows the standard runtime path structure. Below are some helper lines
|
|
|
|
for popular package managers:
|
2015-02-24 05:45:22 -05:00
|
|
|
|
|
|
|
* [Pathogen](https://github.com/tpope/vim-pathogen)
|
2017-08-03 11:21:37 -04:00
|
|
|
* `git clone https://github.com/fatih/vim-go.git ~/.vim/bundle/vim-go`
|
2015-02-24 05:45:22 -05:00
|
|
|
* [vim-plug](https://github.com/junegunn/vim-plug)
|
2017-08-03 11:21:37 -04:00
|
|
|
* `Plug 'fatih/vim-go'`
|
|
|
|
* [Vim packages](http://vimhelp.appspot.com/repeat.txt.html#packages)
|
|
|
|
* `git clone https://github.com/fatih/vim-go.git ~/.vim/pack/plugins/start/vim-go`
|
2014-10-31 17:30:24 -04:00
|
|
|
|
2017-08-03 11:21:37 -04:00
|
|
|
After installing, please install all necessary binaries. We have a handy
|
|
|
|
command for it:
|
2016-06-11 09:56:50 -04:00
|
|
|
|
2015-12-16 08:53:53 -05:00
|
|
|
```
|
2017-08-03 11:21:37 -04:00
|
|
|
:GoInstallBinaries
|
2016-02-20 08:13:10 -05:00
|
|
|
```
|
|
|
|
|
2017-08-03 11:21:37 -04:00
|
|
|
for more information please check out the [documentation](doc/vim-go.txt)
|
2016-02-20 08:13:10 -05:00
|
|
|
|
2017-08-03 11:21:37 -04:00
|
|
|
## Usage
|
2015-12-16 08:53:53 -05:00
|
|
|
|
2017-08-03 11:21:37 -04:00
|
|
|
Official documentation can be found under [doc/vim-go.txt](doc/vim-go.txt). You can display it from within Vim with:
|
2015-02-04 05:43:54 -05:00
|
|
|
|
2015-12-08 08:20:04 -05:00
|
|
|
```
|
2017-08-03 11:21:37 -04:00
|
|
|
:help vim-go
|
2016-05-14 07:57:54 -04:00
|
|
|
```
|
2017-08-03 11:21:37 -04:00
|
|
|
We also have an [official vim-go
|
|
|
|
tutorial](https://github.com/fatih/vim-go-tutorial).
|
2015-07-13 06:22:46 -04:00
|
|
|
|
|
|
|
## License
|
|
|
|
|
2017-08-03 11:21:37 -04:00
|
|
|
The BSD 3-Clause License - see [`LICENSE`](LICENSE) for more details
|