Reputation: 3583
Let's say that I've got the following text:
This allows you to select some text using Vim's visual mode
With the cursor on the 'a' in 'allows'. If I type vaw I switch to visual mode and then select "a word" ("allows "). If I repeat the aw then Vim also selects the "you ". Let's say I do this once more (highlighting "to ") and then realize that I've gone too far.
Is there a way to shrink/reduce the size of the visual area (other than using the h,j,k,l keys)?
I'd love to be able to either 'undo' my last command (i.e., have Vim move the selection back to before I typed that last 'aw') or else use the motion/text object commands to reduce the size of the visual area.
Upvotes: 4
Views: 759
Reputation: 3063
Based on your post (and on this one), I decided to make the vim-visual-history plugin that keeps
a traversable record of previous visual selections with [v
, ]v
, [V
and ]V
. So
in your case, you would just do [v
to go back one selection. You can keep on pressing [v
to go back further in time, and use ]v
to go forwards again. The plugin works for your case, and also selections using text objects etc.
[count][v : Reselect previous visual selection
[count]]v : Reselect next visual selection
[V : Reselect first visual selection
]V : Reselect last visual selection
You can also give a count to jump through the history faster:
Upvotes: 0