Sunday, May 31, 2009

Pyflakes Vim Script for Python Editing

I found another very useful Vim script for editing Python code: pyflakes.vim. It basically gives you on-the-fly code checking, similar to Eclipse: "pyflakes-vim shows wavy underlines underneath common Python errors like misspelling a variable name. It also warns about unused imports, redefined functions, etc.". It's not perfect in it's analysis, but it sure helps catch a lot of errors that normally don't get caught until runtime. I didn't follow the installation instructions since I generally load my file type scripts explicitly, and because I couldn't get the script to load using the instructions given. Instead I did the following:
  • Unzipped the contents of pyflakes-vim.zip to vimfiles/ftplugin
  • Added runtime ftplugin/pyflakes.vim to my vimfiles/ftplugin/python.vim script