关于sublime text3 的Tab键缩进问题

一、换行无法自动缩进的问题,如图:

    

    在首选项 - 按键绑定 - 用户中(Preferences - Key Bindings-User)加入以下代码:

    


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

  

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

    

 

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

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

  

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

  

  和上面的一样,在首选项 - 按键绑定 - 用户 (Preferences - Key Bindings-User)中加入以下代码:


    // 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 }
        ]
    }

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

  说白了其实就是热键冲突的问题。。。END(转载自https://www.cnblogs.com/yqmf/p/6252910.html

阅读更多
个人分类: 前端
上一篇文本溢出后添加省略号
下一篇关于sublime text3的插件
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭