blob: 2b091a1745f45edaefca4094d44aa03c44e5947d [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim filetype plugin file
2" Language: python
3" Maintainer: Johannes Zellner <johannes@zellner.org>
4" Last Change: Wed, 21 Apr 2004 13:13:08 CEST
5
6if exists("b:did_ftplugin") | finish | endif
7let b:did_ftplugin = 1
Bram Moolenaar9a7224b2012-04-30 15:56:52 +02008let s:keepcpo= &cpo
9set cpo&vim
Bram Moolenaar071d4272004-06-13 20:20:40 +000010
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
Bram Moolenaar18144c82006-04-12 21:52:12 +000019setlocal omnifunc=pythoncomplete#Complete
Bram Moolenaara40ceaf2006-01-13 22:35:40 +000020
Bram Moolenaar071d4272004-06-13 20:20:40 +000021set 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
Bram Moolenaar9a7224b2012-04-30 15:56:52 +020046
47let &cpo = s:keepcpo
48unlet s:keepcpo