sponsor Vim development Vim logo Vim Book Ad

pyflakes.vim : PyFlakes on-the-fly Python code checking

 script karma  Rating 973/286, Downloaded by 33737  Comments, bugs, improvements  Vim wiki

created by
script type
like/use/enjoy/need/jonesfor pyflakes.vim? donate a little cash here to help me keep improving it: http://bit.ly/gp4FCA

IMPORTANT: Your vim must have Python 2.5, at least. Enter ":python import sys; print sys.version" to see which version you have.  The newest version of Vim, 7.3, comes bundled with Python 2.7 support.

pyflakes-vim highlights common Python errors like misspelling a variable name on the fly. It also warns about unused imports, redefined functions, etc.

This plugin is fast enough that it registers itself with vim hooks for leaving insert mode and saving a buffer, so that the warnings are always up to date. See pyflakes.vim if you want to change this behavior.

* an improved pyflakes module is INCLUDED with this plugin, so you don't need to install it separately
* quickfix entries are created for each error, so you can use commands like :cc to jump to errors.
* this plugin uses the SpellBad highlight to show errors. if you'd like to change the color or style of this highlight, you can do something like this in your .vimrc:

      if has("gui_running")
          highlight SpellBad term=underline gui=undercurl guisp=Orange

To stay up on development, you can watch the public repos at



- The highlighting for syntax errors is often way off, and results in no other errors being detected.
- In Python 2.5, typing a with statement before you have from __future__ import with results in a vim error
install details
1. Make sure your vimrc has "filetype plugin indent on" so that pyflake-vim's ftplugin files are loaded automatically when you open a Python buffer.
2. Drop extracted files in ~/.vim/ftplugin/python.
3. That's it!

See the README for more info.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
pyflakes-vim.zip 3.01 2010-11-30 7.0 @kevinwatters Add __file__ as an automatic builtin.


Move pyflakes.vim and pyflakes library into ftplugin/python for easier pathogen installation.

pyflakes-vim.zip 3.0 2010-11-17 7.0 @kevinwatters Upgraded the included pyflakes module to trunk r17946 from http://divmod.org/trac/wiki/DivmodPyflakes, which adds support for Python 2.7 constructs like set comprehensions and dict comprehensions.  Modified pyflakes 0.4.0 to retain column information.

Modified pyflakes.vim to be compatible with "stock" PyFlakes.

Changes in pyflakes.vim: https://github.com/kevinw/pyflakes-vim/commit/8a7e19b6578b0986cb7a88a6c10d6cd907af2057

Changes to stock PyFlakes 0.4.0: https://github.com/kevinw/pyflakes/commit/8f62656c96b7cf66b7ad6cac0d9e3881e55f389f#
pyflakes-vim.zip 2.02 2010-11-09 7.0 @kevinwatters Avoid a "Press ENTER" prompt when showing long error messages in narrow windows by truncating them to the number of columns.

pyflakes-vim.zip 2.01 2010-10-12 7.0 @kevinwatters Add configuration option g:pyflakes_use_quickfix. Add

let g:pyflakes_use_quickfix = 0

to disable quickfix support.

pyflakes-vim.zip 2.0 2010-07-21 7.0 @kevinwatters Add quickfix support! Thanks Phui Hock.

You can now use quickfix commands like :cc to jump to errors.

pyflakes-vim.zip 1.64 2010-07-07 7.0 @kevinwatters Do not decode source code encoding line and the lines preceed it, if found.

Thanks phuihock.

pyflakes-vim.zip 1.63 2010-06-21 7.0 @kevinwatters Don't warn about duplicate functions with property decorators @prop.setter and @prop.deleter.
pyflakes-vim.zip 1.62 2010-06-17 7.0 @kevinwatters Minor 2.5 compatibility fix.
pyflakes-vim.zip 1.61 2010-06-16 6.0 @kevinwatters Don't miss class decorators when walking the AST.
pyflakes-vim.zip 1.60 2010-04-01 7.0 @kevinwatters Show a clear error message if vim was compiled without Python, or with a version of Python older than 2.5.

pyflakes-vim.zip 1.59 2010-03-04 7.0 @kevinwatters Minor fix for an exception when opening files.

pyflakes-vim.zip 1.58 2010-01-04 7.0 @kevinwatters Fix for 1.57 file encoding exception.
pyflakes-vim.zip 1.57 2009-12-29 6.0 @kevinwatters Fixes http://github.com/kevinw/pyflakes-vim/issues/#issue/7 and http://github.com/kevinw/pyflakes-vim/issues/#issue/8

Files in unusual encodings should open correctly now.
Files ending with a trailing comment and no newline should also compile correctly now.
pyflakes-vim.zip 1.56 2009-10-13 7.0 @kevinwatters http://github.com/kevinw/pyflakes-vim/commit/f12c0881f83964e35b2d3ad2299d111cec53dd9f

Fixes http://github.com/kevinw/pyflakes/issues#issue/1

Apparently CursorMoved can get called early, before RunPyflakes has run.
If this happens, just return.

Thanks EnTeQuAk.
pyflakes-vim.zip 1.55 2009-09-17 7.0 @kevinwatters http://github.com/kevinw/pyflakes-vim/commit/083bc2e65649a9cf10a7c1bcd22151a4083ddeb7

Highlight the whole line for SyntaxErrors.
pyflakes-vim.zip 1.5 2009-07-08 7.0 @kevinwatters http://github.com/kevinw/pyflakes-vim/commit/b8f2f366b1322a5ffefede30ddb3339102d2f28c

Ignore stderr during ast.parse, since it will otherwise show as VIM error
messages. Thanks Denis Bilenko.

Eventually we should parse some of the warnings. For example:

  foo.py:33: Warning: 'as' will become a reserved keyword in Python 2.6

This could become a visible warning.
pyflakes-vim.zip 1.4 2009-05-06 7.0 @kevinwatters http://github.com/kevinw/pyflakes-vim/commit/6ec1fbbce32876e315b370409ca55c97d232d125

Restrict dd, dw, etc mappings to the local Python buffer.
pyflakes-vim.zip 1.3 2009-04-21 7.0 @kevinwatters Some fixes based on suggestions from Brandon Low:

- changed highlight call from hard coding a curly underline to linking with the "SpellBad" style. This is more friendly vim on terminals. If you'd like the old brighter orange undercurl from previous versions, add the following to your .vimrc:

    if has("gui_running")
        highlight SpellBad term=underline gui=undercurl guisp=Orange

- added the :PyflakesUpdate command (runs pyflakes and updates the message area)
- hooked dd, dw, u, and <C-R> to also call :PyflakesUpdate so common text operations will invoke PyFlakes
pyflakes-vim.zip 1.2 2009-03-12 7.0 @kevinwatters - Include compatibility fixes for Python 2.6's _ast changes in visit_FunctionDef and for visit_ExceptHandler. Thanks Herve Cauwelier.
- Include pyflakes.scripts in the "packages" option for setup. Thanks Herve Cauwelier.
- Fix for names incorrectly marked undefined in nested list comprehensions.
- Add "__builtins__" to the list of predefined names.
- Bind names for *args and **kwargs in functions and lambdas.
pyflakes-vim.zip 1.1 2008-11-19 7.0 @kevinwatters Updated pyflakes/checker.py to fix AST fixes from http://github.com/kevinw/pyflakes/commit/bdc1acde85df3bf0a8f5ef1ec26e9121667c9d0a
pyflakes-vim.zip 1.0 2008-11-15 7.2 @kevinwatters Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.