How to fix/convert space indentation in Sublime Text?

Here’s a neat trick in Sublime Text 2 or 3 to convert your indentation spacing in a document.

TL;DR:

Converting from 2 spaces to 4 spaces:

Ensure tab width is set to 2. Convert your 2-space indentation to tabs, switch to tab width 4, and then convert the indentation back to spaces.

The detailed description:

Go to:

  • View -> Indentation

It should read:

  • Indent using spaces [x]
  • Tab width: 2

Select:

  • Convert Indentation to Tabs

Then Select:

  • Tab width: 4
  • Convert Indentation to Spaces

Done.

Leave a Comment