aboutsummaryrefslogtreecommitdiff
path: root/vim/after/ftplugin/python.vim
blob: b5071e3b310ce786501276ef1bec6c6389fbc3c7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
" Use pyflakes for syntax checking and autopep8 for tidying
compiler pyflakes
if executable('autopep8')
  setlocal equalprg=autopep8\ -aaa\ --\ -
  let b:undo_ftplugin .= '|setlocal equalprg<'
endif

" Stop here if the user doesn't want ftplugin mappings
if exists('no_plugin_maps') || exists('no_python_maps')
  finish
endif

" Mappings to choose compiler
nnoremap <buffer> <LocalLeader>c
      \ :<C-U>compiler pyflakes<CR>
nnoremap <buffer> <LocalLeader>l
      \ :<C-U>compiler pylint<CR>
let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>c'
      \ . '|nunmap <buffer> <LocalLeader>l'

" Mappings to choose 'equalprg'
nnoremap <buffer> <LocalLeader>t
      \ :<C-U>setlocal equalprg=equalprg=autopep8\ -aaa\ --\ -<CR>
nnoremap <buffer> <LocalLeader>i
      \ :<C-U>setlocal equalprg<<CR>
let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>t'
      \ . '|nunmap <buffer> <LocalLeader>i'