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

README.md

This is deprecated. Please use vim-go

Features

  • 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

Requirements

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

Configuration

Run Once

:GoFmt

Run Automatically

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