vim visual mode learnings
There is always something new to learn in VIM. That is part of the fun. Today, I share two features I recently discovered.
First, o in visual mode.
To motivate this move, imagine a situation that I sometimes find myself in. I have just written a block of code and decide that its current spot is no good. Perhaps, I want to extract it into its own method. So I hop into visual mode, hit j a few times, and just before I smack that d key I realize I started one line too late. Ugh. I hit escape, move to the correct starting point this time, and repeat. As it turns out, I didn’t have to totally scrap my visual selection to grab the line I wanted. When you have a block of text selected you can press the o key to toggle between the top and bottom of the selection. This works in visual block mode as well.

The other tidbit I have to share with you comes from the grab bag of commands in VIM’s g family. The command is gv. From the vimdocs:
gv Start Visual mode with the same area
as the previous area and the same
mode.
In Visual mode the current and the
previous Visual area are exchanged.
After using "p" or "P" in Visual mode
the text that was put will be
selected.
Put succinctly, press gv to reselect your last visual selection.

Happy VIMing!