Mercurial > vim
annotate runtime/ftplugin/python.vim @ 9842:f8396c6e5709 v7.4.2196
commit https://github.com/vim/vim/commit/91c5262b19fd2e558fe87b78c7767c7c5a270be8
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Aug 10 23:02:45 2016 +0200
patch 7.4.2196
Problem: glob2regpat test doesn't test everything on MS-Windows.
Solution: Add patterns with backslash handling.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 10 Aug 2016 23:15:06 +0200 |
parents | 619a98a67f67 |
children | b11ceef7116e |
rev | line source |
---|---|
7 | 1 " Vim filetype plugin file |
2 " Language: python | |
9286
64035abb986b
commit https://github.com/vim/vim/commit/c95a302a4c42ec8230473cd4a5e0064d0a143aa8
Christian Brabandt <cb@256bit.org>
parents:
5663
diff
changeset
|
3 " Maintainer: James Sully <sullyj3@gmail.com> |
64035abb986b
commit https://github.com/vim/vim/commit/c95a302a4c42ec8230473cd4a5e0064d0a143aa8
Christian Brabandt <cb@256bit.org>
parents:
5663
diff
changeset
|
4 " Previous Maintainer: Johannes Zellner <johannes@zellner.org> |
9407
619a98a67f67
commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents:
9286
diff
changeset
|
5 " Last Change: Wed, 29 June 2016 |
9286
64035abb986b
commit https://github.com/vim/vim/commit/c95a302a4c42ec8230473cd4a5e0064d0a143aa8
Christian Brabandt <cb@256bit.org>
parents:
5663
diff
changeset
|
6 " https://github.com/sullyj3/vim-ftplugin-python |
7 | 7 |
8 if exists("b:did_ftplugin") | finish | endif | |
9 let b:did_ftplugin = 1 | |
3496
d1e4abe8342c
Fixed compatible mode in most runtime files.
Bram Moolenaar <bram@vim.org>
parents:
827
diff
changeset
|
10 let s:keepcpo= &cpo |
d1e4abe8342c
Fixed compatible mode in most runtime files.
Bram Moolenaar <bram@vim.org>
parents:
827
diff
changeset
|
11 set cpo&vim |
7 | 12 |
13 setlocal cinkeys-=0# | |
14 setlocal indentkeys-=0# | |
5663
1dea14d4c738
Update runtime files. Add support for systemverilog.
Bram Moolenaar <bram@vim.org>
parents:
5510
diff
changeset
|
15 setlocal include=^\\s*\\(from\\\|import\\) |
7 | 16 setlocal includeexpr=substitute(v:fname,'\\.','/','g') |
17 setlocal suffixesadd=.py | |
5510 | 18 setlocal comments=b:#,fb:- |
19 setlocal commentstring=#\ %s | |
7 | 20 |
827 | 21 setlocal omnifunc=pythoncomplete#Complete |
626 | 22 |
7 | 23 set wildignore+=*.pyc |
24 | |
9407
619a98a67f67
commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents:
9286
diff
changeset
|
25 nnoremap <silent> <buffer> ]] :call <SID>Python_jump('n', '\v%$\|^(class\|def)>', 'W')<cr> |
619a98a67f67
commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents:
9286
diff
changeset
|
26 nnoremap <silent> <buffer> [[ :call <SID>Python_jump('n', '\v^(class\|def)>', 'Wb')<cr> |
619a98a67f67
commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents:
9286
diff
changeset
|
27 nnoremap <silent> <buffer> ]m :call <SID>Python_jump('n', '\v%$\|^\s*(class\|def)>', 'W')<cr> |
619a98a67f67
commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents:
9286
diff
changeset
|
28 nnoremap <silent> <buffer> [m :call <SID>Python_jump('n', '\v^\s*(class\|def)>', 'Wb')<cr> |
619a98a67f67
commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents:
9286
diff
changeset
|
29 |
619a98a67f67
commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents:
9286
diff
changeset
|
30 xnoremap <silent> <buffer> ]] :call <SID>Python_jump('x', '\v%$\|^(class\|def)>', 'W')<cr> |
619a98a67f67
commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents:
9286
diff
changeset
|
31 xnoremap <silent> <buffer> [[ :call <SID>Python_jump('x', '\v^(class\|def)>', 'Wb')<cr> |
619a98a67f67
commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents:
9286
diff
changeset
|
32 xnoremap <silent> <buffer> ]m :call <SID>Python_jump('x', '\v%$\|^\s*(class\|def)>', 'W')<cr> |
619a98a67f67
commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents:
9286
diff
changeset
|
33 xnoremap <silent> <buffer> [m :call <SID>Python_jump('x', '\v^\s*(class\|def)>', 'Wb')<cr> |
7 | 34 |
5510 | 35 if !exists('*<SID>Python_jump') |
9407
619a98a67f67
commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents:
9286
diff
changeset
|
36 fun! <SID>Python_jump(mode, motion, flags) range |
619a98a67f67
commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents:
9286
diff
changeset
|
37 if a:mode == 'x' |
619a98a67f67
commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents:
9286
diff
changeset
|
38 normal! gv |
619a98a67f67
commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents:
9286
diff
changeset
|
39 endif |
619a98a67f67
commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents:
9286
diff
changeset
|
40 |
619a98a67f67
commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents:
9286
diff
changeset
|
41 normal! 0 |
619a98a67f67
commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents:
9286
diff
changeset
|
42 |
5510 | 43 let cnt = v:count1 |
44 mark ' | |
45 while cnt > 0 | |
9407
619a98a67f67
commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents:
9286
diff
changeset
|
46 call search(a:motion, a:flags) |
619a98a67f67
commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents:
9286
diff
changeset
|
47 let cnt = cnt - 1 |
5510 | 48 endwhile |
9407
619a98a67f67
commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents:
9286
diff
changeset
|
49 |
619a98a67f67
commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents:
9286
diff
changeset
|
50 normal! ^ |
5510 | 51 endfun |
52 endif | |
7 | 53 |
5510 | 54 if has("browsefilter") && !exists("b:browsefilter") |
7 | 55 let b:browsefilter = "Python Files (*.py)\t*.py\n" . |
9407
619a98a67f67
commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents:
9286
diff
changeset
|
56 \ "All Files (*.*)\t*.*\n" |
7 | 57 endif |
3496
d1e4abe8342c
Fixed compatible mode in most runtime files.
Bram Moolenaar <bram@vim.org>
parents:
827
diff
changeset
|
58 |
5400 | 59 " As suggested by PEP8. |
60 setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=8 | |
61 | |
62 " First time: try finding "pydoc". | |
63 if !exists('g:pydoc_executable') | |
64 if executable('pydoc') | |
65 let g:pydoc_executable = 1 | |
66 else | |
67 let g:pydoc_executable = 0 | |
68 endif | |
69 endif | |
70 " If "pydoc" was found use it for keywordprg. | |
71 if g:pydoc_executable | |
72 setlocal keywordprg=pydoc | |
73 endif | |
74 | |
3496
d1e4abe8342c
Fixed compatible mode in most runtime files.
Bram Moolenaar <bram@vim.org>
parents:
827
diff
changeset
|
75 let &cpo = s:keepcpo |
d1e4abe8342c
Fixed compatible mode in most runtime files.
Bram Moolenaar <bram@vim.org>
parents:
827
diff
changeset
|
76 unlet s:keepcpo |