I use that simple plugin on each line of my code written in Sublime Text.
That plugin finishes regular line/block endings and moves cursor out of it. Can be used for C-style language syntaxes: C, C++, Java, Javascript, PHP.
It jumps out of () or {} brackets and adds semicolon if required.
Having code:
bar() {
foo(param1, param2, param3<cursor here>)
}
note, that ")" bracket has been added by sublime once you wrote "foo("
press ctrl-enter and get to:
bar() {
foo(param1, param2, param3);
<cursor here>
}
press ctrl-enter once more and get to:
bar() {
foo(param1, param2, param3);
}
<cursor>
if (a > b) {
do1();
do2();
<cursor here>
do3();
}
(yes, i've just used ctrl-enters to complement do1, do2, do3 calls with semicolon)
ctrl-enter and get to:
if (a > b) {
do1();
do2();
do3();
}
<cursor here>
event.on('error', function(message) {
show(message<cursor>)
})
")" after cursor and ""})"" below are written by sublime itself
ctrl-enter and get:
event.on('error', function() {
show(message);
<cursor>
})
ctrl-enter and get:
event.on('error', function() {
show(message);
});
<cursor>
-
Copy .py file to your plugins folder (~/.config/sublime-text-2/Packages/User) or use Tools -> New Plugin... and copy-paste content of .py file there.
-
Map hot-key to the command. Menu Preferences -> Key binding - User and add e.g. hotkey for CTRL-Enter:
[
{"keys": ["ctrl+enter"], "command": "out_of_brackets", "args": {}}
]