Good day,
Like many out there, I am dissatisfied with the automatic insertion of punctuation for CSS mark-up. Many don’t like the ‘colon space semi-colon’ the CSS package injects as code is written. The personal preference I would like is a method to inject a colon followed by 1-2 tabs and a semi-colon.
Doing some hunting I discovered web topics on how to achieve what I want but they don’t apply for Sublime Text 3. The solution I discovered and wish to adapt involves a key binding snippet which stops a semi-colon to the right of the cursor. This is the snippet:
// override CSS auto-insertion of semi-colon
{ "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": "selector", "operator": "equal", "operand": "source.css - meta.selector.css", "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\}|$)", "match_all": true }
]
}
I want {“contents”: “:$0”} to output the equivalent of “:\t\t;” with the cursor in between the tab and the semi-colon. Another keystroke on the tab key would inject a third tab.
I have tried {“contents”: “:\t$0”} and {“contents”: “:\t\t$0”} to get started but with no success. All I have been able to achieve is ": " with the cursor after the space.