1" Vim filetype plugin file 2" Language: python 3" Maintainer: Johannes Zellner <[email protected]> 4" Last Change: 2013 Sep 25 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-=:% 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') | finish | endif 30 31fun! <SID>Python_jump(motion) range 32 let cnt = v:count1 33 let save = @/ " save last search pattern 34 mark ' 35 while cnt > 0 36 silent! exe a:motion 37 let cnt = cnt - 1 38 endwhile 39 call histdel('/', -1) 40 let @/ = save " restore last search pattern 41endfun 42 43if has("gui_win32") && !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