xref: /vim-8.2.3635/runtime/ftplugin/python.vim (revision 9a7224b5)
1" Vim filetype plugin file
2" Language:	python
3" Maintainer:	Johannes Zellner <[email protected]>
4" Last Change:	Wed, 21 Apr 2004 13:13:08 CEST
5
6if exists("b:did_ftplugin") | finish | endif
7let b:did_ftplugin = 1
8let s:keepcpo= &cpo
9set cpo&vim
10
11setlocal cinkeys-=0#
12setlocal indentkeys-=0#
13setlocal include=\s*\\(from\\\|import\\)
14setlocal includeexpr=substitute(v:fname,'\\.','/','g')
15setlocal suffixesadd=.py
16setlocal comments-=:%
17setlocal commentstring=#%s
18
19setlocal omnifunc=pythoncomplete#Complete
20
21set wildignore+=*.pyc
22
23nnoremap <silent> <buffer> ]] :call <SID>Python_jump('/^\(class\\|def\)')<cr>
24nnoremap <silent> <buffer> [[ :call <SID>Python_jump('?^\(class\\|def\)')<cr>
25nnoremap <silent> <buffer> ]m :call <SID>Python_jump('/^\s*\(class\\|def\)')<cr>
26nnoremap <silent> <buffer> [m :call <SID>Python_jump('?^\s*\(class\\|def\)')<cr>
27
28if exists('*<SID>Python_jump') | finish | endif
29
30fun! <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
40endfun
41
42if has("gui_win32") && !exists("b:browsefilter")
43    let b:browsefilter = "Python Files (*.py)\t*.py\n" .
44		       \ "All Files (*.*)\t*.*\n"
45endif
46
47let &cpo = s:keepcpo
48unlet s:keepcpo
49