Change tabs to spaces


There should be an option to convert all tab characters to white-space. I had thought that the “tabLength” would do this but it basically only applies to tabs itself and not allowing the editor to output white-space instead of tabs.

Edit: Found out the option is called “softTabs” and it is enabled by default which will be hidden in the CSON file when it is disabled which was a bit confusing.


There’s still no “Convert Tabs to Spaces” kind of thing, right? I see the option for soft tabs, but it doesn’t convert my documents unfortunately.


I’m surprised to see that this isn’t available.


Give me a sec … whipping up a package now.


Here you go:

It is very bare bones. It doesn’t have a keymap (you can add your own), but it does show up in the Packages menu, in the context menu in an editor window and in the command palette. It uses your editor.tabLength property to decide how many spaces to replace a tab with. It should only replace leading tabs … but I have only tested it on two files.

If you have issues or suggestions, let me know! :smile:

Tabs to Spaces Package

Thanks so much Lee, awesome stuff.


If you select all the lines and Edit > Lines > Auto Indent it should convert between tabs/spaces.


Auto Indent didn’t work for me mate but Lee’s package did the trick the time this feature gets implemented :smiley:
Thanks Lee!


You’re all welcome. I’m glad I could help!


@leedohm I installed the plugin, it works well as it advertised. But I prefer to code everything in tab instead of spaces. Are you going to add a feature on toggle spaces or tabs. or make it switch spaces to tabs.

Another question, unlike sublime, if I highlight the text (ex: test.sass), it does not show it is tab or space (ex: spaces will draw some dots). I tried to turn on the toggle soft wrap, it did not work either.

I have a config setting like this

  'softWrap': false
  'softWrapAtPreferredLineLength': false
  'showInvisibles': false


@mattma Yes, one of the things I’m working towards adding is the “tabify” command, converting leading spaces to tabs.

There is a thread here on showing “invisibles” (visualizations of whitespace characters) only on highlight:

If you want to show invisibles full time, I use the following:

  'showInvisibles': true
    'cr': '↩'
    'eol': ''
    'space': '·'
    'tab': '⇥'

And in my personal stylesheet I have:

@hints-color: #c5c8c6;
@hints-opacity: 0.3;

.editor {
  .invisible-character {
    color: @hints-color;
    opacity: @hints-opacity;

I use a dark UI and stylesheet, so you may need to adjust the coloring and opacity for your situation.


@lee​dohm I do use dark ui too. So those snippets work out of the box. That is exactly what I am looking for. Thanks a lot for your time.

Does you have a timeline on when tabify is going to be done? I thought that if you are able to convert tab to spaces, then you should just revert the logic for spaces to tab. I am totally making a wild guess. In the real life, it should be much more complicated than that.

tab-to-spaces 0.2.0, did you just push the latest? does it include the tabify?


Yep … release notes:

split this topic #14

I moved a post to an existing topic: Tabs to Spaces Package


how does one change the configs for this?