Search code examples
sublimetext3auto-indent

How can I disable sublime completing string literals and keep auto-indent


Whenever I type ' in sublime it adds the terminating quote ' and places the cursor in the middle like this: '|'

Same goes for " that gets expanded into "|".

This is unwanted behavior for me, the only way I found to turn it off is by setting:

"auto_indent": false,

However, this makes it cumbersome to write indented code.

Is there anyway to get Sublime to not complete string literals and keep auto_indent?

I tested this on Sublime 3 Build 3114 on Windows and Sublime 3 Build 3083 on Linux.


Solution

  • The name of the setting should be auto_match_enabled as you see in definition in the default keybindings:

    // Auto-pair quotes
    { "keys": ["\""], "command": "insert_snippet", "args": {"contents": "\"$0\""}, "context":
        [
            { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
            { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
            { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true },
            { "key": "preceding_text", "operator": "not_regex_contains", "operand": "[\"a-zA-Z0-9_]$", "match_all": true },
            { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.double - punctuation.definition.string.end", "match_all": true }
        ]
    },