Sublime Text 3 換行無法自動Tab縮進的解決方法


一、換行無法自動縮進的問題,如圖:

  

  稍微查了一下網上的辦法,是把漢化文件刪除,但是會造成菜單欄混亂,簡直無法忍受。。。

  那么這里介紹的是另一種解決辦法。在用戶的熱鍵配置文件(preferences-key binding-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 binding-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

作者: 憶秋暝楓
本文版權歸作者和博客園共有,歡迎轉載,但未經作者同意必須保留此段聲明,且在文章頁面明顯位置給出原文連接,否則保留追究法律責任的權利。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM