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

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

mercurial