Monday, April 16

Vim tip of the moment -- Recalling visual selection

I use visual selection quite a bit in vim, it's quite handy for constraining find/replace operations and the usual select+action type of operations. One annoying thing though is that I often want to perform multiple actions to a given text block I have selected, but vim deselects the block after performing an action. This is ok if you just want to repeat the same action, you can just use . (period), but if you want to do something else, that's too bad for you.

Of course there is an easy way to get the previous selection back, I just didn't know about it until now: gv

Just use that to swap the current selection with the last one. Now it's easy to perform a series of actions on a given selection, yay!

1 Comments:

Anonymous Anonymous said...

Very helpful. Thanks for the tip!

2:03 PM  

Post a Comment

<< Home