Sublime Text - Indentation



Indentation is the process of maintaining the code blocks of programming languages to maintain a systematic structure. It helps to convey the developers a better structure of program. This chapter explains you in detail about indentation in Sublime Text editor.

Importance of Indentation

Indentation helps to maintain the code structure such that it is easily understood by anyone who accesses it. Proper indentation imparts the following features to the code −

  • Readability
  • User-friendliness
  • Adaptability
  • Ease of maintenance

Options for Indentation in Sublime Text

Sublime Text editor provides various options for code indentation as shown in the following screenshot −

Options for Indentation in Sublime Text

The usage of these options is discussed in detail here −

Indent Option

Indent option helps to create indentation of the specified code. You have to select the code specified and select the Indent option. You can also use the shortcut Ctrl+[ after selecting the required code that is to be indented. Refer to the following screenshot for a better understanding −

Indent Option

Unindent Option

Unindent option works in the reverse of indent procedure. The shortcut for the unindent option is Ctrl+]. Refer to the following screenshot for a better understanding −

Unindent Option

Reindent Option

Reindent option is used to undo the unindent option and revert the code back to the same condition. Refer to the following screenshot for a better understanding −

Reindent Option

Benefits of Indentation

Proper indentation offers various benefits to the code and developers. They are discussed below −

  • Code blocks will be visible without much effort.

  • Developer can focus on lines of code that are necessary and easily ignore the irrelevant ones.

  • A developer using the same kind of code structure multiple times need not focus on the start of block and end of block statements.

  • Any misplaced lines of code can be easily identified.