Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

So I was looking for a way of indenting multiple lines in vim and someone suggested doing

:map <Tab> <

and all it does is insert the < character whenever I press tab (How did I not see it happen). I tried to do :map <Tab> <Tab> and :map <Tab> \t to bring back regular indenting, with no success. I am new to vim key mapping so I would really appreciate help. Also if someone could point out how to indent multiple lines in vim, that would be awesome.

Thanks in advance!

share|improve this question

migrated from stackoverflow.com Jun 23 '13 at 6:22

This question came from our site for professional and enthusiast programmers.

    
:unmap vim.wikia.com/wiki/Mapping_keys_in_Vim_-_Tutorial_(Part_1) Google is your friend. –  Adam Liss Jun 22 '13 at 21:49
1  
@AdamLiss Google has been my friend, my friend, for so long. –  Grigor Jun 22 '13 at 21:56

2 Answers 2

:unmap <Tab> to get the default behavior back.

use :x>> to indent x number of lines (from where the cursor is)

share|improve this answer
    
:unmap <Tab> doesn't do the trick.. for some reason :/ –  Grigor Jun 22 '13 at 21:54
    
this works for me. –  doubleDown Jun 23 '13 at 1:20
2  
@Grigor In your question you claimed that you used map <Tab> <. To undo this correct command is indeed unmap <Tab>, but the next text (“all it does is insert the < character”) means that original claim is false. There is no way you could insert < with such mapping, but it would be true if you have written imap <Tab> <. This command is undone using iunmap <Tab> (note the i in both commands). To get correct answers you must be precise. –  ZyX Jun 23 '13 at 18:22

This solved the issue to revert back tabbing.

:imap <Tab> <C-t>
:imap <S-Tab> <C-d>

Pressing Tab indents the code, Shift-Tab reverts indentation the code.

share|improve this answer

Your Answer

 
discard

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.