admin管理员组文章数量:1287625
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_plete": true,
"auto_plete_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
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_plete": true,
"auto_plete_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
-
please edit your question and add the contents of your
Preferences -> Settings - User
file, and also list any plugins you have installed. Your "desired" behavior is what I'm getting with both ST2 and ST3. – MattDMo Commented Nov 27, 2013 at 15:51 - Ah, good to know, will do. – Websemantic Commented Nov 27, 2013 at 16:09
1 Answer
Reset to default 14Add 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.
本文标签: javascriptsublime text new line loses indentStack Overflow
版权声明:本文标题:javascript - sublime text new line loses indent - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741317640a2372013.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论