Right now, my VIM editor tab indent has some unusual behaviour.

When I am in insert mode and press tab, the cursor indents about 3 spaces instead of a whole tab indent. I like this.

When I high-light a block of text, then press SHIFT and > simultaneously, the block of text indents an entire tab indent instead of 3 spaces behaviour like above. I do not like this.

How do I make the second action behave like the first action?

  • One is "ts" and the other is "sw", but I can't recall which is which. Feb 13 '12 at 1:38
  • :set tabstop=3 shiftwidth=3 with an optional expandtab or noexpandtab. shiftwidth must be the same as tabstop or someone will be cursing your indents.
    – hhaamu
    Feb 13 '12 at 18:08

Myself, I use:

set expandtab
set shiftwidth=4
set smarttab

This replaces tabs with spaces (expandtab), sets both the Tab and > to 4 spaces (shiftwidth). The smarttab settings allows for proper handling of Tab and Backspace based on the shiftwidth value. You can set shiftwidth to whatever you like.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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