python_match.vim : Extend the % motion and define g%, [%, and ]% motions for Python files
| script karma
Downloaded by 4454
Comments, bugs, improvements
script versions (upload new version)
|This script redefines the % motion so that (in addition to its usual behavior)
it cycles through if/elif/else, try/except/catch, for/continue/break, and
while/continue/break structures. The script also
defines g% to cycle in the opposite direction. Two other motions, [% and ]%,
go to the start and end of the current block, respectively.
All of these motions should work in Normal, Visual, and Operator-pending
modes. For example, d]% should delete (characterwise) until the end of the
current block; v]%d should do the same, going through Visual mode so that
you can see what is being deleted; and V]%d makes it linewise.
|Copy the file to your ftplugin/ directory. If, for some reason, you want to
change the name of the file, copy it to ftplugin/python/ or :source it from
Click on the package to download.
ip used for rating: 18.104.22.168
||I added support for for and while loops: % and g% go between the start of the block and either break or continue lines.
I reorganized the code and made several minor improvements. For example, [% and ]% now accept a count, `` goes back to where you started, and g% does nothing (insteadof acting like the default %) if the cursor starts on a line that does not begin with a recognized key word.