Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Current it quits the visual mode after indenting once,which is very annoying.

share|improve this question
For indenting more than once, simply use the . key to repeat the last operation – barbaz Jul 14 '11 at 9:47
up vote 10 down vote accepted

You can use the normal mode command gv to highlight the previous visual selection. Therefore, you could use the following mappings:

:vnoremap < <gv
:vnoremap > >gv

The :vnoremap command sets up a mapping that will work only in visual mode. You are therefore rebinding the < and > visual mode commands to perform the indent and immediately re-select the previous visual selection.

share|improve this answer
It is not correct. Should use vnoremap because vmap will recursively map and it would break – texasbruce Aug 16 '14 at 18:27
@texasbruce: It works fine for me with vmap, however I have edited the answer (and my own .vimrc) to use vnoremap since it is obviously safer. – user89061 Feb 6 '15 at 15:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.