ftplugin/python/flyquickfixmake.vim

Tue Jun 01 00:38:26 2010 +0900

author
Hideo Hattori
date
Tue Jun 01 00:38:26 2010 +0900
changeset 22
c2a38fca8fdc
parent 18
d954bcd1b5dc
child 23
a77f8cec1424
permissions
-rw-r--r--

key type re-map

hattori@13 1 "" flyquickfixmake.vim (Modified to Python)
hattori@14 2 "" [Install] copy to $HOME/.vim/ftplugin/python/
hattori@17 3 "" [Require] pylint,pyflakes,pep8(pep8.py)
hattori@13 4
hattori@13 5 function! FlyquickfixPrgSet(mode)
hattori@13 6 if a:mode == 0
hattori@13 7 """ setting for pylint
hattori@13 8 setlocal makeprg=/usr/bin/pylint\ --rcfile=$HOME/.pylint\ -e\ %
hattori@13 9 setlocal errorformat=%t:%l:%m
hattori@18 10 echo "use pylint"
hattori@13 11 elseif a:mode == 1
hattori@13 12 """ setting for pyflakes
hattori@13 13 setlocal makeprg=/usr/local/bin/pyflakes\ %
hattori@13 14 setlocal errorformat=%f:%l:%m
hattori@18 15 echo "use pyflakes"
hattori@13 16 else
hattori@13 17 """ setting for pep8.py
hattori@17 18 setlocal makeprg=/usr/local/bin/pep8\ %
hattori@13 19 setlocal errorformat=%f:%l:%c:%m
hattori@18 20 echo "use pep8"
hattori@13 21 endif
hattori@13 22 endfunction
hattori@13 23
hattori@13 24 function! FlyquickfixToggleSet()
hattori@13 25 if g:python_flyquickfixmake == 1
hattori@13 26 au! BufWritePost
hattori@18 27 echo "not-used checker"
hattori@13 28 let g:python_flyquickfixmake = 0
hattori@13 29 else
hattori@18 30 echo "used checker"
hattori@13 31 let g:python_flyquickfixmake = 1
hattori@13 32 au BufWritePost *.py make
hattori@13 33 endif
hattori@13 34 endfunction
hattori@13 35
Hideo@22 36 function! FlyquickfixTypeToggleSet()
Hideo@22 37 if g:python_flyquickfixmake_type == 0
Hideo@22 38 let g:python_flyquickfixmake_type = 1
Hideo@22 39 call FlyquickfixPrgSet(0)
Hideo@22 40 elseif g:python_flyquickfixmake_type == 1
Hideo@22 41 call FlyquickfixPrgSet(1)
Hideo@22 42 let g:python_flyquickfixmake_type = 2
Hideo@22 43 else
Hideo@22 44 call FlyquickfixPrgSet(8)
Hideo@22 45 let g:python_flyquickfixmake_type = 0
Hideo@22 46 endif
Hideo@22 47 endfunction
Hideo@22 48
hattori@13 49 if !exists("g:python_flyquickfixmake")
hattori@13 50 let g:python_flyquickfixmake = 1
Hideo@22 51 let g:python_flyquickfixmake_type = 0
hattori@13 52 call FlyquickfixPrgSet(8)
hattori@13 53 "au BufWritePost *.py silent make
hattori@13 54 au BufWritePost *.py make
hattori@13 55 endif
hattori@13 56
Hideo@22 57 nmap <C-f> :call FlyquickfixToggleSet()<CR>
Hideo@22 58 nmap <C-p> :call FlyquickfixTypeToggleSet()<CR>

mercurial