Sublime Text indentation behavior

百般思念 提交于 2019-12-11 09:57:23

问题


When using HTML syntax mode in Sublime Text, I see what appears to be erroneous behavior. However, I've exhausted Google trying to find any mention of the same issue. The image explains it best:

You'll note that in each instance, the cursor starts at the correct location (one tab in from the current tag). However, the indentation immediately shifts to the left when typing begins.

I've compared this behavior to Coda and Atom, but neither have this issue. Sublime Text 3 is up to date. The same behavior occurs with the default theme or a custom theme.

I realize there are shortcuts that can be used (div + tab + enter for example), but that doesn't help when editing an existing file where the elements are already present.

Any idea how to stop Sublime from unindenting like this?

Edit: Here is the contents of Preferences > Settings - User:

{
    "auto_match_enabled": false,
    "color_scheme": "Packages/Theme - Spacegray/base16-ocean.dark.tmTheme",
    "font_size": 14,
    "highlight_line": true,
    "ignored_packages":
    [
        "Vintage"
    ],
    "open_files_in_new_window": false,
    "theme": "Spacegray.sublime-theme",
    "trim_trailing_white_space_on_save": true,
    "word_wrap": false
}

回答1:


I recently asked a similar question at Sublime Text isn't indenting properly with HTML.

Try installing the Emmet package. It allows you to write HTML in a much more efficient way, but also has its own indentation configuration. Typing anytagTab gives you the properly indented text.

An example without Emmet.

An example with Emmet.



来源:https://stackoverflow.com/questions/24043158/sublime-text-indentation-behavior

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