With the recent update (Nov 2017) of
$VIMRUNTIME/ftplugin/python.vim following ft-specific motions are now available for the python language
[[ Jump backwards to begin of current/previous toplevel
 Jump backwards to end of previous toplevel
][ Jump forwards to end of current toplevel
]] Jump forwards to begin of next toplevel
[m Jump backwards to begin of current/previous method/scope
[M Jump backwards to end of previous method/scope
]M Jump forwards to end of current/next method/scope
]m Jump forwards to begin of next method/scope
Example python file
class previous: # [[[[
pass # 
class current: # [[ or [m...[m[m
def method_first: # [m or [m...[m
pass # [M or [M...[M
def method_previous: # [m[m
pass # [M
def method_current: # [m
# CURSOR <---------------------------
pass # ]M
def method_next: # ]m
pass # ]M]M
def method_last: # ][[m or ]m...]m
pass # ][ or ]M...]M
class previous: # ]] or ]m...]m]m
def global_func: # ]]]]
This update should be included if your vim patch level is at least
If you can't update but want to use this functionality, you can install the most recent version into the
$ curl https://raw.githubusercontent.com/vim/vim/master/runtime/ftplugin/python.vim --create-dirs -o ~/.vim/ftplugin/python.vim
This plugin provides similar motions but slightly modified:
The stock Vim 8.0 "class" motions ("
[[", etc.), find blocks that begin at the first column, regardless of whether or not these are class or function blocks, while its method/function motions ("
]m", etc.) find all blocks at any indent regardless of whether or not these are class or function blocks. In contrast, "Pythonsense" class motions work on finding all and only class definitions, regardless of their indent level, while its method/function motions work on finding all and only method/function definitions, regardless of their indent level.
All details and examples are given at https://github.com/jeetsukumaran/vim-pythonsense#stock-vim-vs-pythonsense-motions.
]], are provided by the default python ftplugin.
]]are useful in some cases but my main problem is I need
][or something like that, which provides jumps to end of next/previous method/class.
]esolves most of my problems, however some mappings in this plugin seems to be broken like
]>I'll try to fix them in a fork and publish it. Though I still wonder what was the plugin that provided
it was really useful.