Skip to content

govim plugin API

Paul Jolly edited this page Apr 17, 2019 · 24 revisions


Alpha: largely working, but there are a number of gopls issues to be worked through/out.

So what can the govim plugin do?

govim is largely driven by gopls, the Language Server Protocol server for Go.

❇️ Hover information

Provide the user with more context on the item under the mouse. Simply hover over an identifier to see a popup with type/signature details.

🎬 Demo

❇️ Format-on-save

Automatically format .go files as they are saved. Configure which tool to use via a global variable.

The plugin default is:

let g:govim_format_on_save = "goimports"

See the config package for more all valid options and more details.

🎬 Demo

❇️ Code completion

Provide completion suggestions at the cursor.

🎬 Demo

❇️ Go-to definition

Jump to the definition of the identifier under the cursor.

🎬 Demo

❇️ Quickfix diagnostics

Code diagnostics (compile, vet errors and the like) in the quickfix window.

🎬 Demo


govim supports user-set configuration, via a .vimrc or similar. The variables that can be set are described in the config package.


The following features are work-in-progress.

✴️ Formatting a range

To follow in #42

🎬 Demo to follow

✴️ AST-based syntax highlighting

To follow in #24. Use go/ast to syntax highlight a file instead of Vim's regex-based syntax definitions. More accurate and potentially faster for very files.

🎬 Demo to follow

You can’t perform that action at this time.