The Computer Oracle

Vim visual mode, stay selected

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzling Curiosities

--

Chapters
00:00 Vim Visual Mode, Stay Selected
00:35 Accepted Answer Score 54
00:53 Answer 2 Score 29
01:12 Answer 3 Score 16
01:21 Thank you

--

Full question
https://superuser.com/questions/115038/v...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#keyboardshortcuts #vim #selection #visualmode

#avk47



ACCEPTED ANSWER

Score 54


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




ANSWER 2

Score 29


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.




ANSWER 3

Score 16


Hit the "." (period) in command mode to repeat your last edit.