6

If I try to indent a code using visual mode or ggVG= vi automatically inserts 2 tabs instead of just 1.

for example:

// inside main
for (int i = 0; i < 10; i++) {
    test += i;
}

changes to:

        for (int i = 0; i < 10; i++) {
                int test = 2;
        }

There are two tabs before for and int. I want a single tab. I have set:

set noexpandtab
set tabstop=4
set softtabstop=0
set smartindent

is there any way to change the two tabs to one?

1 Answers1

9

Your 'shiftwidth' appears to still be set to the default value of 8. Try changing that to 4 to match your 'tabstop' setting:

:set shiftwidth=4

See

:help 'shiftwidth'
garyjohn
  • 6,309
  • 20
  • 21