sublimetext2indentationauto-indent

How to fix/convert space indentation in Sublime Text?


Example: If I have a document with 2 space indentation, and I want it to have 4 space indentation, how do I automatically convert it by using the Sublime Text editor?


Solution

  • 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:

    It should read:

    Select:

    Then Select:

    Done.