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](https://pypi.python.org/pypi/flake8/) is a wrapper around PyFlakes
9 (static syntax checker), PEP8 (style checker) and Ned's MacCabe script
15 Use [vim-pathogen](https://github.com/tpope/vim-pathogen) if you're not using
16 it already. Make sure you've installed the
17 [flake8](https://pypi.python.org/pypi/flake8/) package. Then, simply put the
18 contents of this repository in your `~/.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 For flake8 configuration options please consult the following page:
44 http://flake8.pycqa.org/en/latest/user/configuration.html
46 To customize the location of your flake8 binary, set `g:flake8_cmd`:
48 let g:flake8_cmd="/opt/strangebin/flake8000"
50 To customize the location of quick fix window, set `g:flake8_quickfix_location`:
52 let g:flake8_quickfix_location="topleft"
54 To customize the height of quick fix window, set `g:flake8_quickfix_height`:
56 let g:flake8_quickfix_height=7
58 To customize whether the quickfix window opens, set `g:flake8_show_quickfix`:
60 let g:flake8_show_quickfix=0 " don't show
61 let g:flake8_show_quickfix=1 " show (default)
63 To customize whether the show signs in the gutter, set `g:flake8_show_in_gutter`:
65 let g:flake8_show_in_gutter=0 " don't show (default)
66 let g:flake8_show_in_gutter=1 " show
68 To customize whether the show marks in the file, set `g:flake8_show_in_file`:
70 let g:flake8_show_in_file=0 " don't show (default)
71 let g:flake8_show_in_file=1 " show
73 To customize the number of marks to show, set `g:flake8_max_markers`:
75 let g:flake8_max_markers=500 " (default)
77 To customize the gutter markers, set any of `flake8_error_marker`, `flake8_warning_marker`,
78 `flake8_pyflake_marker`, `flake8_complexity_marker`, `flake8_naming_marker`. Setting one to
79 the empty string disables it. Ex.:
81 flake8_error_marker='EE' " set error marker to 'EE'
82 flake8_warning_marker='WW' " set warning marker to 'WW'
83 flake8_pyflake_marker='' " disable PyFlakes warnings
84 flake8_complexity_marker='' " disable McCabe complexity warnings
85 flake8_naming_marker='' " disable naming warnings
87 To customize the colors used for markers, define the highlight groups, `Flake8_Error`,
88 `Flake8_Warning`, `Flake8_PyFlake`, `Flake8_Complexity`, `Flake8_Naming`:
90 " to use colors defined in the colorscheme
91 highlight link Flake8_Error Error
92 highlight link Flake8_Warning WarningMsg
93 highlight link Flake8_Complexity WarningMsg
94 highlight link Flake8_Naming WarningMsg
95 highlight link Flake8_PyFlake WarningMsg
99 A tip might be to run the Flake8 check every time you write a Python file, to
100 enable this, add the following line to your `.vimrc` file (thanks
101 [Godefroid](https://github.com/gotcha)!):
103 autocmd BufWritePost *.py call Flake8()
105 This plugin goes well together with the following plugin:
107 - [PyUnit](https://github.com/nvie/vim-pyunit) (unit test helper under `<F8>`
114 One particular customization a lot of people like to make is relaxing the
115 maximum line length default. This is a config setting that should be set in
116 flake8 itself. (vim-flake8 "just" invokes it and deals with showing the output
117 in Vim's quickfix window.)
119 To do so, put the following into your `~/.config/flake8` file:
122 max-line-length = 120
127 1.6: Deprecated configuring flake8 options through Vim settings. Instead,
128 advise users to use the `~/.config/flake8` config file.
130 - Decprecated options:
131 - `g:flake8_builtins`
133 - `g:flake8_max_line_length`
134 - `g:flake8_max_complexity`
137 - `g:flake8_quickfix_height`
139 1.5: Added markers and the option to don't show the quickfix window, also split
140 functions into a autoload file. Added:
143 - `g:flake8_show_quickfix`
144 - `g:flake8_show_in_gutter`
145 - `g:flake8_show_in_file`
146 - `g:flake8_max_markers`
147 - `flake8_error_marker`
148 - `flake8_warning_marker`
149 - `flake8_pyflake_marker`
150 - `flake8_complexity_marker`
151 - `flake8_naming_marker`
153 - `flake8#Flake8UnplaceMarkers()`
158 - `Flake8_Complexity`
162 1.4: Suppress output to stdout.
164 1.3: Added the following options:
166 - `g:flake8_builtins="_,apply"`
167 - `g:flake8_max_complexity=10`
169 1.2: Added the following options:
171 - `g:flake8_cmd="/opt/strangebin/flake8000"`
172 - `g:flake8_max_line_length=120`
173 - `g:flake8_ignore="E501,W293"`
175 1.1: Added `g:flake8_ignore` option.
177 1.0: Initial version.
183 Liberally licensed under BSD terms.