Navigation

Thursday 14 March 2019

How many Tabs do I get after striking Tab key under VIM Insert mode?

 How many Tabs do I get after striking Tab key under VIM Insert mode?
I am learning C programming.
I met a problem about vim configuration.
The following is my vim setting written in .vimrc
set nu
set shiftwidth=4
set tabstop=4
set softtabstop=8
set autoindent
set cindent
set smartindent
syntax on
In order to see where the tabs are, I have used :set list
#include <stdio.h>$
int main(void)$
{$
^Iprintf("ab\n");$
^Ireturn 0;$ 
}$
Now in line 4 under Insert mode, I want to see how many tabs I can get after I strike Tab key in diferent locations.
Here's the result:
When I strike Tab key after n, I get ^Iprin^I^Itf("ab\n");$
When I strike Tab key after \n, I get ^Iprintf("ab\n^I^I");$
The above two situations are quite understandable to me.
But when I strike Tab key after a, I get ^Iprintf("a^Ib\n");$
This is beyond my understanding.
Can anybody explain why there is only one tab replaced?
I thought there should be two because softtabstop takes up 8 spaces which is two times tabstop (4).

No comments:

Post a Comment