# HG changeset patch # User Christian Brabandt # Date 1715452208 -7200 # Node ID d0498ef60b5bc155e3a69f417bbf9e6cfc0ff0bb # Parent dd9981469bd639b997514e6de0a93beef86c3474 ftplugin(python): E16 fix, async keyword support for define (#14751) Commit: https://github.com/vim/vim/commit/86f6e2c2eed7df2bf5c60cc74d08d7a8d3c75f45 Author: Tom Picton Date: Sat May 11 14:26:06 2024 -0400 ftplugin(python): E16 fix, async keyword support for define (https://github.com/vim/vim/issues/14751) This change includes the following changes: - Fix "E16: Invalid range" when using a count with jump to start/end of class/method - Update define with optional async keyword - Update maintainer email Signed-off-by: Tom Picton Signed-off-by: Christian Brabandt diff --git a/runtime/ftplugin/python.vim b/runtime/ftplugin/python.vim --- a/runtime/ftplugin/python.vim +++ b/runtime/ftplugin/python.vim @@ -1,10 +1,9 @@ " Vim filetype plugin file " Language: python -" Maintainer: Tom Picton +" Maintainer: Tom Picton " Previous Maintainer: James Sully " Previous Maintainer: Johannes Zellner -" Last Change: Mon, 5 October 2020 -" 2024 Jan 14 by Vim Project (browsefilter) +" Last Change: 2024/05/11 " https://github.com/tpict/vim-ftplugin-python if exists("b:did_ftplugin") | finish | endif @@ -15,7 +14,7 @@ set cpo&vim setlocal cinkeys-=0# setlocal indentkeys-=0# setlocal include=^\\s*\\(from\\\|import\\) -setlocal define=^\\s*\\(def\\\|class\\) +setlocal define=^\\s*\\([async ]\\?def\\\|class\\) " For imports with leading .., append / and replace additional .s with ../ let b:grandparent_match = '^\(.\.\)\(\.*\)' @@ -57,14 +56,14 @@ let b:next_end='\v\S\n*(%$\|^(\s*\n*)*(c let b:prev_end='\v\S\n*(^(\s*\n*)*(class\|def\|async def)\|^\S)' if !exists('g:no_plugin_maps') && !exists('g:no_python_maps') - execute "nnoremap ]] :call Python_jump('n', '". b:next_toplevel."', 'W', v:count1)" - execute "nnoremap [[ :call Python_jump('n', '". b:prev_toplevel."', 'Wb', v:count1)" - execute "nnoremap ][ :call Python_jump('n', '". b:next_endtoplevel."', 'W', v:count1, 0)" - execute "nnoremap [] :call Python_jump('n', '". b:prev_endtoplevel."', 'Wb', v:count1, 0)" - execute "nnoremap ]m :call Python_jump('n', '". b:next."', 'W', v:count1)" - execute "nnoremap [m :call Python_jump('n', '". b:prev."', 'Wb', v:count1)" - execute "nnoremap ]M :call Python_jump('n', '". b:next_end."', 'W', v:count1, 0)" - execute "nnoremap [M :call Python_jump('n', '". b:prev_end."', 'Wb', v:count1, 0)" + execute "nnoremap ]] :call Python_jump('n', '". b:next_toplevel."', 'W', v:count1)" + execute "nnoremap [[ :call Python_jump('n', '". b:prev_toplevel."', 'Wb', v:count1)" + execute "nnoremap ][ :call Python_jump('n', '". b:next_endtoplevel."', 'W', v:count1, 0)" + execute "nnoremap [] :call Python_jump('n', '". b:prev_endtoplevel."', 'Wb', v:count1, 0)" + execute "nnoremap ]m :call Python_jump('n', '". b:next."', 'W', v:count1)" + execute "nnoremap [m :call Python_jump('n', '". b:prev."', 'Wb', v:count1)" + execute "nnoremap ]M :call Python_jump('n', '". b:next_end."', 'W', v:count1, 0)" + execute "nnoremap [M :call Python_jump('n', '". b:prev_end."', 'Wb', v:count1, 0)" execute "onoremap ]] :call Python_jump('o', '". b:next_toplevel."', 'W', v:count1)" execute "onoremap [[ :call Python_jump('o', '". b:prev_toplevel."', 'Wb', v:count1)"