Sublime Text (v 2.0) - how do I stop auto indentation on new lines after brackets?

六月ゝ 毕业季﹏ 提交于 2020-01-22 15:33:07

问题


I'm trying to make the jump from Notepad++ to Sublime Text 2. However one issue is stopping me from doing so:

When working in CSS, JavaScript or PHP - whenever I type a bracket and press [ENTER], an extra indentation is added. E.g. below show's you where the caret ends up if I type a bracket and press enter:

    {
        |

I need the caret to appear at the same horizontal point as the bracket, like so:

    {
    |

I've tried messing with the indentation settings to no avail. Here are my current User Settings:

{
"auto_indent": true,
"auto_match_enabled": false,
"bold_folder_labels": true,
"color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme",
"detect_indentation": false,
"font_face": "Courier New",
"font_size": 10,
"highlight_modified_tabs": true,
"ignored_packages":
[
    "Vintage"
],
"indent_to_bracket": false,
"line_padding_bottom": 1,
"line_padding_top": 1,
"smart_indent": false,
"trim_automatic_white_space": false
}

UPDATE: if I set auto_indent to false, this creates a different problem. In this case, the caret will always be placed at the very beginning of the line. E.g.

        {
|

I've also tried playing with the files in Packages/JavaScript to no avail.

Would really appreciate a solution as I really want to start using this editor!

Thanks.


回答1:


Change the value for auto_indent to false. That'll fix it for you!




回答2:


I found that if you use SHIFT+Enter you get what you want.




回答3:


To prevent "smart" indentation or automatic next/extra level indentation in e.g. Ruby you need to edit the %AppData%\Sublime Text 2\Packages\Ruby\Miscellaneous.tmPreferences file, not the %AppData%\Sublime Text 2\Packages\Default\Indentation Rules.tmPreferences file, despite of presence of settings like increaseIndentPattern in both. That is, editing the latter (commenting out the tag insides, for example) won't take any effect. Valid for version 2.0.1.



来源:https://stackoverflow.com/questions/11297868/sublime-text-v-2-0-how-do-i-stop-auto-indentation-on-new-lines-after-bracket

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!