The CSS package included with ST (2 and 3) includes a keybinding snippet to auto-insert a semi-colon after a colon. In ST2 you could easily edit the keybinding to remove this feature, as all packages were in the same directory and you could access each file through the filesystem. However, the decision was made in ST3 to compress packages into .sublime-package
zip files, and while there are a few roundabout ways of editing the contents, in this case it's easiest to just override the keybinding in your own settings.
Go to the Preferences
menu and click on Key Bindings - User
. If this file is empty, paste the following into it:
[
// 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 }
]
}
]
If you already have custom keybindings, just omit the outer square brackets [ ]
, place a comma ,
after the last keybinding, and paste the rest at the end before the final closing square bracket ]
.
If you're interested, the original keybinding contained "args": {"contents": ":$0;"}
- I just removed the ;
from after the $0
(which means "put the cursor here").
Thanks so much for this. It's extremely useful when using an Emmet based workflow. Disabling the auto-insert semi-colon as well as autocomplete makes this a perfect combo in this situation. – Ce. – 2016-08-22T05:15:03.290