Tuesday, December 22, 2009

Tabs or Spaces

Some programmers have strong opinions about whether to use tabs or spaces to indent code.
This is what I use. In Visual Studio 2017 choose
Tools\Options\Text Editor\All Languages\Tabs
Select Smart Indenting
Tab size and Indent size = 4
Select "Insert spaces"

If you use Shift+Tab when in front of 4 spaces, it will delete the 4 spaces the same as if you press backspace in front of a tab character.
To convert a file one way or another there is "Tabify Selected Lines" and "Untabify Selected Lines" under the Edit\Advanced menu.

No comments: