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.
2 " Python filetype plugin for running flake8
3 " Language: Python (ft=python)
4 " Maintainer: Vincent Driessen <vincent@3rdcloud.com>
5 " Version: Vim 7 (may work with lower Vim versions, but not tested)
6 " URL: http://github.com/nvie/vim-flake8
8 " Only do this when not done yet for this buffer
9 if exists("b:loaded_flake8_ftplugin")
12 let b:loaded_flake8_ftplugin=1
14 if !exists("*Flake8()")
16 if exists("g:flake8_cmd")
17 let s:flake8_cmd=g:flake8_cmd
19 let s:flake8_cmd="flake8"
22 if !executable(s:flake8_cmd)
23 echoerr "File " . s:flake8_cmd . " not found. Please install it first."
27 set lazyredraw " delay redrawing
28 cclose " close any existing cwindows
30 " store old grep settings (to restore later)
31 let l:old_gfm=&grepformat
34 " write any changes before continuing
40 if exists("g:flake8_ignore")
41 let s:flake8_ignores=" --ignore=".g:flake8_ignore
43 let s:flake8_ignores=""
46 if exists("g:flake8_max_line_length")
47 let s:flake8_max_line_length=" --max-line-length=".g:flake8_max_line_length
49 let s:flake8_max_line_length=""
52 if exists("g:flake8_max_complexity")
53 let s:flake8_max_complexity=" --max-complexity=".g:flake8_max_complexity
55 let s:flake8_max_complexity=""
58 " perform the grep itself
59 let &grepformat="%f:%l:%c: %m\,%f:%l: %m"
60 let &grepprg=s:flake8_cmd.s:flake8_ignores.s:flake8_max_line_length.s:flake8_max_complexity
63 " restore grep settings
64 let &grepformat=l:old_gfm
68 let has_results=getqflist() != []
70 execute 'belowright copen'
72 nnoremap <buffer> <silent> c :cclose<CR>
73 nnoremap <buffer> <silent> q :cclose<CR>
81 hi Green ctermfg=green
83 echon "Flake8 check OK"
89 " Add mappings, unless the user didn't want this.
90 " The default mapping is registered under to <F7> by default, unless the user
91 " remapped it already (or a mapping exists already for <F7>)
92 if !exists("no_plugin_maps") && !exists("no_flake8_maps")
93 if !hasmapto('Flake8(')
94 noremap <buffer> <F7> :call Flake8()<CR>