Sublime Text 缩进行为 [英] Sublime Text indentation behavior

查看:35
本文介绍了Sublime Text 缩进行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Sublime Text 中使用 HTML 语法模式时,我看到了似乎是错误的行为.但是,我已经筋疲力尽了谷歌试图找到任何提及相同问题的内容.这张图最能说明问题:

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.

我已经将这种行为与 Coda 和 Atom 进行了比较,但两者都没有这个问题.Sublime Text 3 是最新的.默认主题或自定义主题也会出现相同的行为.

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.

我意识到可以使用一些快捷方式(例如 div + tab + enter),但这在编辑元素已经存在的现有文件时无济于事.

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.

知道如何阻止 Sublime 像这样取消缩进吗?

Any idea how to stop Sublime from unindenting like this?

这里是Preferences>的内容设置 - 用户:

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

推荐答案

我最近在 Sublime Text 没有正确缩进 HTML.

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

尝试安装 Emmet 包.它允许您以更有效的方式编写 HTML,但也有自己的缩进配置.输入 anytagTab 会给你正确缩进的文本.

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.

一个没有 Emmet 的例子.

Emmet 的例子.

这篇关于Sublime Text 缩进行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆