I fiddled a bit for making my VIM tell me when obvious (statically detectable) mistakes sit in my code when saving. This speeds up the testing process a bit when e.g. syntax errors exist and helps me adhere to PEP 8.
I use vim’s ftplugin which has the following settings in ~/.vim/ftplugin/python.vim:
setlocal makeprg=pep8\ --repeat\ % autocmd BufWritePost call Checkpep8()
In my ~/.vimrc the Checkpep8 function is defined as follows:
function Checkpep8 () silent make redraw! if len(getqflist()) cl endif endfunction Checkpep8
The effort of the custom function is in avoiding to get the <PRESS ENTER> message from the shell command if no errors exist. The only minor annoyance with my solution is that the message “file written…” disappears more quickly than normally.