2017-03-07 12:04:28 -05: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-05-02 08:42:08 -04:00
|
|
|
This plugin adds Go language support for Vim, with the following main features:
|
|
|
|
|
2017-11-24 08:54:40 -05:00
|
|
|
* Compile your package with `:GoBuild`, install it with `:GoInstall` or test it
|
2018-03-31 10:56:26 -04:00
|
|
|
with `:GoTest`. Run a single test with `:GoTestFunc`).
|
2017-11-24 08:54:40 -05:00
|
|
|
* Quickly execute your current file(s) with `:GoRun`.
|
|
|
|
* Improved syntax highlighting and folding.
|
2018-03-31 10:56:26 -04:00
|
|
|
* Debug programs with integrated `delve` support with `:GoDebugStart`.
|
2019-03-27 11:08:56 -04:00
|
|
|
* Completion support via `gocode` and `gopls`.
|
2017-11-24 08:54:40 -05:00
|
|
|
* `gofmt` or `goimports` on save keeps the cursor position and undo history.
|
|
|
|
* Go to symbol/declaration with `:GoDef`.
|
|
|
|
* Look up documentation with `:GoDoc` or `:GoDocBrowser`.
|
|
|
|
* Easily import packages via `:GoImport`, remove them via `:GoDrop`.
|
2018-03-31 10:56:26 -04:00
|
|
|
* Precise type-safe renaming of identifiers with `:GoRename`.
|
2017-11-24 08:54:40 -05:00
|
|
|
* See which code is covered by tests with `:GoCoverage`.
|
|
|
|
* Add or remove tags on struct fields with `:GoAddTags` and `:GoRemoveTags`.
|
|
|
|
* Call `gometalinter` with `:GoMetaLinter` to invoke all possible linters
|
|
|
|
(`golint`, `vet`, `errcheck`, `deadcode`, etc.) and put the result in the
|
|
|
|
quickfix or location list.
|
|
|
|
* Lint your code with `:GoLint`, run your code through `:GoVet` to catch static
|
|
|
|
errors, or make sure errors are checked with `:GoErrCheck`.
|
|
|
|
* Advanced source analysis tools utilizing `guru`, such as `:GoImplements`,
|
|
|
|
`:GoCallees`, and `:GoReferrers`.
|
|
|
|
* ... and many more! Please see [doc/vim-go.txt](doc/vim-go.txt) for more
|
|
|
|
information.
|
2016-08-02 08:48:32 -04:00
|
|
|
|
2014-10-31 17:30:24 -04:00
|
|
|
## Install
|
|
|
|
|
2018-09-24 20:40:17 -04:00
|
|
|
vim-go requires at least Vim 7.4.2009 or Neovim 0.3.1.
|
2018-07-30 17:18:16 -04:00
|
|
|
|
2017-11-24 08:54:40 -05:00
|
|
|
The [**latest stable release**](https://github.com/fatih/vim-go/releases/latest) is the
|
|
|
|
recommended version to use. If you choose to use the master branch instead,
|
|
|
|
please do so with caution; it is a _development_ branch.
|
2016-05-14 07:57:54 -04:00
|
|
|
|
2018-07-30 17:18:16 -04:00
|
|
|
|
2017-11-24 08:54:40 -05:00
|
|
|
vim-go follows the standard runtime path structure. Below are some helper lines
|
2017-05-02 08:42:08 -04:00
|
|
|
for popular package managers:
|
2015-02-24 05:45:22 -05:00
|
|
|
|
2017-11-24 08:54:40 -05:00
|
|
|
* [Vim 8 packages](http://vimhelp.appspot.com/repeat.txt.html#packages)
|
|
|
|
* `git clone https://github.com/fatih/vim-go.git ~/.vim/pack/plugins/start/vim-go`
|
|
|
|
* [Pathogen](https://github.com/tpope/vim-pathogen)
|
|
|
|
* `git clone https://github.com/fatih/vim-go.git ~/.vim/bundle/vim-go`
|
|
|
|
* [vim-plug](https://github.com/junegunn/vim-plug)
|
2018-06-14 06:31:12 -04:00
|
|
|
* `Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }`
|
2018-07-30 17:18:16 -04:00
|
|
|
* [Vundle](https://github.com/VundleVim/Vundle.vim)
|
|
|
|
* `Plugin 'fatih/vim-go'`
|
2014-10-31 17:30:24 -04:00
|
|
|
|
2017-11-24 08:54:40 -05:00
|
|
|
You will also need to install all the necessary binaries. vim-go makes it easy
|
|
|
|
to install all of them by providing a command, `:GoInstallBinaries`, which will
|
|
|
|
`go get` all the required binaries.
|
2014-10-31 17:30:24 -04:00
|
|
|
|
2017-11-24 08:54:40 -05:00
|
|
|
Check out the Install section in [the documentation](doc/vim-go.txt) for more
|
|
|
|
detailed instructions (`:help go-install`).
|
2014-10-31 17:30:24 -04:00
|
|
|
|
2017-05-02 08:42:08 -04:00
|
|
|
## Usage
|
2017-02-11 08:01:38 -05:00
|
|
|
|
2017-11-24 08:54:40 -05:00
|
|
|
The full documentation can be found at [doc/vim-go.txt](doc/vim-go.txt). You can
|
|
|
|
display it from within Vim with `:help vim-go`.
|
2017-09-02 06:43:18 -04:00
|
|
|
|
2017-11-24 08:54:40 -05:00
|
|
|
Depending on your installation method, you may have to generate the plugin's
|
|
|
|
[`help tags`](http://vimhelp.appspot.com/helphelp.txt.html#%3Ahelptags)
|
|
|
|
manually (e.g. `:helptags ALL`).
|
2017-09-02 06:43:18 -04:00
|
|
|
|
2019-08-22 11:36:17 -04:00
|
|
|
We also have an [official vim-go tutorial](https://github.com/fatih/vim-go/wiki).
|
|
|
|
|
|
|
|
## FAQ and troubleshooting
|
|
|
|
|
|
|
|
The FAQ and troubleshooting tips are in the documentation and can be quickly
|
|
|
|
accessed using `:help go-troubleshooting`. If you believe you've found a bug or
|
|
|
|
shortcoming in vim-go that is neither addressed by help nor in [existing
|
|
|
|
issues](https://github.com/fatih/vim-go/issues), please open an issue with
|
|
|
|
clear reproduction steps. `:GoReportGitHubIssue` can be used pre-populate a lot
|
|
|
|
of the information needed when creating a new issue.
|
2015-07-13 06:22:46 -04:00
|
|
|
|
|
|
|
## License
|
|
|
|
|
2017-05-02 08:42:08 -04:00
|
|
|
The BSD 3-Clause License - see [`LICENSE`](LICENSE) for more details
|