Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I have this sample code:

function foo()
{
    var bar = 1;
    var foo = 1;
    // These two lines will be indented on save,
    // however the following line will have it's indention removed:

    return foo + bar;
}

How can I make Sublime Text 2 stop removing the indention on lines only containing whitespace?

If possible I would still like it to remove it from lines which contains other characters than whitespace.

share|improve this question
up vote 8 down vote accepted

I found out that setting trim_automatic_white_space to false solved my problem.

However it doesn't work when enabling trim_trailing_white_space_on_save.

share|improve this answer
    
I had it set in sublime 2 and when installed sublime 3, just lost what option it was. This same option is in v3. – Xavi Montero Sep 12 '14 at 23:46

In case you've already lost wanted whitespace-only indented lines, like happened to me by the thousands on save, here is my script to restore indentation to empty lines within indented blocks of code:

https://github.com/phuein/BlockIndentFixer

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.