Search code examples
vim

Tabbing visual selection


In many GUIs when I select a section of text and then hit the Tab or Shift+Tab button the selected section will indent in or out.

In VIM I can select a visual section and then hit the < or > key to change indenting, however once I hit the < key my selection is cleared so I am stuck selecting the section again and hitting < again. This gets really annoying when I am trying to indent something a few stops in and want visual feedback.

Is there anyway to indent stuff in and out in vim while keeping the current selected text selected?

Is there a trick to re-map Tab and Shift+Tab so they behave in this way in visual mode?


Solution

  • vmap <Tab> >gv
    vmap <S-Tab> <gv