Vim Autopep8 on Save

Since I couldn’t find this from a cursory search, to make vim run autopep8 on save like most gofmt setups, do the following:

  1. Install vim-autopep8
  2. Add the following to your .vimrc:

    let g:autopep8_disable_show_diff=1
    autocmd BufWritePost *.py Autopep8
    

The first line tells vim not to show the diff window, and the second tells vim to run Autopep8 whenever a Python file is written.