1" Vim filetype plugin file 2" Language: python 3" Maintainer: Johannes Zellner <[email protected]> 4" Last Change: 2013 Nov 28 5" Last Change By Johannes: Wed, 21 Apr 2004 13:13:08 CEST 6 7if exists("b:did_ftplugin") | finish | endif 8let b:did_ftplugin = 1 9let s:keepcpo= &cpo 10set cpo&vim 11 12setlocal cinkeys-=0# 13setlocal indentkeys-=0# 14setlocal include=\s*\\(from\\\|import\\) 15setlocal includeexpr=substitute(v:fname,'\\.','/','g') 16setlocal suffixesadd=.py 17setlocal comments=b:#,fb:- 18setlocal commentstring=#\ %s 19 20setlocal omnifunc=pythoncomplete#Complete 21 22set wildignore+=*.pyc 23 24nnoremap <silent> <buffer> ]] :call <SID>Python_jump('/^\(class\\|def\)')<cr> 25nnoremap <silent> <buffer> [[ :call <SID>Python_jump('?^\(class\\|def\)')<cr> 26nnoremap <silent> <buffer> ]m :call <SID>Python_jump('/^\s*\(class\\|def\)')<cr> 27nnoremap <silent> <buffer> [m :call <SID>Python_jump('?^\s*\(class\\|def\)')<cr> 28 29if !exists('*<SID>Python_jump') 30 fun! <SID>Python_jump(motion) range 31 let cnt = v:count1 32 let save = @/ " save last search pattern 33 mark ' 34 while cnt > 0 35 silent! exe a:motion 36 let cnt = cnt - 1 37 endwhile 38 call histdel('/', -1) 39 let @/ = save " restore last search pattern 40 endfun 41endif 42 43if has("browsefilter") && !exists("b:browsefilter") 44 let b:browsefilter = "Python Files (*.py)\t*.py\n" . 45 \ "All Files (*.*)\t*.*\n" 46endif 47 48" As suggested by PEP8. 49setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=8 50 51" First time: try finding "pydoc". 52if !exists('g:pydoc_executable') 53 if executable('pydoc') 54 let g:pydoc_executable = 1 55 else 56 let g:pydoc_executable = 0 57 endif 58endif 59" If "pydoc" was found use it for keywordprg. 60if g:pydoc_executable 61 setlocal keywordprg=pydoc 62endif 63 64let &cpo = s:keepcpo 65unlet s:keepcpo 66