Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

migrated from serverfault.com Feb 13 '12 at 1:27

This question came from our site for professional system and network administrators.

    
One is "ts" and the other is "sw", but I can't recall which is which. –  Paul Tomblin 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
add comment

1 Answer 1

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.

share|improve this answer
add comment

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.