One of the ever-present arguments between developers in many programming languages is how to correctly indent code. Many developers choose to indent code with one or more spaces, while others prefer to use tabs. Both options have their benefits, with spaces offering a consistent level of indentation; while tabs are explicitly designed for use in indentation, allow developers to configure how a single tab displays, and make it much less likely to run into half-indentation.
Tip: Half-indentation is an issue where two documents use a different number of spaces to indent. For example, if you use a single space to indent content in one document, then copy code from double-space indented code, they won’t be compatible. With tabs, this isn’t really an issue, as tabs are wide enough that no-one uses double-tab indentation.
Any decent development environment, such as Sublime Text 3 allows developers to set how wide they want tab characters to appear. This is primarily a personal preference issue, as it makes no difference to the actual code, a single tab character is used no matter if that tab is configured to take the same amount of space as two, three, or more spaces.
To configure the tab width in Sublime Text 3, click on “View” in the top bar, then click on “Indentation” in the drop-down list. Next, in the second level of the drop-down list select the width you want a tab to take up. Sublime Text 3 defaults to tabs being four spaces wide.
Tip: If you prefer using spaces for indentation, you can enable the “Indent Using Spaces” option at the top of the tab width menu. This will convert any press of the tab key to the number of spaces specified.