簡體   English   中英

Sublime Text 3:4 個制表符空格不僅適用於 javascript 文件

[英]Sublime Text 3: 4 spaces for tab not working only for javascript files

在 Sublime Text 3 中,我在用戶首選項中有 4 個制表符空間。 這是設置文件的一部分:

{
    ...

    // The number of spaces a tab is considered equal to
    "tab_size": 4,

    // Set to true to insert spaces when tab is pressed
    "translate_tabs_to_spaces": false,

    // If translate_tabs_to_spaces is true, use_tab_stops will make tab and
    // backspace insert/delete up to the next tabstop
    "use_tab_stops": true,

    // Set to false to disable detection of tabs vs. spaces on load
    "detect_indentation": true,

    // Calculates indentation automatically when pressing enter
    "auto_indent": true,

    // Makes auto indent a little smarter, e.g., by indenting the next line
    // after an if statement in C. Requires auto_indent to be enabled.
    "smart_indent": true,

    // Adds whitespace up to the first open bracket when indenting. Requires
    // auto_indent to be enabled.
    "indent_to_bracket": false,

    // Trims white space added by auto_indent when moving the caret off the
    // line.
    "trim_automatic_white_space": true,

    ...
}

除了 Javascript 文件,其中的制表符空間為 2,它運行良好。我不明白為什么。

有什么幫助嗎?

我試圖創建特定於 Javascript 的設置文件,但它也不起作用。

我遇到了同樣的問題。 如果您打開一個現有文件,該文件的制表符設置為 2 個空格(從 GitHub 加載的文件大多有這個),就會出現問題。 另一方面,如果您創建一個新的 .js 文件,則選項卡會按照指示設置為 4。

正如@OdatNurd 所提到的,您將“detect_indentation”設置為 True。 這會檢測加載文件的縮進。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM