[tips]How To Convert Tab To Space In Sublime

This is just a tip about editor “sublime”.

GOAL

Today’s goal is to summarize the 3 way to convert tab to space in sublime.

  1. How to convert tabs in the current code to the spaces
  2. How to convert the spaces in the current code to the tab
  3. How to change the tab into spaces. In other words, how to insert spaces when tab key is pressed.

Method

1. How to convert tabs in the current code to the spaces

Use command pallet. Open command pallet with Ctrl+Shift+P on Windows and Cmd+Shift+P on OSX.

The command pallet

And click “Indentation: Convert to Spaces“.

2. How to convert the spaces in the current code to the tab

Open command pallet and instead click “Indentation: Convert to Tabs”.

3. How to change the tab into spaces.

In other words, how to insert spaces when tab key is pressed.

Click the place where displayed “space…” at the right bottom of the sublime editor.

Check “Indent Using Spaces” on. You can choose the width of tab (spaces).

An another way of changing the settings is to rewrite the Settings file.

Add the code below to the right side of the Settings file. Then close and restart sublime.

translate_tabs_to_spaces: True;