Reputation: 57899
I'm using GVIM on Windows, if it matters.
I often select a block, do something, and then need to do something else with the same block, but of course once I do anything with the block, I'm out of visual mode.
Is there a way to re-select or act on the previously selected visual block?
Upvotes: 11
Views: 1271
Reputation: 42198
If you have just pasted a visual block, there is also a way to reselect it easily.
See the following question and answers on SO.
Upvotes: 1
Reputation: 56390
gv as Joe pointed out does the trick (+1), but an extra tip as well is if you do a :s
with a visual selection, it will automatically populate the marks '<
and '>
and those will persist until you make another visual selection. So, you can do :'<,'>s/foo/bar/
without having to go back into visual mode and it will still apply to the same range. Same thing with anything else that uses those marks.
Upvotes: 8