Sublime Text新建一行会丢失缩进

7
我有一个在sublime text中让我需要输入额外按键的问题。当我创建几行新代码时,缩进是正确的。但是,如果我向上箭头返回到这些新代码行,缩进就没有了,而且光标又回到了0位置(适用于所有文件格式)。我是否做错了什么?这是预期的行为吗?我喜欢我的代码有空格,所以这很困扰。
重现步骤: 编写函数代码,例如。
    function Bob(){
        | indent starts here
    }

一切都很好。然后我添加了几行新内容,按上箭头回到中间,我得到了这个:

    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
    }

请提出任何建议 - 除了更改我的编程风格 :-) 谢谢。

编辑:显然这不是预期的行为。如果有插件干扰,请查看以下用户首选项和插件列表。

用户首选项:

{
"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
}

插件:

  • Emmet
  • GitGutter
  • Package Control
  • PyV8
  • Sass
  • SFTP
  • Sidebar Enhancements
  • 主题 - soda

请编辑您的问题并添加 Preferences -> Settings - User 文件的内容,以及列出您安装的任何插件。我在 ST2 和 ST3 中都能得到您“期望”的行为。 - MattDMo
好的,知道了,我会做的。 - Websemantic
1个回答

14

将以下内容添加到您的首选项中,您就可以完成所有设置:

"trim_automatic_white_space": false,

默认值为true,设置后,当将光标移动到行上时,它将修剪由auto_indent添加的空格。


你为我节省了许多许多的按键操作。太棒了,谢谢! - Websemantic

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接