I thought I knew how Vim handles indentation but apparently I was wrong. When I type at the beginning of a line, everything seems to work as expected. However when I type somewhere inside a line, strange things happen.

Suppose my options are set as follows:

set filetype=c
set cindent
set tabstop=8
set shiftwidth=8
set softtabstop=0
set listchars=tab:▸\ ,eol:¬,space:-

That being said I would expect every tab character to have equivalent length of tabstop=8. That is not the case. What happens is this: enter image description here

How can I configure Vim to show every tab character with equivalent length?

1 Answer 1


Tab characters don't have fixed width; that's the purpose.

The original purpose of tabulation is to create neat columns. It's magic: you press one button, and the cursor is automatically at the beginning of the next column. What you define with tabstop is, in reality, the width of those columns; it isn't the width of the tab character.

If you really need equivalent spacing, just add the number of spaces you want. Vim's i, a, o etc. accept counts, so you can just do 8i <Esc> (in Normal mode) to add 8 spaces at current position.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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