sublime text new line loses indent

indentation, javascript, sublimetext2

Solution

Add the following to your preferences and you should be all set:

"trim_automatic_white_space": false,

The default is `true`, and when set it trims white space added by auto_indent when moving the caret off the line.

Problem

I have a problem that is causing me lots of extra keystrokes in sublime text. When I create a couple of new lines, the indentation is correct. However, if I up arrow back to those new lines, the indentation is gone and I am back at position 0 (happens for all file formats). Am I doing it wrong, is this intended behaviour? I like white space in my code so this is a pain. Recreating: Write function code e.g. ``` function Bob(){ | indent starts here } ``` All good. I then add a couple of new lines, up arrow back to the middle and I get this: ``` function Bob(){ | indent starts here | indent starts here | indent starts here } ``` I would like: ``` function Bob(){ | indent starts here | indent starts here | indent starts here } ``` Any suggestions please - apart from changing my coding style :-) Thanks. Edit: apparently this is not expected behaviour. Preferences and plugins listed below in case they are interfering. User preferences: ``` { "auto_complete": true, "auto_complete_with_fields": true, "bold_folder_labels": true, "caret_style": "phase", "color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", "detect_indentation": true, "draw_minimap_border": true, "fade_fold_buttons": true, "folder_exclude_patterns": [ ".svn", ".git", ".hg", "CVS", "tmp", ".tmp", ".bundle", ".sass-cache" ], "highlight_modified_tabs": true, "ignored_packages": [ "Vintage" ], "line_padding_bottom": 1, "line_padding_top": 1, "soda_classic_tabs": true, "tab_size": 4, "theme": "Soda Light.sublime-theme", "translate_tabs_to_spaces": true, "trim_trailing_white_space_on_save": true, "word_wrap": true, "wrap_width": 200 } ``` Plugins: - Emmet - GitGutter - Package Control - PyV8 - Sass - SFTP - Sidebar enhancements - Theme - soda

Original source