12 months ago
flyquickfixmake.vim (Modified to Python-Mode)
1 "" flyquickfixmake.vim (Modified to Python)
3 function! FlyquickfixPrgSet(mode)
4 if a:mode == 0
5 """ setting for pylint
6 setlocal makeprg=/usr/bin/pylint\ --rcfile=$HOME/.pylint\ -e\ %
7 setlocal errorformat=%t:%l:%m
8 echo "flymake prg: pylint"
9 elseif a:mode == 1
10 """ setting for pyflakes
11 setlocal makeprg=/usr/local/bin/pyflakes\ %
12 setlocal errorformat=%f:%l:%m
13 echo "flymake prg: pyflakes"
14 else
15 """ setting for pep8.py
16 setlocal makeprg=/usr/local/bin/pep8.py\ %
17 setlocal errorformat=%f:%l:%c:%m
18 echo "flymake prg: pep8.py"
19 endif
20 endfunction
22 function! FlyquickfixToggleSet()
23 if g:python_flyquickfixmake == 1
24 au! BufWritePost
25 echo "not-used flymake"
26 let g:python_flyquickfixmake = 0
27 else
28 echo "used flymake"
29 let g:python_flyquickfixmake = 1
30 au BufWritePost *.py make
31 endif
32 endfunction
34 if !exists("g:python_flyquickfixmake")
35 let g:python_flyquickfixmake = 1
36 call FlyquickfixPrgSet(8)
37 "au BufWritePost *.py silent make
38 au BufWritePost *.py make
39 endif
41 map fs :call FlyquickfixToggleSet()<CR>
42 map pl :call FlyquickfixPrgSet(0)<CR>
43 map pf :call FlyquickfixPrgSet(1)<CR>
44 map p8 :call FlyquickfixPrgSet(8)<CR>