Spaces for Newline Indents in Visual Studio

The Problem:

It’s really annoying when Visual Studio shows you this:

But github or vim shows you the same file like this:

If you use the “show whitespace” Visual Studio chord (CTRL-R, CTRL-W), you’ll see that visual studio inserts tabs instead of spaces by default for newline indent:

Visual Studio displays tabs as having the same width as four spaces. But if you’re collaborating with someone working in another text editor like vim, your automatically-inserted tabs will appear larger than four spaces.

The Solution:

Here’s how to make visual studio insert spaces instead of tabs on newline indents: go to Tools->Options->Text Editor->All Languages->Tabs:

That’s better:

Patrick Steadman
Thoughts or questions? Contact us.