0

A related question: Tabbing visual selection in VIM

I want to put tabs to the beginning of a text on VIM. More specifically, what I want to do is the following,

Before:

Lorem ipsum ipsum ipsum
Lorem lorem lorem lorem
Lorem ipsum ipsum ipsum

After:

^ILorem ipsum ipsum ipsum
^ILorem lorem lorem lorem
^ILorem ipsum ipsum ipsum

Note that ^I is the tab character. So, I don't want VIM to use whitespaces to indent my code. What I am doing for now to pursue this is the following,

1. Visually select lines using: <SHIFT + v> jjj 
2. Indent lines using: >

However, this results me the following,

^I^I  Lorem ipsum ipsum ipsum
^I^I  Lorem lorem lorem lorem
^I^I  Lorem ipsum ipsum ipsum

Note that there are two tabs in the beginning of the line and two whitespaces, then Lorem ipsum.. text is starting..

Why do I have '^I^I ' in the beginning of the line and do not have only '^I'?

Community
  • 1
  • 1
Sait
  • 19,045
  • 18
  • 72
  • 99

1 Answers1

0

The default behaviour for VIM is to indent one tabstop per >>. If any other behaviour is present, it is probably because some other setting is present in your .vimrc-file.

If this for some reason is not the case, you can edit this setting yourself by adding set tabstop=0 to your .vimrc-file.

Another tip is to use movements together with you commands. Instead of selecting the lines and press j three times, simply go to the first line and type 3>>. This way the three following lines will be indented.

Brean
  • 246
  • 1
  • 2
  • 10