Sometimes tab inserts spaces, even with soft tabs off


Sometimes atom decided to stop inserting tab characters when I hit the tab key on my keyboard. I’ve been unable to come up with reproducible steps to reproduce, it seems to happen every other day or so.

Restarting my editor sometimes fixes it.

When I enter this state, the following occurs:

  • I’m unable to even paste a tab character at the beginning of a line.
  • Any indentation action seems to replace tabs with spaces.

As we are required to use tabs for our coding conventions, every time this happens I have to drop back to vim to fix things.

Can't enter hard tab

Is it a particular kind of file that it always happens in? Did you recently install any packages? Some people have had strange interactions with custom UI themes and keyboard actions, have you tried going back to the standard themes?

Not sure I have any better ideas than you but perhaps these are some things you can try to help track it down …


It only happens with cs files. I installed the Language Css package, maybe a bug in that?


Do you mean CSS files? Or CSharp files?


CSharp files (.cs extension).


For some reason the editor will autodetect spaces/tabs in each file, and that overrides the preference setting. It will switch to inserting spaces for a file where any line begins with any number of spaces. This happened to me with a file that contained multiline comments with lines beginning with a space and asterisk. It is very annoying.


I agree.

I find it unacceptable, and have had to stop using atom until I can turn it off. :frowning:


If you want to force it to use your soft tabs setting, you can make a change in /Applications/
In TextBuffer.prototype.usesSoftTabs on line 825, just add a return false; at the start of the function.

Unfortunately this will break when Atom updates.



I filed an issue here:


Perhaps you could submit a pull request for the Text Buffer package?


Rather than just returning false, we should probably look to see the if the user is using softTabs. As a result I think the following would be a more appropriate fix than simply returning false.

TextBuffer.prototype.usesSoftTabs = function() {
      if (!atom.config.get('editor.softTabs')) { return false; }
      var match, row, _i, _ref1;

or in CoffeeScript

return false  unless atom.config.get("editor.softTabs")

Updated: Pull Request at


This also seems to be the case in javascript files. Related?


Happens in PHP, HTML, as well as mixed HTML/PHP. It probably happens in most syntax modes to be quite honest. It’s a maddening bug.


So is there a work around or solution to this? Maybe something in the config.cson or


couldn’t we put this in the file?


@middle8media I haven’t tested this at all, but if you wanted to do this in the file, you would add the following:

editor = atom.workspace.getActiveEditor()
editor.buffer.usesSoftTabs = ->
      return false unless atom.config.get("editor.softTabs")
      for row in [0..@getLastRow()]
            if match = @lineForRow(row).match(/^\s/)
                  return match[0][0] != '\t' 


Regarding the pull request that was denied due to use of the atom global - couldn’t the issue therefore be solved in one of two ways:

  1. The ‘uses soft tabs’ setting is passed to TextBuffer as a constructor parameter or a setter-like method. This way we don’t rely on the atom global, only the fact that TextBuffer should care about soft tabs or not.

  2. The code that actually calls TextBuffer::usesSoftTabs() needs to have the code from the PR so the reliance on the atom global is no longer in TextBuffer but in whatever calls it. If whatever calls it is also in the atom/text-buffer package, then maybe whatever calls that and so on up the chain till it’s the atom/atom package. Obviously it could be the case that that won’t work as it’s all done in atom/text-buffer but if that’s the case then surely it needs to know about the soft tabs preference anyway so has it stored somewhere passed in from atom’s core. Anyway, I’m not sure how easy it is to tell what actually calls TextBuffer::usesSoftTabs() (I tried setting a breakpoint and then opening a file and it didn’t stop so I’m out of ideas) so can’t tell how viable this solution is.

Just a couple of ideas, anyway.


Just putting in another vote here that a fix for this is needed. As far as I’m concerned, it’s a bug that makes disabling the “soft tabs” option a bit of a farce.


Please, another vote to fix this. It’s an incredible pain point when editing C# files here.


I’m pretty sure this was fixed:

It works perfectly for me now.