On Apr 19, 2012, at 10:58 PM, Andy Bradford wrote:
> Thus said Dave Smith on Thu, 19 Apr 2012 07:13:13 MDT:
>
>> If I have an existing block of code that I want to wrap in an "if"
>> statement, I have to manually indent the whole block (thank goodness
>> for Vim's Ctrl+v and Shift+i).
>
> No you don't, it's quite easy in vi (not even vim is required for this)
> to mark the beginning of a block, mark the end of the block, and then
> just use an ex command to indent it. For example, insert your if
> expression: and then move to the next line (j), the first part of the
> block, press ma, move to the last part of the block, press mb, then ex
> it with:
>
> :'a,'bs/^/<tab>/
>
> And now you know how to edit and indent blocks of python code with vi
> (and vim if you please). This is no more work than you suggested for
> wrapping C++ code with an if {}.
And how do I jump to the bottom of a Python block?
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/