1" Vim filetype plugin file 2" Language: python 3" Maintainer: James Sully <[email protected]> 4" Previous Maintainer: Johannes Zellner <[email protected]> 5" Last Change: Fri, 10 June 2016 6" https://github.com/sullyj3/vim-ftplugin-python 7 8if exists("b:did_ftplugin") | finish | endif 9let b:did_ftplugin = 1 10let s:keepcpo= &cpo 11set cpo&vim 12 13setlocal cinkeys-=0# 14setlocal indentkeys-=0# 15setlocal include=^\\s*\\(from\\\|import\\) 16setlocal includeexpr=substitute(v:fname,'\\.','/','g') 17setlocal suffixesadd=.py 18setlocal comments=b:#,fb:- 19setlocal commentstring=#\ %s 20 21setlocal omnifunc=pythoncomplete#Complete 22 23set wildignore+=*.pyc 24 25nnoremap <silent> <buffer> ]] :call <SID>Python_jump('/^\(class\\|def\)\>')<cr> 26nnoremap <silent> <buffer> [[ :call <SID>Python_jump('?^\(class\\|def\)\>')<cr> 27nnoremap <silent> <buffer> ]m :call <SID>Python_jump('/^\s*\(class\\|def\)\>')<cr> 28nnoremap <silent> <buffer> [m :call <SID>Python_jump('?^\s*\(class\\|def\)\>')<cr> 29 30if !exists('*<SID>Python_jump') 31 fun! <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 41 endfun 42endif 43 44if has("browsefilter") && !exists("b:browsefilter") 45 let b:browsefilter = "Python Files (*.py)\t*.py\n" . 46 \ "All Files (*.*)\t*.*\n" 47endif 48 49" As suggested by PEP8. 50setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=8 51 52" First time: try finding "pydoc". 53if !exists('g:pydoc_executable') 54 if executable('pydoc') 55 let g:pydoc_executable = 1 56 else 57 let g:pydoc_executable = 0 58 endif 59endif 60" If "pydoc" was found use it for keywordprg. 61if g:pydoc_executable 62 setlocal keywordprg=pydoc 63endif 64 65let &cpo = s:keepcpo 66unlet s:keepcpo 67