sponsor Vim development Vim logo Vim Book Ad

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

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

created by
@kevinwatters
 
script type
ftplugin
 
description
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.

NOTES:
* 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
      endif

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

http://github.com/kevinw/pyflakes-vim
http://github.com/kevinw/pyflakes

KNOWN ISSUES

- 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.

https://github.com/kevinw/pyflakes-vim/commit/5dc4416f6434fd0db12d21b6c1f4d0764c8757fe

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

https://github.com/kevinw/pyflakes-vim/commit/086d5e1d5f87f7cdd0588f8149bf08115a8ae229
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.

https://github.com/kevinw/pyflakes-vim/commit/ddeb0bf2d7db7916a62339f42c18c7a12468cd37
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.

http://github.com/kevinw/pyflakes-vim/commit/10fb7c382ce94470ae47848d1ac84925381c036f
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.

http://github.com/kevinw/pyflakes-vim/commit/64ebcffe3de49fe34ca12b11292b792dc323709f
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.

http://github.com/kevinw/pyflakes-vim/commit/1dffdbe91034f7a2bb6a16efe43d9bd9a466d11a
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.

http://github.com/kevinw/pyflakes-vim/commit/5eaf3bc1d7508da2994657c4f77458f4064d26e2
pyflakes-vim.zip 1.59 2010-03-04 7.0 @kevinwatters Minor fix for an exception when opening files.

http://github.com/kevinw/pyflakes-vim/commit/783b3aa3de1fddb082f0810300bac5a831a97941
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
    endif

- 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: 54.205.179.155

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.
   
Vim at Github