]> git.madduck.net Git - etc/vim.git/blob - ftplugin/python_flake8.vim

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:

Merge pull request #31 from amacfie/patch-1
[etc/vim.git] / ftplugin / python_flake8.vim
1 "
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
7 "
8 " Only do this when not done yet for this buffer
9 if exists("b:loaded_flake8_ftplugin")
10     finish
11 endif
12 let b:loaded_flake8_ftplugin=1
13
14 let s:save_cpo = &cpo
15 set cpo&vim
16
17 "" Highlight groups for errors
18 " pep8 errors
19 highlight default Flake8_Error
20             \ ctermbg=DarkRed ctermfg=Red cterm=bold
21             \ guibg=DarkRed   guifg=Red   gui=bold
22 " pep8 warnings
23 highlight default Flake8_Warning
24             \ ctermbg=Yellow ctermfg=DarkYellow cterm=bold
25             \ guibg=Yellow   guifg=DarkYellow   gui=bold
26 " PyFlakes codes
27 highlight default Flake8_PyFlake
28             \ ctermbg=DarkBlue ctermfg=Blue cterm=bold
29             \ guibg=DarkBlue   guifg=Blue   gui=bold
30 " McCabe complexity warnings
31 highlight default Flake8_Complexity
32             \ ctermbg=DarkBlue ctermfg=Blue cterm=bold
33             \ guibg=DarkBlue   guifg=Blue   gui=bold
34 " naming conventions
35 highlight default Flake8_Naming
36             \ ctermbg=DarkBlue ctermfg=Blue cterm=bold
37             \ guibg=DarkBlue   guifg=Blue   gui=bold
38
39 " to not break with old versions
40 function! Flake8()
41     call flake8#Flake8()
42 endfunction
43
44 " Add mappings, unless the user didn't want this.
45 " The default mapping is registered under to <F7> by default, unless the user
46 " remapped it already (or a mapping exists already for <F7>)
47 if !exists("no_plugin_maps") && !exists("no_flake8_maps")
48     if !hasmapto('Flake8(') && !hasmapto('flake8#Flake8(')
49         noremap <buffer> <F7> :call flake8#Flake8()<CR>
50     endif
51 endif
52
53 let &cpo = s:save_cpo
54 unlet s:save_cpo
55