'Insert tabs instead of spaces

In my C++ document, I want to insert a tab when I press tab. Under Tools > Options > Text Editor > C/C++ > Tabs I chose to Keep tabs. However, when I press tab, Visual Studio still inserts 4 spaces. This seems to be because I used spaces in a previous section of the file.

How do I disable this "smart" insertion of spaces, just using tabs all the time?



Solution 1:[1]

For me it started adding tabs when I made Indent size same as Tab size:

enter image description here

Solution 2:[2]

Open settings by pressing Ctrl+,

search for "Detect Indentation"

Uncheck the check box

Then uncheck the "Insert spaces" check box also.

Working fine for me.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Karlas
Solution 2 delcin