annotate runtime/ftplugin/python.vim @ 11945:f37815bb7417 v8.0.0852

patch 8.0.0852: MS-Windows: possible crash when giving a message on startup commit https://github.com/vim/vim/commit/1b66c00aeca87913e75012c59c4e969316e2626d Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 3 18:55:00 2017 +0200 patch 8.0.0852: MS-Windows: possible crash when giving a message on startup Problem: MS-Windows: possible crash when giving a message on startup. Solution: Initialize length. (Yasuhiro Matsumoto, closes https://github.com/vim/vim/issues/1931)
author Christian Brabandt <cb@256bit.org>
date Thu, 03 Aug 2017 19:00:05 +0200
parents bdd7fc1a38c0
children 3b26420fc639
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim filetype plugin file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
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>
10261
bdd7fc1a38c0 commit https://github.com/vim/vim/commit/dc08328821a2c11e33dfb1980332e4923ec64fca
Christian Brabandt <cb@256bit.org>
parents: 10153
diff changeset
5 " Last Change: Tue, 09 October 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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 if exists("b:did_ftplugin") | finish | endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 setlocal cinkeys-=0#
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 setlocal includeexpr=substitute(v:fname,'\\.','/','g')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 setlocal suffixesadd=.py
5510
d7d7bac1a163 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5400
diff changeset
18 setlocal comments=b:#,fb:-
d7d7bac1a163 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5400
diff changeset
19 setlocal commentstring=#\ %s
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20
827
fd1b3406fd1c updated for version 7.0d02
vimboss
parents: 626
diff changeset
21 setlocal omnifunc=pythoncomplete#Complete
626
732c7ae5743e updated for version 7.0180
vimboss
parents: 7
diff changeset
22
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 set wildignore+=*.pyc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24
10261
bdd7fc1a38c0 commit https://github.com/vim/vim/commit/dc08328821a2c11e33dfb1980332e4923ec64fca
Christian Brabandt <cb@256bit.org>
parents: 10153
diff changeset
25 let b:next_toplevel='\v%$\|^(class\|def\|async def)>'
bdd7fc1a38c0 commit https://github.com/vim/vim/commit/dc08328821a2c11e33dfb1980332e4923ec64fca
Christian Brabandt <cb@256bit.org>
parents: 10153
diff changeset
26 let b:prev_toplevel='\v^(class\|def\|async def)>'
bdd7fc1a38c0 commit https://github.com/vim/vim/commit/dc08328821a2c11e33dfb1980332e4923ec64fca
Christian Brabandt <cb@256bit.org>
parents: 10153
diff changeset
27 let b:next='\v%$\|^\s*(class\|def\|async def)>'
bdd7fc1a38c0 commit https://github.com/vim/vim/commit/dc08328821a2c11e33dfb1980332e4923ec64fca
Christian Brabandt <cb@256bit.org>
parents: 10153
diff changeset
28 let b:prev='\v^\s*(class\|def\|async def)>'
10153
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 10140
diff changeset
29
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 10140
diff changeset
30 execute "nnoremap <silent> <buffer> ]] :call <SID>Python_jump('n', '". b:next_toplevel."', 'W')<cr>"
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 10140
diff changeset
31 execute "nnoremap <silent> <buffer> [[ :call <SID>Python_jump('n', '". b:prev_toplevel."', 'Wb')<cr>"
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 10140
diff changeset
32 execute "nnoremap <silent> <buffer> ]m :call <SID>Python_jump('n', '". b:next."', 'W')<cr>"
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 10140
diff changeset
33 execute "nnoremap <silent> <buffer> [m :call <SID>Python_jump('n', '". b:prev."', 'Wb')<cr>"
9407
619a98a67f67 commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents: 9286
diff changeset
34
10153
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 10140
diff changeset
35 execute "onoremap <silent> <buffer> ]] :call <SID>Python_jump('o', '". b:next_toplevel."', 'W')<cr>"
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 10140
diff changeset
36 execute "onoremap <silent> <buffer> [[ :call <SID>Python_jump('o', '". b:prev_toplevel."', 'Wb')<cr>"
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 10140
diff changeset
37 execute "onoremap <silent> <buffer> ]m :call <SID>Python_jump('o', '". b:next."', 'W')<cr>"
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 10140
diff changeset
38 execute "onoremap <silent> <buffer> [m :call <SID>Python_jump('o', '". b:prev."', 'Wb')<cr>"
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 10140
diff changeset
39
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 10140
diff changeset
40 execute "xnoremap <silent> <buffer> ]] :call <SID>Python_jump('x', '". b:next_toplevel."', 'W')<cr>"
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 10140
diff changeset
41 execute "xnoremap <silent> <buffer> [[ :call <SID>Python_jump('x', '". b:prev_toplevel."', 'Wb')<cr>"
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 10140
diff changeset
42 execute "xnoremap <silent> <buffer> ]m :call <SID>Python_jump('x', '". b:next."', 'W')<cr>"
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 10140
diff changeset
43 execute "xnoremap <silent> <buffer> [m :call <SID>Python_jump('x', '". b:prev."', 'Wb')<cr>"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44
5510
d7d7bac1a163 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5400
diff changeset
45 if !exists('*<SID>Python_jump')
9407
619a98a67f67 commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents: 9286
diff changeset
46 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
47 if a:mode == 'x'
619a98a67f67 commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents: 9286
diff changeset
48 normal! gv
619a98a67f67 commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents: 9286
diff changeset
49 endif
619a98a67f67 commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents: 9286
diff changeset
50
619a98a67f67 commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents: 9286
diff changeset
51 normal! 0
619a98a67f67 commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents: 9286
diff changeset
52
5510
d7d7bac1a163 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5400
diff changeset
53 let cnt = v:count1
d7d7bac1a163 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5400
diff changeset
54 mark '
d7d7bac1a163 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5400
diff changeset
55 while cnt > 0
9407
619a98a67f67 commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents: 9286
diff changeset
56 call search(a:motion, a:flags)
619a98a67f67 commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents: 9286
diff changeset
57 let cnt = cnt - 1
5510
d7d7bac1a163 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5400
diff changeset
58 endwhile
9407
619a98a67f67 commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents: 9286
diff changeset
59
619a98a67f67 commit https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Christian Brabandt <cb@256bit.org>
parents: 9286
diff changeset
60 normal! ^
5510
d7d7bac1a163 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5400
diff changeset
61 endfun
d7d7bac1a163 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5400
diff changeset
62 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63
5510
d7d7bac1a163 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5400
diff changeset
64 if has("browsefilter") && !exists("b:browsefilter")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 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
66 \ "All Files (*.*)\t*.*\n"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 endif
3496
d1e4abe8342c Fixed compatible mode in most runtime files.
Bram Moolenaar <bram@vim.org>
parents: 827
diff changeset
68
10153
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 10140
diff changeset
69 if !exists("g:python_recommended_style") || g:python_recommended_style != 0
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 10140
diff changeset
70 " As suggested by PEP8.
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 10140
diff changeset
71 setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=8
715d6c5707b8 commit https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455
Christian Brabandt <cb@256bit.org>
parents: 10140
diff changeset
72 endif
5400
173c9c860e42 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 3496
diff changeset
73
173c9c860e42 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 3496
diff changeset
74 " First time: try finding "pydoc".
173c9c860e42 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 3496
diff changeset
75 if !exists('g:pydoc_executable')
173c9c860e42 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 3496
diff changeset
76 if executable('pydoc')
173c9c860e42 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 3496
diff changeset
77 let g:pydoc_executable = 1
173c9c860e42 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 3496
diff changeset
78 else
173c9c860e42 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 3496
diff changeset
79 let g:pydoc_executable = 0
173c9c860e42 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 3496
diff changeset
80 endif
173c9c860e42 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 3496
diff changeset
81 endif
173c9c860e42 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 3496
diff changeset
82 " If "pydoc" was found use it for keywordprg.
173c9c860e42 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 3496
diff changeset
83 if g:pydoc_executable
173c9c860e42 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 3496
diff changeset
84 setlocal keywordprg=pydoc
173c9c860e42 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 3496
diff changeset
85 endif
173c9c860e42 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 3496
diff changeset
86
3496
d1e4abe8342c Fixed compatible mode in most runtime files.
Bram Moolenaar <bram@vim.org>
parents: 827
diff changeset
87 let &cpo = s:keepcpo
d1e4abe8342c Fixed compatible mode in most runtime files.
Bram Moolenaar <bram@vim.org>
parents: 827
diff changeset
88 unlet s:keepcpo