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.
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).
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).
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.
23 2. Press `<F7>` to run `flake8` on it
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].
28 If any of `g:flake8_show_in_gutter` or `g:flake8_show_in_file` are set to `1`, call:
30 call flake8#Flake8UnplaceMarkers()
32 To remove all markers. No default mapping is provided.
36 If you don't want to use the `<F7>` key for flake8-checking, simply remap it to
37 another key. It autodetects whether it has been remapped and won't register
38 the `<F7>` key if so. For example, to remap it to `<F3>` instead, use:
40 autocmd FileType python map <buffer> <F3> :call Flake8()<CR>
42 To add builtins, in your .vimrc:
44 let g:flake8_builtins="_,apply"
46 To ignore errors, in your .vimrc:
48 let g:flake8_ignore="E501,W293"
50 If you want to change the max line length for PEP8:
52 let g:flake8_max_line_length=99
54 To set the maximum [McCabe complexity](https://en.wikipedia.org/wiki/Cyclomatic_complexity) before a warning is issued:
56 let g:flake8_max_complexity=10
58 To customize the location of your flake8 binary, set `g:flake8_cmd`:
60 let g:flake8_cmd="/opt/strangebin/flake8000"
62 To customize the location of quick fix window, set `g:flake8_quickfix_location`:
64 let g:flake8_quickfix_location="topleft"
66 To customize whether the quickfix window opens, set `g:flake8_show_quickfix`:
68 let g:flake8_show_quickfix=0 " don't show
69 let g:flake8_show_quickfix=1 " show (default)
71 To customize whether the show signs in the gutter, set `g:flake8_show_in_gutter`:
73 let g:flake8_show_in_gutter=0 " don't show (default)
74 let g:flake8_show_in_gutter=1 " show
76 To customize whether the show marks in the file, set `g:flake8_show_in_file`:
78 let g:flake8_show_in_file=0 " don't show (default)
79 let g:flake8_show_in_file=1 " show
81 To customize the number of marks to show, set `g:flake8_max_markers`:
83 let g:flake8_max_markers=500 " (default)
85 To customize the gutter markers, set any of `flake8_error_marker`, `flake8_warning_marker`,
86 `flake8_pyflake_marker`, `flake8_complexity_marker`, `flake8_naming_marker`. Setting one to
87 the empty string disables it. Ex.:
89 flake8_error_marker='EE' " set error marker to 'EE'
90 flake8_warning_marker='WW' " set warning marker to 'WW'
91 flake8_pyflake_marker='' " disable PyFlakes warnings
92 flake8_complexity_marker='' " disable McCabe complexity warnings
93 flake8_naming_marker='' " disable naming warnings
95 To customize the colors used for markers, define the highligth groups, `Flake8_Error`,
96 `Flake8_Warning`, `Flake8_PyFlake`, `Flake8_Complexity`, `Flake8_Naming`:
98 " to use colors defined in the colorscheme
99 highlight link Flake8_Error Error
100 highlight link Flake8_Warning WarningMsg
101 highlight link Flake8_Complexity WarningMsg
102 highlight link Flake8_Naming WarningMsg
103 highlight link Flake8_PyFlake WarningMsg
107 A tip might be to run the Flake8 check every time you write a Python file, to
108 enable this, add the following line to your `.vimrc` file (thanks
109 [Godefroid](http://github.com/gotcha)!):
111 autocmd BufWritePost *.py call Flake8()
113 This plugin goes well together with the following plugin:
115 - [PyUnit](http://github.com/nvie/vim-pyunit) (unit test helper under `<F8>`
122 1.4: Added markers and the option to don't show the quickfix window, also split functions into
123 a autoload file. Added:
126 - `g:flake8_show_quickfix`
127 - `g:flake8_show_in_gutter`
128 - `g:flake8_show_in_file`
129 - `g:flake8_max_markers`
130 - `flake8_error_marker`
131 - `flake8_warning_marker`
132 - `flake8_pyflake_marker`
133 - `flake8_complexity_marker`
134 - `flake8_naming_marker`
136 - `flake8#Flake8UnplaceMarkers()`
141 - `Flake8_Complexity`
145 1.3: Added the following options:
147 - `g:flake8_builtins="_,apply"`
148 - `g:flake8_max_complexity=10`
150 1.2: Added the following options:
152 - `g:flake8_cmd="/opt/strangebin/flake8000"`
153 - `g:flake8_max_line_length=120`
154 - `g:flake8_ignore="E501,W293"`
156 1.1: Added `g:flake8_ignore` option.
158 1.0: Initial version.