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, 02 September 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 25noremap <silent> <buffer> ]] :call <SID>Python_jump('n', '\v%$\|^(class\|def)>', 'W')<cr> 26noremap <silent> <buffer> [[ :call <SID>Python_jump('n', '\v^(class\|def)>', 'Wb')<cr> 27noremap <silent> <buffer> ]m :call <SID>Python_jump('n', '\v%$\|^\s*(class\|def)>', 'W')<cr> 28noremap <silent> <buffer> [m :call <SID>Python_jump('n', '\v^\s*(class\|def)>', 'Wb')<cr> 29 30xnoremap <silent> <buffer> ]] :call <SID>Python_jump('x', '\v%$\|^(class\|def)>', 'W')<cr> 31xnoremap <silent> <buffer> [[ :call <SID>Python_jump('x', '\v^(class\|def)>', 'Wb')<cr> 32xnoremap <silent> <buffer> ]m :call <SID>Python_jump('x', '\v%$\|^\s*(class\|def)>', 'W')<cr> 33xnoremap <silent> <buffer> [m :call <SID>Python_jump('x', '\v^\s*(class\|def)>', 'Wb')<cr> 34 35if !exists('*<SID>Python_jump') 36 fun! <SID>Python_jump(mode, motion, flags) range 37 if a:mode == 'x' 38 normal! gv 39 endif 40 41 normal! 0 42 43 let cnt = v:count1 44 mark ' 45 while cnt > 0 46 call search(a:motion, a:flags) 47 let cnt = cnt - 1 48 endwhile 49 50 normal! ^ 51 endfun 52endif 53 54if has("browsefilter") && !exists("b:browsefilter") 55 let b:browsefilter = "Python Files (*.py)\t*.py\n" . 56 \ "All Files (*.*)\t*.*\n" 57endif 58 59" As suggested by PEP8. 60setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=8 61 62" First time: try finding "pydoc". 63if !exists('g:pydoc_executable') 64 if executable('pydoc') 65 let g:pydoc_executable = 1 66 else 67 let g:pydoc_executable = 0 68 endif 69endif 70" If "pydoc" was found use it for keywordprg. 71if g:pydoc_executable 72 setlocal keywordprg=pydoc 73endif 74 75let &cpo = s:keepcpo 76unlet s:keepcpo 77