Using gg=G in Vim to automatically tab a document when tabstop is modified

Viewed 2391

Usually, one uses gg=G in vim to automatically tab C/C++/Java code or in fact any sort of code.

However, I changed my tabstop variable to be tabstop=2 in my default settings for vim, so that whenever I tab I get the equivalent of 2 spaces instead of the default 8.

Now whenever I use gg=G, I get 4 tabs instead of 1 for indentation so that the spacing looks equivalent to before when I had tabstop=8. I just want 1 tab though. Is there a way to do this?

(I am using hard tabs only for indentation, no spaces).

2 Answers
Related