Mercurial > vim
comparison runtime/ftplugin/python.vim @ 16086:bd7461db24b3
Update runtime files.
commit https://github.com/vim/vim/commit/63b74a8362b14576b21d342dc424d0396ca8ea27
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Mar 24 15:09:13 2019 +0100
Update runtime files.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 24 Mar 2019 15:15:06 +0100 |
parents | a62eeee5f116 |
children | 17c4178f26ea |
comparison
equal
deleted
inserted
replaced
16085:9ee6ccf783f3 | 16086:bd7461db24b3 |
---|---|
1 " Vim filetype plugin file | 1 " Vim filetype plugin file |
2 " Language: python | 2 " Language: python |
3 " Maintainer: Tom Picton <tom@tompicton.co.uk> | 3 " Maintainer: Tom Picton <tom@tompicton.co.uk> |
4 " Previous Maintainer: James Sully <sullyj3@gmail.com> | 4 " Previous Maintainer: James Sully <sullyj3@gmail.com> |
5 " Previous Maintainer: Johannes Zellner <johannes@zellner.org> | 5 " Previous Maintainer: Johannes Zellner <johannes@zellner.org> |
6 " Last Change: Sun, 15 April 2018 | 6 " Last Change: Sun 17 Mar 2019 |
7 " https://github.com/tpict/vim-ftplugin-python | 7 " https://github.com/tpict/vim-ftplugin-python |
8 | 8 |
9 if exists("b:did_ftplugin") | finish | endif | 9 if exists("b:did_ftplugin") | finish | endif |
10 let b:did_ftplugin = 1 | 10 let b:did_ftplugin = 1 |
11 let s:keepcpo= &cpo | 11 let s:keepcpo= &cpo |
35 | 35 |
36 setlocal suffixesadd=.py | 36 setlocal suffixesadd=.py |
37 setlocal comments=b:#,fb:- | 37 setlocal comments=b:#,fb:- |
38 setlocal commentstring=#\ %s | 38 setlocal commentstring=#\ %s |
39 | 39 |
40 setlocal omnifunc=pythoncomplete#Complete | |
41 if has('python3') | 40 if has('python3') |
42 setlocal omnifunc=python3complete#Complete | 41 setlocal omnifunc=python3complete#Complete |
42 elseif has('python') | |
43 setlocal omnifunc=pythoncomplete#Complete | |
43 endif | 44 endif |
44 | 45 |
45 set wildignore+=*.pyc | 46 set wildignore+=*.pyc |
46 | 47 |
47 let b:next_toplevel='\v%$\|^(class\|def\|async def)>' | 48 let b:next_toplevel='\v%$\|^(class\|def\|async def)>' |
51 let b:next='\v%$\|^\s*(class\|def\|async def)>' | 52 let b:next='\v%$\|^\s*(class\|def\|async def)>' |
52 let b:prev='\v^\s*(class\|def\|async def)>' | 53 let b:prev='\v^\s*(class\|def\|async def)>' |
53 let b:next_end='\v\S\n*(%$\|^(\s*\n*)*(class\|def\|async def)\|^\S)' | 54 let b:next_end='\v\S\n*(%$\|^(\s*\n*)*(class\|def\|async def)\|^\S)' |
54 let b:prev_end='\v\S\n*(^(\s*\n*)*(class\|def\|async def)\|^\S)' | 55 let b:prev_end='\v\S\n*(^(\s*\n*)*(class\|def\|async def)\|^\S)' |
55 | 56 |
56 execute "nnoremap <silent> <buffer> ]] :call <SID>Python_jump('n', '". b:next_toplevel."', 'W', v:count1)<cr>" | 57 if !exists('g:no_plugin_maps') && !exists('g:no_python_maps') |
57 execute "nnoremap <silent> <buffer> [[ :call <SID>Python_jump('n', '". b:prev_toplevel."', 'Wb', v:count1)<cr>" | 58 execute "nnoremap <silent> <buffer> ]] :call <SID>Python_jump('n', '". b:next_toplevel."', 'W', v:count1)<cr>" |
58 execute "nnoremap <silent> <buffer> ][ :call <SID>Python_jump('n', '". b:next_endtoplevel."', 'W', 0, v:count1)<cr>" | 59 execute "nnoremap <silent> <buffer> [[ :call <SID>Python_jump('n', '". b:prev_toplevel."', 'Wb', v:count1)<cr>" |
59 execute "nnoremap <silent> <buffer> [] :call <SID>Python_jump('n', '". b:prev_endtoplevel."', 'Wb', 0, v:count1)<cr>" | 60 execute "nnoremap <silent> <buffer> ][ :call <SID>Python_jump('n', '". b:next_endtoplevel."', 'W', v:count1, 0)<cr>" |
60 execute "nnoremap <silent> <buffer> ]m :call <SID>Python_jump('n', '". b:next."', 'W', v:count1)<cr>" | 61 execute "nnoremap <silent> <buffer> [] :call <SID>Python_jump('n', '". b:prev_endtoplevel."', 'Wb', v:count1, 0)<cr>" |
61 execute "nnoremap <silent> <buffer> [m :call <SID>Python_jump('n', '". b:prev."', 'Wb', v:count1)<cr>" | 62 execute "nnoremap <silent> <buffer> ]m :call <SID>Python_jump('n', '". b:next."', 'W', v:count1)<cr>" |
62 execute "nnoremap <silent> <buffer> ]M :call <SID>Python_jump('n', '". b:next_end."', 'W', 0, v:count1)<cr>" | 63 execute "nnoremap <silent> <buffer> [m :call <SID>Python_jump('n', '". b:prev."', 'Wb', v:count1)<cr>" |
63 execute "nnoremap <silent> <buffer> [M :call <SID>Python_jump('n', '". b:prev_end."', 'Wb', 0, v:count1)<cr>" | 64 execute "nnoremap <silent> <buffer> ]M :call <SID>Python_jump('n', '". b:next_end."', 'W', v:count1, 0)<cr>" |
64 | 65 execute "nnoremap <silent> <buffer> [M :call <SID>Python_jump('n', '". b:prev_end."', 'Wb', v:count1, 0)<cr>" |
65 execute "onoremap <silent> <buffer> ]] :call <SID>Python_jump('o', '". b:next_toplevel."', 'W', v:count1)<cr>" | 66 |
66 execute "onoremap <silent> <buffer> [[ :call <SID>Python_jump('o', '". b:prev_toplevel."', 'Wb', v:count1)<cr>" | 67 execute "onoremap <silent> <buffer> ]] :call <SID>Python_jump('o', '". b:next_toplevel."', 'W', v:count1)<cr>" |
67 execute "onoremap <silent> <buffer> ][ :call <SID>Python_jump('o', '". b:next_endtoplevel."', 'W', 0, v:count1)<cr>" | 68 execute "onoremap <silent> <buffer> [[ :call <SID>Python_jump('o', '". b:prev_toplevel."', 'Wb', v:count1)<cr>" |
68 execute "onoremap <silent> <buffer> [] :call <SID>Python_jump('o', '". b:prev_endtoplevel."', 'Wb', 0, v:count1)<cr>" | 69 execute "onoremap <silent> <buffer> ][ :call <SID>Python_jump('o', '". b:next_endtoplevel."', 'W', v:count1, 0)<cr>" |
69 execute "onoremap <silent> <buffer> ]m :call <SID>Python_jump('o', '". b:next."', 'W', v:count1)<cr>" | 70 execute "onoremap <silent> <buffer> [] :call <SID>Python_jump('o', '". b:prev_endtoplevel."', 'Wb', v:count1, 0)<cr>" |
70 execute "onoremap <silent> <buffer> [m :call <SID>Python_jump('o', '". b:prev."', 'Wb', v:count1)<cr>" | 71 execute "onoremap <silent> <buffer> ]m :call <SID>Python_jump('o', '". b:next."', 'W', v:count1)<cr>" |
71 execute "onoremap <silent> <buffer> ]M :call <SID>Python_jump('o', '". b:next_end."', 'W', 0, v:count1)<cr>" | 72 execute "onoremap <silent> <buffer> [m :call <SID>Python_jump('o', '". b:prev."', 'Wb', v:count1)<cr>" |
72 execute "onoremap <silent> <buffer> [M :call <SID>Python_jump('o', '". b:prev_end."', 'Wb', 0, v:count1)<cr>" | 73 execute "onoremap <silent> <buffer> ]M :call <SID>Python_jump('o', '". b:next_end."', 'W', v:count1, 0)<cr>" |
73 | 74 execute "onoremap <silent> <buffer> [M :call <SID>Python_jump('o', '". b:prev_end."', 'Wb', v:count1, 0)<cr>" |
74 execute "xnoremap <silent> <buffer> ]] :call <SID>Python_jump('x', '". b:next_toplevel."', 'W', v:count1)<cr>" | 75 |
75 execute "xnoremap <silent> <buffer> [[ :call <SID>Python_jump('x', '". b:prev_toplevel."', 'Wb', v:count1)<cr>" | 76 execute "xnoremap <silent> <buffer> ]] :call <SID>Python_jump('x', '". b:next_toplevel."', 'W', v:count1)<cr>" |
76 execute "xnoremap <silent> <buffer> ][ :call <SID>Python_jump('x', '". b:next_endtoplevel."', 'W', 0, v:count1)<cr>" | 77 execute "xnoremap <silent> <buffer> [[ :call <SID>Python_jump('x', '". b:prev_toplevel."', 'Wb', v:count1)<cr>" |
77 execute "xnoremap <silent> <buffer> [] :call <SID>Python_jump('x', '". b:prev_endtoplevel."', 'Wb', 0, v:count1)<cr>" | 78 execute "xnoremap <silent> <buffer> ][ :call <SID>Python_jump('x', '". b:next_endtoplevel."', 'W', v:count1, 0)<cr>" |
78 execute "xnoremap <silent> <buffer> ]m :call <SID>Python_jump('x', '". b:next."', 'W', v:count1)<cr>" | 79 execute "xnoremap <silent> <buffer> [] :call <SID>Python_jump('x', '". b:prev_endtoplevel."', 'Wb', v:count1, 0)<cr>" |
79 execute "xnoremap <silent> <buffer> [m :call <SID>Python_jump('x', '". b:prev."', 'Wb', v:count1)<cr>" | 80 execute "xnoremap <silent> <buffer> ]m :call <SID>Python_jump('x', '". b:next."', 'W', v:count1)<cr>" |
80 execute "xnoremap <silent> <buffer> ]M :call <SID>Python_jump('x', '". b:next_end."', 'W', 0, v:count1)<cr>" | 81 execute "xnoremap <silent> <buffer> [m :call <SID>Python_jump('x', '". b:prev."', 'Wb', v:count1)<cr>" |
81 execute "xnoremap <silent> <buffer> [M :call <SID>Python_jump('x', '". b:prev_end."', 'Wb', 0, v:count1)<cr>" | 82 execute "xnoremap <silent> <buffer> ]M :call <SID>Python_jump('x', '". b:next_end."', 'W', v:count1, 0)<cr>" |
83 execute "xnoremap <silent> <buffer> [M :call <SID>Python_jump('x', '". b:prev_end."', 'Wb', v:count1, 0)<cr>" | |
84 endif | |
82 | 85 |
83 if !exists('*<SID>Python_jump') | 86 if !exists('*<SID>Python_jump') |
84 fun! <SID>Python_jump(mode, motion, flags, count, ...) range | 87 fun! <SID>Python_jump(mode, motion, flags, count, ...) range |
85 let l:startofline = (a:0 >= 1) ? a:1 : 1 | 88 let l:startofline = (a:0 >= 1) ? a:1 : 1 |
86 | 89 |
121 let g:pydoc_executable = 1 | 124 let g:pydoc_executable = 1 |
122 else | 125 else |
123 let g:pydoc_executable = 0 | 126 let g:pydoc_executable = 0 |
124 endif | 127 endif |
125 endif | 128 endif |
129 | |
130 " Windows-specific pydoc setup | |
131 if has('win32') || has('win64') | |
132 if executable('python') | |
133 " available as Tools\scripts\pydoc.py | |
134 let g:pydoc_executable = 1 | |
135 else | |
136 let g:pydoc_executable = 0 | |
137 endif | |
138 endif | |
139 | |
126 " If "pydoc" was found use it for keywordprg. | 140 " If "pydoc" was found use it for keywordprg. |
127 if g:pydoc_executable | 141 if g:pydoc_executable |
128 setlocal keywordprg=pydoc | 142 if has('win32') || has('win64') |
129 endif | 143 setlocal keywordprg=python\ -m\ pydoc\ |
144 else | |
145 setlocal keywordprg=pydoc | |
146 endif | |
147 endif | |
148 | |
149 " Script for filetype switching to undo the local stuff we may have changed | |
150 let b:undo_ftplugin = 'setlocal cinkeys<' | |
151 \ . '|setlocal comments<' | |
152 \ . '|setlocal commentstring<' | |
153 \ . '|setlocal expandtab<' | |
154 \ . '|setlocal include<' | |
155 \ . '|setlocal includeexpr<' | |
156 \ . '|setlocal indentkeys<' | |
157 \ . '|setlocal keywordprg<' | |
158 \ . '|setlocal omnifunc<' | |
159 \ . '|setlocal shiftwidth<' | |
160 \ . '|setlocal softtabstop<' | |
161 \ . '|setlocal suffixesadd<' | |
162 \ . '|setlocal tabstop<' | |
163 \ . '|silent! nunmap <buffer> [M' | |
164 \ . '|silent! nunmap <buffer> [[' | |
165 \ . '|silent! nunmap <buffer> []' | |
166 \ . '|silent! nunmap <buffer> [m' | |
167 \ . '|silent! nunmap <buffer> ]M' | |
168 \ . '|silent! nunmap <buffer> ][' | |
169 \ . '|silent! nunmap <buffer> ]]' | |
170 \ . '|silent! nunmap <buffer> ]m' | |
171 \ . '|silent! ounmap <buffer> [M' | |
172 \ . '|silent! ounmap <buffer> [[' | |
173 \ . '|silent! ounmap <buffer> []' | |
174 \ . '|silent! ounmap <buffer> [m' | |
175 \ . '|silent! ounmap <buffer> ]M' | |
176 \ . '|silent! ounmap <buffer> ][' | |
177 \ . '|silent! ounmap <buffer> ]]' | |
178 \ . '|silent! ounmap <buffer> ]m' | |
179 \ . '|silent! xunmap <buffer> [M' | |
180 \ . '|silent! xunmap <buffer> [[' | |
181 \ . '|silent! xunmap <buffer> []' | |
182 \ . '|silent! xunmap <buffer> [m' | |
183 \ . '|silent! xunmap <buffer> ]M' | |
184 \ . '|silent! xunmap <buffer> ][' | |
185 \ . '|silent! xunmap <buffer> ]]' | |
186 \ . '|silent! xunmap <buffer> ]m' | |
187 \ . '|unlet! b:browsefilter' | |
188 \ . '|unlet! b:child_match' | |
189 \ . '|unlet! b:child_sub' | |
190 \ . '|unlet! b:grandparent_match' | |
191 \ . '|unlet! b:grandparent_sub' | |
192 \ . '|unlet! b:next' | |
193 \ . '|unlet! b:next_end' | |
194 \ . '|unlet! b:next_endtoplevel' | |
195 \ . '|unlet! b:next_toplevel' | |
196 \ . '|unlet! b:parent_match' | |
197 \ . '|unlet! b:parent_sub' | |
198 \ . '|unlet! b:prev' | |
199 \ . '|unlet! b:prev_end' | |
200 \ . '|unlet! b:prev_endtoplevel' | |
201 \ . '|unlet! b:prev_toplevel' | |
202 \ . '|unlet! b:undo_ftplugin' | |
130 | 203 |
131 let &cpo = s:keepcpo | 204 let &cpo = s:keepcpo |
132 unlet s:keepcpo | 205 unlet s:keepcpo |