Skip to content
A better gofmt for vim
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

This is deprecated. Please use vim-go


  • Works with multiple views of the same file
  • Doesn't mess up the undo tree (undoing the previous change undoes the fmt with it)
  • Clears the error list when gofmt succeeds
  • Automatically hides/shows the error list


vim-gofmt requires you to have the standard golang vim package installed. If you are using pathogen that is as easy as:

" Go stores the official vim plugin at $GOROOT/misc/vim/
call pathogen#infect('bundle/{}', $GOROOT . '/misc/{}')
call pathogen#helptags()

This requires that you define $GOROOT in your OS. You can figure out what your $GOROOT should be set to by running go env


Run Once


Run Automatically

augroup golangfmt
    autocm FileType go autocmd! golangfmt BufWritePre <buffer> GoFmt
augroup END
You can’t perform that action at this time.