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:
Ensure tab width is set to 2. Convert your 2-space indentation to tabs, switch to tab width 4, and then convert the indentation back to spaces.
Select all code that you intend to indent, then hit Ctrl + ] in Sublime text to indent. For macOS users, use command + ] to indent, and command + [ to un-indent.
You can use ctrl+ ] to indent a line (or highlighted block), and ctrl + [ to unindent.
To configure the tab width in Sublime Text 3, click on “View” in the top bar, then click on “Indentation” in the drop-down list. Next, in the second level of the drop-down list select the width you want a tab to take up. Sublime Text 3 defaults to tabs being four spaces wide.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With