Stop Sublime Text from executing infinite loop
For MacOS:
cmd + option + esc
to force quit
For me (on Linux), there is no break
key on the keyboard and this shortcut was somehow bound to a different combination: ctrl+alt+c.
You can find where it is bound in the Tools
menu:
After interrupting your script you should see the text [Cancelled]
printed to the sublimetext console.
You want to use Ctrl+Break. For your own information, just go check under Tools in Sublime Text and you'll see Cancel Build and the above hotkey. It'll work just fine for infinite loops. Suffice to say, I've had the same happen! ;)
For Windows users, there is no Break key, so go into Preferences>Key Bindings and change the line
{ "keys": ["ctrl+break"], "command": "cancel_build" }
to a different shortcut, such as Ctrl+Alt+B
The combination is ctrl+break
.
In Windows there is no break button, so you can go to Preferences > Key Bindings
and to the user side add this:
{ "keys" : ["ctrl+c"], "command": "cancel_build"}
Now, by pressing Ctrl+C the execution will stop. Of course, you can change the combination to whatever you want.
UPDATE
As @Brad mentioned, Ctrl+C will override the copy keyboard shortcut. It is wise to assign another key to it, such as Q as Brad pointed out.