+2

Word wrap indents not matching the originating indentation

Saturn 12 years ago updated by jan otte 12 years ago 1
Hi! Just purchased Sublime Text and have one major quirk left that I haven't figured out.

Sometimes, word wrap will put the wrapped line at the same indentation as the content I'm working on. Other times it will put the wrapped text one tab over resulting in it appearing as though it's a completely separate line of code.


Since this behavior is inconsistent, I am under the belief it is a bug. If it is not, then I am requesting a setting to allow me to make it so the wrapped indentation matches the indentation of the originating line.


Have a look at the settings in [Preferences -> Settings - Default]


You are looking for these lines:

    // Set to false to disable detection of tabs vs. spaces on load

    "detect_indentation": true,

    // Calculates indentation automatically when pressing enter

    "auto_indent": true,

    // Makes auto indent a little smarter, e.g., by indenting the next line

    // after an if statement in C. Requires auto_indent to be enabled.

    "smart_indent": true,


While it is hard to know what exactly it is you are describing it sounds like you don't like how "auto_indent" and/or  "smart_indent" is working.


So open your user settings file [Preferences -> Settings - User] and paste the above lines into there.


When ST looks for what settings to apply those in the user file 'override' those in the default file so what you put in your user file becomes the relevant setting without you:

1 - making a mess of the defaults; or

2 - having the next ST update wipe away all your preferred settings with a new copy of the default file


Now try setting some to false and see if you can find a setting that better matches your preferred way of handling indenting of new lines.