美文网首页
sublime text 用enter换行的时候,自动缩进如何设

sublime text 用enter换行的时候,自动缩进如何设

作者: 梦不深 | 来源:发表于2020-07-01 02:03 被阅读0次

    稍微查了一下网上的办法,是把汉化文件删除,但是会造成菜单栏混乱,简直无法忍受。。。

    那么这里介绍的是另一种解决办法。在用户的热键配置文件(preferences-key binding-user)中加入以下代码:

    [ 复制代码

    ]

    <pre style="margin: 0px; padding: 0px; overflow-wrap: break-word; font-family: "Courier New" !important; font-size: 12px !important;"> { "keys": ["enter"], "command": "auto_indent_tag", "context":
    [
    { "key": "setting.auto_indent", "operator": "equal", "operand": true },
    { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
    { "key": "selector", "operator": "equal", "operand": "punctuation.definition.tag.begin", "match_all": true },
    { "key": "preceding_text", "operator": "regex_contains", "operand": ">$", "match_all": true },
    { "key": "following_text", "operator": "regex_contains", "operand": "^</", "match_all": true },
    ]
    } </pre>

    [ 复制代码

    ]

    [图片上传失败...(image-27b7b7-1593539898317)]

    保存配置文件之后,换行就能够正常缩进了,如图:

    [图片上传失败...(image-6b95b5-1593539898317)]

    二、顺便把tab键的缩进也处理一下,按一次tab缩进足够的距离

    处理之前,需要这样按tab。。。如图:

    [图片上传失败...(image-a24c7a-1593539898317)]

    处理之后,tab一次到位,如图:

    [图片上传失败...(image-5c126e-1593539898317)]

    和上面的一样,在用户的热键配置文件(preferences-key binding-user)中加入以下代码:

    [ 复制代码

    ](javascript:void(0); "复制代码")

    <pre style="margin: 0px; padding: 0px; overflow-wrap: break-word; font-family: "Courier New" !important; font-size: 12px !important;"> // Press the tab indent a sufficient distance
    { "keys": ["tab"], "command": "reindent", "context":
    [
    { "key": "setting.auto_indent", "operator": "equal", "operand": true },
    { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
    { "key": "preceding_text", "operator": "regex_match", "operand": "^", "match_all": true }, { "key": "following_text", "operator": "regex_match", "operand": "^", "match_all": true }
    ]
    }</pre>

    [ 复制代码

    ](javascript:void(0); "复制代码")

    Tips:小白注意看我的图,在之前的代码后面加个逗号

    [图片上传失败...(image-9aed46-1593539898317)]

    说白了其实就是热键冲突的问题。。。END

    种个草莓防止以后再找
    原文地址作者:忆秋暝枫
    出处:http://www.cnblogs.com/yqmf

    相关文章

      网友评论

          本文标题:sublime text 用enter换行的时候,自动缩进如何设

          本文链接:https://www.haomeiwen.com/subject/whpqqktx.html