sponsor Vim development Vim logo Vim Book Ad

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

 script karma  Rating 234/65, Downloaded by 1753

created by
Kevin Watters
 
script type
ftplugin
 
description
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:
* requires vim to be built with Python 2.5+ support at the moment (for Windows [g]Vim 7.2 builds with Python 2.5 support, see here: http://symbolsystem.com/vim/)
* an improved pyflakes module is INCLUDED with this plugin, so you don't need to install it separately
* 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 1.58 2010-01-04 7.0 Kevin Watters Fix for 1.57 file encoding exception.
pyflakes-vim.zip 1.57 2009-12-29 6.0 Kevin Watters 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 Kevin Watters 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 Kevin Watters http://github.com/kevinw/pyflakes-vim/commit/083bc2e65649a9cf10a7c1bcd22151a4083ddeb7

Highlight the whole line for SyntaxErrors.
pyflakes-vim.zip 1.5 2009-07-08 7.0 Kevin Watters 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 Kevin Watters 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 Kevin Watters 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 Kevin Watters - 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 Kevin Watters 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 Kevin Watters Initial upload

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.
   
SourceForge.net Logo