Vim visual mode, stay selected
Solution 1
There isn't a way to leave it selected, but there is a way to get the same selection back without all that manual labour. Select your stuff, do what you need (let's say, indent it), it will unselect itself, then gv
Solution 2
Add these two (three with comment) lines to your .vimrc (_vimrc for windows):
"make < > shifts keep selection
vnoremap < <gv
vnoremap > >gv
They cause the shift commands to reselect the visual area after use. VERY handy.
Solution 3
Hit the "." (period) in command mode to repeat your last edit.
Related videos on Youtube
PATIL DADA
Updated on September 17, 2022Comments
-
PATIL DADA almost 2 years
I love vim's visual mode. However when I select some text then do something to it the text is then unselected.
For example lets say that I select a block of code and indent it the code is then unselected so if you pressed
4 >
instead of5 >
then you have to reselect the code to indent it one more tab.Is there anyway to not deselect a block of code after preforming an operation? Alternately is there a way to select the same code again (with one keystroke) after an operation has been preformed?