3

I'm using REPL extension for Sublime text 3 for my python projects. Currently when I want to interrupt a running script I have to close to close the REPL window to stop execution and all computations are so far are lost. I was wondering if anybody knows how to interrupt an execution and have a short cut or key bindings for that

Peanut
  • 803
  • 1
  • 11
  • 24

2 Answers2

1

On OS X and Linux, the key binding CtrlShiftC executes the subprocess_repl_send_signal command with signal 2 (SIGINT), the equivalent of KeyboardInterrupt in Python.

For some reason, though, SublimeREPL's Windows keymap doesn't include this command, and instead the keybinding executes the repl_clear command, which just clears all the text in the view. To get around this, select Preferences → Key Bindings—User and add the following:

{ 
    "keys": ["ctrl+shift+c"], 
    "command": "subprocess_repl_send_signal", 
    "args": {"signal": 2},
    "context":
    [
        { 
            "key": "setting.repl", 
            "operator": "equal", 
            "operand": true 
        }
    ]
}

If this is your first custom key binding, make sure the command above is surrounded by square brackets [].

MattDMo
  • 100,794
  • 21
  • 241
  • 231
  • When I try to add it, sublime show me an error message saying "[WinError 6] The handle is invalid". Do you know why? – nachmr Oct 18 '17 at 09:50
0

As mentioned above (a long time ago) the key bindings aren't present for Windows. However, one can Mouse Right Click to open a context menu. From here there are menu options for Kill and Restart. You can also open a sub-menu which allows you send those and other signals including SIGINT.

chuck_sum
  • 113
  • 6