]> git.madduck.net Git - etc/vim.git/blob - README.mdown

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

4db8b3b333d4859767035acc989eb8ad1b874fae
[etc/vim.git] / README.mdown
1 vim-flake8
2 ==========
3 `vim-flake8` is a Vim plugin that runs the currently open file through Flake8,
4 a static syntax and style checker for Python source code.  It supersedes both
5 [vim-pyflakes](https://github.com/nvie/vim-pyflakes) and
6 [vim-pep8](https://github.com/nvie/vim-pep8).
7
8 [Flake8](http://pypi.python.org/pypi/flake8/) is a wrapper around PyFlakes 
9 (static syntax checker), PEP8 (style checker) 
10 and Ned's MacCabe script (complexity checker).
11
12
13 Installation
14 ------------
15 Use [vim-pathogen](https://github.com/tpope/vim-pathogen) if you're not using
16 it already.  Make sure you've installed the [flake8](http://pypi.python.org/pypi/flake8/) package.
17 Then, simply put the contents of this repository in your
18 `~/.vim/bundle` directory.
19
20 Usage
21 -----
22 1. Open a Python file
23 2. Press `<F7>` to run `flake8` on it
24
25 It shows the errors inside a quickfix window, which will allow your to quickly
26 jump to the error locations by simply pressing [Enter].
27
28
29 Customization
30 -------------
31 If you don't want to use the `<F7>` key for flake8-checking, simply remap it to
32 another key.  It autodetects whether it has been remapped and won't register
33 the `<F7>` key if so.  For example, to remap it to `<F3>` instead, use:
34
35     autocmd FileType python map <buffer> <F3> :call Flake8()<CR>
36
37 To add builtins, in your .vimrc:
38
39     let g:flake8_builtins="_,apply"
40
41 To ignore errors, in your .vimrc:
42
43     let g:flake8_ignore="E501,W293"
44
45 If you want to change the max line length for PEP8:
46
47     let g:flake8_max_line_length=99
48
49 To set the maximum [McCabe complexity](https://en.wikipedia.org/wiki/Cyclomatic_complexity) before a warning is issued:
50
51     let g:flake8_max_complexity=10
52
53 To customize the location of your flake8 binary, set `g:flake8_cmd`:
54
55     let g:flake8_cmd="/opt/strangebin/flake8000"
56
57 To customize the location of quick fix window, set `g:flake8_quickfix_location`:
58
59     let g:flake8_quickfix_location="topleft"
60
61 Tips
62 ----
63 A tip might be to run the Flake8 check every time you write a Python file, to
64 enable this, add the following line to your `.vimrc` file (thanks
65 [Godefroid](http://github.com/gotcha)!):
66
67     autocmd BufWritePost *.py call Flake8()
68
69 This plugin goes well together with the following plugin:
70
71 - [PyUnit](http://github.com/nvie/vim-pyunit) (unit test helper under `<F8>`
72   and `<F9>`)
73
74
75 History
76 -------
77
78 1.3: Added the following options:
79
80      - `g:flake8_builtins="_,apply"`
81      - `g:flake8_max_complexity=10`
82
83 1.2: Added the following options:
84
85      - `g:flake8_cmd="/opt/strangebin/flake8000"`
86      - `g:flake8_max_line_length=120`
87      - `g:flake8_ignore="E501,W293"`
88
89 1.1: Added `g:flake8_ignore` option.
90
91 1.0: Initial version.