1
1
" Vim filetype plugin file
2
2
" Language: python
3
- " Maintainer: Tom Picton <tom@tompicton.co.uk >
3
+ " Maintainer: Tom Picton <tom@tompicton.com >
4
4
" Previous Maintainer: James Sully <[email protected] >
5
5
" Previous Maintainer: Johannes Zellner <[email protected] >
6
- " Last Change: Mon, 5 October 2020
7
- " 2024 Jan 14 by Vim Project (browsefilter)
6
+ " Last Change: 2024/05/11
8
7
" https://github.com/tpict/vim-ftplugin-python
9
8
10
9
if exists (" b:did_ftplugin" ) | finish | endif
@@ -15,7 +14,7 @@ set cpo&vim
15
14
setlocal cinkeys -= 0 #
16
15
setlocal indentkeys -= 0 #
17
16
setlocal include = ^\\ s * \\ (from\\ \| import \\ )
18
- setlocal define = ^\\ s * \\ (def \\ \| class \\ )
17
+ setlocal define = ^\\ s * \\ ([async ] \\ ? def \\ \| class \\ )
19
18
20
19
" For imports with leading .., append / and replace additional .s with ../
21
20
let b: grandparent_match = ' ^\(.\.\)\(\.*\)'
@@ -57,14 +56,14 @@ let b:next_end='\v\S\n*(%$\|^(\s*\n*)*(class\|def\|async def)\|^\S)'
57
56
let b: prev_end= ' \v\S\n*(^(\s*\n*)*(class\|def\|async def)\|^\S)'
58
57
59
58
if ! exists (' g:no_plugin_maps' ) && ! exists (' g:no_python_maps' )
60
- execute " nnoremap <silent> <buffer> ]] :call <SID>Python_jump('n', '" . b: next_toplevel ." ', 'W', v:count1)<cr>"
61
- execute " nnoremap <silent> <buffer> [[ :call <SID>Python_jump('n', '" . b: prev_toplevel ." ', 'Wb', v:count1)<cr>"
62
- execute " nnoremap <silent> <buffer> ][ :call <SID>Python_jump('n', '" . b: next_endtoplevel ." ', 'W', v:count1, 0)<cr>"
63
- execute " nnoremap <silent> <buffer> [] :call <SID>Python_jump('n', '" . b: prev_endtoplevel ." ', 'Wb', v:count1, 0)<cr>"
64
- execute " nnoremap <silent> <buffer> ]m :call <SID>Python_jump('n', '" . b: next ." ', 'W', v:count1)<cr>"
65
- execute " nnoremap <silent> <buffer> [m :call <SID>Python_jump('n', '" . b: prev ." ', 'Wb', v:count1)<cr>"
66
- execute " nnoremap <silent> <buffer> ]M :call <SID>Python_jump('n', '" . b: next_end ." ', 'W', v:count1, 0)<cr>"
67
- execute " nnoremap <silent> <buffer> [M :call <SID>Python_jump('n', '" . b: prev_end ." ', 'Wb', v:count1, 0)<cr>"
59
+ execute " nnoremap <silent> <buffer> ]] :<C-U> call <SID>Python_jump('n', '" . b: next_toplevel ." ', 'W', v:count1)<cr>"
60
+ execute " nnoremap <silent> <buffer> [[ :<C-U> call <SID>Python_jump('n', '" . b: prev_toplevel ." ', 'Wb', v:count1)<cr>"
61
+ execute " nnoremap <silent> <buffer> ][ :<C-U> call <SID>Python_jump('n', '" . b: next_endtoplevel ." ', 'W', v:count1, 0)<cr>"
62
+ execute " nnoremap <silent> <buffer> [] :<C-U> call <SID>Python_jump('n', '" . b: prev_endtoplevel ." ', 'Wb', v:count1, 0)<cr>"
63
+ execute " nnoremap <silent> <buffer> ]m :<C-U> call <SID>Python_jump('n', '" . b: next ." ', 'W', v:count1)<cr>"
64
+ execute " nnoremap <silent> <buffer> [m :<C-U> call <SID>Python_jump('n', '" . b: prev ." ', 'Wb', v:count1)<cr>"
65
+ execute " nnoremap <silent> <buffer> ]M :<C-U> call <SID>Python_jump('n', '" . b: next_end ." ', 'W', v:count1, 0)<cr>"
66
+ execute " nnoremap <silent> <buffer> [M :<C-U> call <SID>Python_jump('n', '" . b: prev_end ." ', 'Wb', v:count1, 0)<cr>"
68
67
69
68
execute " onoremap <silent> <buffer> ]] :call <SID>Python_jump('o', '" . b: next_toplevel ." ', 'W', v:count1)<cr>"
70
69
execute " onoremap <silent> <buffer> [[ :call <SID>Python_jump('o', '" . b: prev_toplevel ." ', 'Wb', v:count1)<cr>"
0 commit comments