Skip to content

Instantly share code, notes, and snippets.

Last active September 26, 2019 10:38
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Vim for Go

Vim for Go development



  • if : select the code inside a function
  • af : select the entire function code including comments


  • gd : go to definition of word under cursor
  • Ctrl-O / Ctrl-I :hop back to your source file/return to definition
  • K : opens documentationn


:GoRun :GoBuild :GoInstall
:cn :cp # goto next/previous problem in the issues window :GoDef # goto definition of object under cursor
:GoDoc # open documentation

:GoTest # run every *_test.go file and report results
:GoTestFunc # or just test the function under your cursor
:GoCoverage # check your test coverage
:GoAlternate # switch bewteen your test case and implementation

:GoImport # manage and name your imports

:GoRename # precise renaming of identifiers

:GoLint # lint your code

YouComplete me


  • compile the c++ server
cd ~/.vim/bundle/YouCompleteMe
python3 --clangd-completer --go-completer


" close autocomplete window when done
let g:ycm_autoclose_preview_window_after_completion=1

" disable tab use so tab can be used to complete snippets
let g:ycm_key_list_select_completion=[]
let g:ycm_key_list_previous_completion=[]


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment