Want to take your software engineering career to the next level? Join the mailing list for career tips & advice Click here

vim-go

Go development plugin for Vim

Subscribe to updates I use vim-go


Statistics on vim-go

Number of watchers on Github 12380
Number of open issues 37
Average time to close an issue 7 days
Main language VimL
Average time to merge a PR 3 days
Open pull requests 98+
Closed pull requests 69+
Last commit 17 days ago
Repo Created over 6 years ago
Repo Last Updated 15 days ago
Size 5.94 MB
Homepage https://www.patre...
Organization / Authorfatih
Latest Releasev1.23
Contributors110
Page Updated
Do you use vim-go? Leave a review!
View open issues (37)
View vim-go activity
View on github
Fresh, new opensource launches πŸš€πŸš€πŸš€
Software engineers: It's time to get promoted. Starting NOW! Subscribe to my mailing list and I will equip you with tools, tips and actionable advice to grow in your career.
Evaluating vim-go for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

vim-go Build Status GitHub Actions Status

Vim-go logo

Features

This plugin adds Go language support for Vim, with the following main features:

  • Compile your package with :GoBuild, install it with :GoInstall or test it with :GoTest. Run a single test with :GoTestFunc).
  • Quickly execute your current file(s) with :GoRun.
  • Improved syntax highlighting and folding.
  • Debug programs with integrated delve support with :GoDebugStart.
  • Completion and many other features support via gopls.
  • formatting 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.
  • Precise type-safe renaming of identifiers with :GoRename.
  • See which code is covered by tests with :GoCoverage.
  • Add or remove tags on struct fields with :GoAddTags and :GoRemoveTags.
  • Call golangci-lint 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 for more information.
  • The gopls instance can be shared with other Vim plugins.
  • Vim-go's use of gopls can be disabled.

Install

vim-go requires at least Vim 8.0.1453 or Neovim 0.4.0.

The latest stable release 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.

vim-go follows the standard runtime path structure. Below are some helper lines for popular package managers:

  • Vim 8 packages
    • git clone https://github.com/fatih/vim-go.git ~/.vim/pack/plugins/start/vim-go
  • Pathogen
    • git clone https://github.com/fatih/vim-go.git ~/.vim/bundle/vim-go
  • vim-plug
    • Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
  • Vundle
    • Plugin 'fatih/vim-go'

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.

Check out the Install section in the documentation for more detailed instructions (:help go-install).

Usage

The full documentation can be found at doc/vim-go.txt. You can display it from within Vim with :help vim-go.

Depending on your installation method, you may have to generate the plugin's help tags manually (e.g. :helptags ALL).

We also have an official vim-go tutorial.

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, 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.

Contributing

All PRs are welcome. If you are planning to contribute a large patch or to integrate a new tool, please create an issue first to get any upfront questions or design decisions out of the way first.

You can run the tests locally by running make. It will lint the VimL for you, lint the documentation, and run the tests against the minimum required version of Vim, other versions of Vim that may be critical to support, and Neovim.

License

The BSD 3-Clause License - see LICENSE for more details

vim-go open issues Ask a question     (View All Issues)
  • over 3 years :GoBuild leaves error window open
  • over 3 years cannot jump to symbol in vendored package
  • over 3 years Neovim v0.1.6 stable + vim-go + delimitMate = freeze
  • over 3 years :GoImports (and :GoFmt) do not work when buffer is not written to disk
  • almost 4 years GoAddTags bug when using *interface{} fields
  • almost 4 years GoAddFields
  • almost 4 years Preview buffer does not show Comments
  • almost 4 years Using snippets with neosnippet
  • almost 4 years Path issues on :GoDef in Windows
  • almost 4 years Hint on save "Press ENTER or type command to continue"
  • almost 4 years GoImpl creates method stubs inside struct definiton
  • almost 4 years GoImpl should not create method stubs if they are already implemented
  • almost 4 years [vim-8.0] quickfix or locationlist steal focus after save
  • almost 4 years Saving a file with goimports does not preserve correct cursor position
  • almost 4 years golint and gometalinter appear to be missing
  • almost 4 years GoAddTags should not add twice
  • almost 4 years Option for autocreate to treat empty directories as a package named after that directory
  • almost 4 years Invite user to issue the command :GoInstallBinaries
  • almost 4 years :GoCallers is broken
  • almost 4 years buffer moves to top of the file then back to cursor with each save
  • almost 4 years GoCoverageClear removes custom highlights
  • almost 4 years vim-8.0: show_errors can fail with a list index out of range on Windows
  • almost 4 years :GoTest errors appear in location list
  • almost 4 years GoCoverage not hightlighting
  • about 4 years g:go_highlight_types breaks folding
  • about 4 years :GoAddTags with nested structs
  • about 4 years GoAddTags: tag options
  • about 4 years GoAddTags: allow modifying existing comments
  • about 4 years Improvement suggestion: Syntax based folding for imports
  • about 4 years Replicate Syntastic behavior, or, easier go build
vim-go open pull requests (View All Pulls)
  • Allow GoRun to accept file arguments in neovim
  • the cursor offset for goinfo has to be 1 greater than it currently is
  • Neovim integration for GoCoverage
  • goinfo improvements
  • alternate.vim: handle empty buffer names and general improvements
  • syntax highlighting for //go:generate
  • :GoDef custom Tag Stack support (#667)
  • Improve highlighting for numbers
  • Use mapping independent `normal!`
  • fmt: use shellescape instead of fnameescape
  • GoTestFunc: support testable examples
  • fmt: follow symlinks if we edit a symbolic link
  • guru support
  • Add Blocks support in vim-go
  • add nnoremap <buffer> <silent> <C-w><C-]> :<C-u>call go#def#Jump(spli…
  • Fix bad syntax of `redraw` in go/rename.vim
  • add goField
  • Increase compatibility with tcsh
  • Properly use exepath for CheckBinPath
  • Restore original files permissions
  • guru: fix slash direction for windows users
  • util: add go#util#env function
  • add commands to toggle settings that control auto behavior
  • use guru's -modified flag
  • Add ToggleSameIds
  • Cleanup documentation formatting
  • Changed/Fixed go-to-def using tabs
  • Fix :GoSameIds for light background, GUI, and after changing colour schemes
  • Fix GoCoverage highlighting, GoInstall deps, add support for FZF for GoDecls
  • Add :GoAvailImports to search importable packages with CtrlP
  • Rename GoMetalinterAutoSaveToggle to GoMetaLinterAutoSaveToggle
  • SameIds: Fix Sentence, add hint to 'updatetime'
  • allow :GoDoc on modified buffers
  • Fix syntax goFormatSpecifier: check '%%'
  • Add compatibility for GoAddTags and google/jsonapi
  • Fix appropriate bin_path may not work
  • Highlight nested fields or chained fields
  • Provide a descriptive quickfix/location list title.
  • coverage: allow to run coverage on _test.go files in subdirs
  • Add formatted error snippets
  • Highlight nested structs
  • Add table-driven tests and subtests snippets
  • Make sure builtins are always hightlighted correctly
  • Clear most recent goSameId highlights groups
  • Add `g:go_updatetime` to configure a custom `updatetime`
  • lint: add (go-lint) plug mapping
  • Add path convertion for native-win-vim with Cygwin support
  • allow popping from jump list when buffer is modified
  • handle :GoDef from modified buffer
  • Add path conversion for MSYS2 environments
  • Add option to use cwd as package name instead of template
  • go.vim func n method call style
  • Correctly report the value of the 'g:go_guru_tags' variable
  • fix :GoBuild issues in neovim
  • Fold function
  • Fixed issue Vim-Go broken on freebsd #1224
  • Add :GoAddTags
  • support <C-LeftMouse> as well
  • Include keyify support
  • goimports fails when proj symlinked in GOPATH
  • Add go_imports_options resolve #1212
  • Fix Issue #1283 Resolve highlighting error by surrounding expression in \(\)
  • Specifies the type of list to use in GoMetaLinter, by go_list_type
  • term: fix cwd after running command
  • Fix GoDef for paths with spaces
  • Load buffers with :GoDef relative to cwd
  • Fix async race
  • handle autowriteall the same as autowrite
  • separate gometalinter error list use cases
  • FIX #1642: use Execute for Gorename
  • Use :sbuffer in :GoAlternate
  • do not re-install vim on every vim-go change
  • Use new 'goimport' tool instead of VimScript for :GoImport and :GoDrop
  • Remove :GoDefStack
  • Basic version of GoNextId and GoPrevId commands #1518
  • Add :GoExpandErr
  • add GoDebug
  • [WIP] enable vim8 terminal
  • Fix for locationlist or quickfix list stealing focus on save.
  • neovim: invoke guru functions via async api
  • add fmt.Errorf() snippet in UltiSnips
  • Keep current alternate-file name while reading templates
  • Fix go build error parse
  • Improve Go identifier syntax highlighting
  • cache import path lookups results
  • Consolidate configs
  • Adds vim-plug post-update hook to documentation
  • Use signs to keep track of breakpoints
  • Add build tags to many commands
  • Some improvements for :GoRun
  • cmd: go 1.10 maintains a build cache now
  • fix missing <buffer> for debug mappings
  • lsp: return current diagnostics when file is unchanged
  • run: capture error messages from panics
  • guru: do not hookup guru commands when not in GOPATH
  • Escape backslashes
  • util: catch exceptions trying to execute system commands
  • Check function exists
vim-go questions on Stackoverflow (View All Questions)
  • Can vim-go completion third party framework
  • Vim - Go to previous location
  • Golang: ":GoRun" in vim-go and "go install" have conflicting GOPATH requirements on Windows
  • Vim go to std library method/function definition
  • Using vim-go, gocode and godep doesn't work together
  • Install vim-go in linux?
  • How to forbidden vim-go auto build when saving a *.go file
  • Changing Vim go-to behaviour
  • vim-go autocompletion not working
  • vim-go: Can't get autocompletion
  • Vim go to next search result across multiple files?
  • Vim-go: goimports not working
  • Vim-go - Indent with tabs not whitespaces
  • Prevent vim-go plugin from calling 'less' on save
  • vim-go deleting unused code when write to disk
  • vim go to tag: filter results by kind (say, go to function definition, ignoring prototypes)
  • vim-go: How to open files returned by GoFiles
  • vim -- 'go to previous buffer' broken
  • Vim go to line/column with --remote-silent
  • VIM Go Syntastic: main redeclared
  • Vim: Go to Beginning/End of Next Method
  • Vim go to ruby class declaration
  • ctags vim - go to method definition in same python class
  • Vim go to last edited line
  • How to make vim go to last line last character and then in insert mode?
  • how to make vim go to next line when at last character and press right arrow key
  • How do I make Vim go inside paired characters automatically during Insert Mode?
  • Vim 'go to file' functionality
  • vim: go to the last character of line plus one
vim-go list of languages used
vim-go latest release notes
v1.23 v1.23

Please checkout the changelog for this release.

The full list of changes in this version are on the v1.23 milestone

Do you want to support vim-go? Checkout the fully optional donation option, a way to support vim-go's ongoing development directly: https://www.patreon.com/bhcleek.

v1.22 v1.22

Please checkout the changelog for this release

The full list of changes in this version are on the v1.22 milestone

Do you want to support vim-go? Checkout the fully optional donation option, a way to support vim-go's ongoing development directly: https://www.patreon.com/bhcleek

v1.22-rc.4 v1.22-rc.4

This is a pre-release for vim-go. Please checkout the changelog for this release: https://github.com/fatih/vim-go/blob/025af24e79a5efe6981b8c02c1a314217d3c73cb/CHANGELOG.md#unplanned

Do you want to support vim-go? Checkout the fully optional donation option, a way to support vim-go's ongoing development directly: https://www.patreon.com/bhcleek

Other projects in VimL