mirror of
https://github.com/gryf/.vim.git
synced 2025-12-18 12:00:30 +01:00
Added pmx specific stuff
This commit is contained in:
69
bundle_pmx/ftplugin/python/common.vim
Normal file
69
bundle_pmx/ftplugin/python/common.vim
Normal file
@@ -0,0 +1,69 @@
|
||||
setlocal cinkeys-=0#
|
||||
setlocal indentkeys-=0#
|
||||
setlocal expandtab
|
||||
setlocal foldlevel=100
|
||||
setlocal foldmethod=indent
|
||||
setlocal list
|
||||
setlocal noautoindent
|
||||
setlocal smartindent
|
||||
setlocal cinwords=if,elif,else,for,while,try,except,finally,def,class,with
|
||||
setlocal smarttab
|
||||
setlocal textwidth=78
|
||||
setlocal colorcolumn=+1
|
||||
" overwrite status line
|
||||
setlocal statusline=%<%F\ %{TagInStatusLine()}\ %h%m%r%=%(%l,%c%V%)\ %3p%%
|
||||
|
||||
set wildignore+=*.pyc
|
||||
|
||||
inoremap # X<BS>#
|
||||
|
||||
"set ofu=syntaxcomplete#Complete
|
||||
|
||||
"autocmd FileType python setlocal omnifunc=pysmell#Complete
|
||||
let python_highlight_all=1
|
||||
|
||||
"I don't want to have pyflakes errors in qfix, it interfering with Pep8/Pylint
|
||||
let g:pyflakes_use_quickfix = 0
|
||||
|
||||
"Load views for py files
|
||||
autocmd BufWinLeave *.py mkview
|
||||
autocmd BufWinEnter *.py silent loadview
|
||||
|
||||
compiler autopylint
|
||||
|
||||
if !exists('*<SID>PyLintBuf')
|
||||
function <SID>PyLintBuf(save_and_close)
|
||||
echohl Statement
|
||||
echo "Running pylint (ctrl-c to cancel) ..."
|
||||
echohl Normal
|
||||
let filename = expand('%:p')
|
||||
let cmd = expand('$VIM') . '\bin\autopylint.py -8 "' . filename . '"'
|
||||
|
||||
if has('win32') || has('win64')
|
||||
let cmd = 'cmd /c ' . cmd
|
||||
endif
|
||||
|
||||
exec "bel silent new " . filename . ".lint"
|
||||
exec "silent! read! " . cmd
|
||||
if a:save_and_close != 0
|
||||
exec "w!"
|
||||
exec "bd"
|
||||
endif
|
||||
endfunction
|
||||
command -bang -nargs=? PyLintBuf call <SID>PyLintBuf(<bang>0)
|
||||
endif
|
||||
map <F6> :PyLintBuf<cr>
|
||||
|
||||
finish "end here. all below is just for the record.
|
||||
|
||||
" Pylint function, which can be optionally mapped to some keys. Currently
|
||||
" not used.
|
||||
if !exists('*<SID>runPyLint')
|
||||
function <SID>runPyLint()
|
||||
echohl Statement
|
||||
echo "Running pylint (ctrl-c to cancel) ..."
|
||||
echohl Normal
|
||||
:Pylint
|
||||
endfunction
|
||||
endif
|
||||
|
||||
55
bundle_pmx/ftplugin/python/pep8.vim
Normal file
55
bundle_pmx/ftplugin/python/pep8.vim
Normal file
@@ -0,0 +1,55 @@
|
||||
if exists("b:did_pdpep8_functions")
|
||||
finish " only load once
|
||||
else
|
||||
let b:did_pdpep8_functions = 1
|
||||
endif
|
||||
|
||||
if !exists('*s:pdPep8')
|
||||
function s:pdPep8()
|
||||
set lazyredraw
|
||||
" Close any existing cwindows.
|
||||
cclose
|
||||
let l:grepformat_save = &grepformat
|
||||
let l:grepprogram_save = &grepprg
|
||||
set grepformat&vim
|
||||
set grepformat&vim
|
||||
let &grepformat = '%f:%l:%m'
|
||||
let &grepprg = 'c:\\Python27\\Scripts\\pep8.exe --repeat --ignore=E111'
|
||||
if &readonly == 0 | update | endif
|
||||
silent! grep! %
|
||||
let &grepformat = l:grepformat_save
|
||||
let &grepprg = l:grepprogram_save
|
||||
let l:mod_total = 0
|
||||
let l:win_count = 1
|
||||
" Determine correct window height
|
||||
windo let l:win_count = l:win_count + 1
|
||||
if l:win_count <= 2 | let l:win_count = 4 | endif
|
||||
windo let l:mod_total = l:mod_total + winheight(0)/l:win_count |
|
||||
\ execute 'resize +'.l:mod_total
|
||||
" Open cwindow
|
||||
execute 'belowright copen '.l:mod_total
|
||||
nnoremap <buffer> <silent> c :cclose<CR>
|
||||
set nolazyredraw
|
||||
redraw!
|
||||
endfunction
|
||||
command! Pep8 call s:pdPep8()
|
||||
endif
|
||||
|
||||
if !exists('*s:pdPep8Buf')
|
||||
function s:pdPep8Buf()
|
||||
echohl Statement
|
||||
echo "Running pep8 (ctrl-c to cancel) ..."
|
||||
echohl Normal
|
||||
let file = expand('%:p')
|
||||
"let cmd = 'pylint --reports=n --output-format=text "' . file . '"'
|
||||
let cmd = 'c:\\Python26\\Scripts\\pep8.exe "' . file . '"'
|
||||
|
||||
if has('win32') || has('win64')
|
||||
let cmd = 'cmd /c "' . cmd . '"'
|
||||
endif
|
||||
|
||||
exec "bel silent new " . file . ".lint"
|
||||
exec "silent! read! " . cmd
|
||||
endfunction
|
||||
command! Pep8buf call s:pdPep8Buf()
|
||||
endif
|
||||
Reference in New Issue
Block a user