> i am using visual mode and <shift> >> to indent a block of code.
> the problem i am having is that once i do this, the visual mode is
> gone. So, i have to re-select everything and do it again. Is there a
> command to repeat the last shift ?
> or better yet, is there a better way to shift code right and left ? i
> develop in python, which is white-space sensitive, so this is a rather
> big deal for me to get right.
Well, you can perform the last normal-mode edit by using the
period. This should re-shift another indent.
:help .
If you use visual mode for your selection, you can also prefix a
count, so you can use
3>
to shift 3 indent widths (this only works in visual mode, alas).
:help v_>
If you need to dedent your text after indenting it, you can
reclaim your visual selection by using
gv
in normal mode which will re-highlight your previous selection,
allowing you to hit ">" or "<" to shift the desired direction.
As for a "better" way, the only way(s) to improve on the above
would be to have a known context.
Thus, if you have a "paragraph" of python code (demarcated by
empty[*] lines above and below the block of code), you can use
>ip
followed by "." to repeat the action multiple times (I frequently
use this for my python coding) or
>}
to indent from the current line up to the next empty[*] line.
HTH,
-tim
[*] "empty" being defined by Vim's standards of matching "^$"
rather than "^\s*$" which is an occasional gotcha for me.