vi % alternive command

Paul Wright -$Paul$- at verence.demon.co.uk
Thu Aug 23 08:43:57 EDT 2001


In article <3B8417F8.1B469E91 at bioeng.ucsd.edu>,
Curtis Jensen  <cjensen at bioeng.ucsd.edu> wrote:
>In vi the "%" command will jump to the closing or openeing (,{,[, etc. 
>This is helpful to find the end of blocks (if blocks, function blocks,
>etc).  Has anyone figured out and equivalent commend for vi/vim to jump
>to the end/beginning of a block?  Thanks.

http://vim.sourceforge.net/tips/tip.php?tip_id=103 (which I added
yesterday :-) might be a good place to start. It only works in Vim 6.0
as it needs the search function, and it doesn't do quite what you want:
it is intended to jump to the next/previous line with the same
indentation as the line you're on, so if you're on an "if" you can jump
to the "else" or to the end of the "if" if it has lines following it.

There's also the set of Vim scripts for Python which someone has already
mentioned. I think what you want requires a script rather than a clever
mapping as you need to see where the indentation changes.

-- 
----- Paul Wright ------| "Actually, it is small, scented pieces of petals
-paul.wright at pobox.com--| which are the antichrist and Ian Paisley's
http://pobox.com/~pw201 | cries of 'No Pot-pourri' have been tragically
                        | misunderstood." -- Steven Carr, uk.religion.christian



More information about the Python-list mailing list