When creating multiple new lines, Sublime only leaves indented the final the line I end up on, and not those above it

0

In Sublime, when you hit return, it auto-indents the new line, according to syntax. However, if I hit return more than once, going multiple lines down, the previous lines do not remain indented. They have no indentation at all, and if I wish to go back to them to add something, I have to manually indent them.

Sometimes I like to have some white space in my code for aesthetic reasons. Is there a solution to this? Some other editors leave the lines indented in this use case.

Marcus Plimsoll

Posted 2015-01-27T22:54:21.470

Reputation: 103

I have a hunch this is by design, as to not waste space with "unused" indents in source code. Then again, it could be a bug.. – Kristian – 2015-01-27T23:17:24.190

I figured it out. It's the setting "trim_automatic_white_space". Enabled by default, and setting it to false creates the behavior I want. :) – Marcus Plimsoll – 2015-01-28T00:07:30.100

Answers

3

Figured it out. Setting "trim_automatic_white_space" to false (true by default) creates the behavior I want. Nice to know there was so much thought put into this editor as to include that option.

Marcus Plimsoll

Posted 2015-01-27T22:54:21.470

Reputation: 103

This has been bugging me for quite some time as well. Not badly... Just one of these little voices in the back of your head. (But I have lots of voices in my head so that's ok... :/ ) Your question inspired me to actually go and take a look at the sublime options. I found the same setting, was just going to post an answer when I saw that you answered your own. But MAN are there a lot of cool settings to play with \o/ Sublime FTW. – SadBunny – 2015-01-28T00:12:59.317

I will accept it but it says I can't accept my own answer until two days have passed—probably because this is a new account. But thanks! – Marcus Plimsoll – 2015-01-28T00:18:00.947

1

Default:  "trim_automatic_white_space": true,

Trims white space added by auto_indent when moving the caret off the line.

jesterjunk

Posted 2015-01-27T22:54:21.470

Reputation: 123