Here is an example of what is happening now:
.class {
}
So when I’m typing .class { SublimeText automatically inserts } (which is correct).
Then I press Enter and get this:
.class {
#CURSOR_POSITION#
}
But what I really want is (attention to the closing bracket):
.class {
#CURSOR_POSITION#
}
I’ve even seen (ok, it was only once) in some editor special setting for this. Now I start using SublimeText (which is cool!) and I feel that it can be customized in a such way but I’m not quite sure how.
Ok! It’s not really hard to do it but it was not simple to know how to do it =)
So my approach is:
Write a simple macro (I’ve edited the default
Entermacro calledAdd Line in Braces.sublime-macrowhich lives in~Data/Packages/Default) and save it with a new name.I’ve called it
CSS.Add Line in Braces.sublime-macroand put in~Data/Packages/User.Apply it for
Enterkey in CSS files. For that we need to fo to Preferences > Key Bindings – User (it will open~Data/Packages/User/Default (YOUR_OPERATING_SYSTEM).sublime-keymap) and paste there the following code:It is copy-pasted from the defult keybinding file with one context addition:
{ "key": "selector", "operator": "equal", "operand": "source.css" }which tells Sublime to apply it only for CSS ext.
Profit!