techturtle
techturtle

Reputation: 2587

Can you make Visual Studio use tabs instead of spaces for new template files?

I've modified my copy of Visual Studio to keep tabs (instead of spaces) in all my files via Tools => Options => Text Editor => All Languages => Tabs. However, when I create a new project or file, any boilerplate code that Visual Studio includes is always padded with spaces, not tabs (and in cases like web.config, not the specified number of spaces either).

Is there a way to force these all to use tabs automatically when created?

Note: I'm using Visual Studio 2015 Pro, but I suspect other people would be interested in this for other versions as well.

Upvotes: 17

Views: 20459

Answers (2)

noox
noox

Reputation: 839

I'm using the Productivity Power Tools 2017 with "Fixed Mixed Tabs". As soon as I add some own code with a tab indent and save the file I get a warning about "mixed tabs". I then can replace the spaces with a click on the "Tabify" button.

Not perfect, but pretty close.

Upvotes: 2

Jimmy
Jimmy

Reputation: 28386

I don't think you can without modifying the template contents, but if you invoke Format Document (Edit => Advanced => Format Document or the keybinding it shows in the menu) after creating the file it should replace them all according to your settings.

Upvotes: 8

Related Questions