How to create a keyboard shortcut for SublimeREPL

Colas picture Colas · Oct 4, 2013 · Viewed 64.5k times · Source

I am new to Sublime Text 2 on Mac OS. I installed the package SublimeREPL.

Is it possible to create a keyboard shortcut to run the file with SublimeREPL?

More precisely, here is a screenshot. I want to avoid going through this menu and run quickly with a keyboard shortcut.

enter image description here

Answer

Reza picture Reza · Nov 14, 2013

You can set a keyboard shortcut for the command in your screenshot using Sublime key-bindings.

  1. Open Sublime.

  2. Go to Preferences > Key Bindings - User

  3. Add these lines to the opened file between brackets:

    { "keys": ["ctrl+alt+b"], "command": "run_existing_window_command", "args":
    {
        "id": "repl_python_run",
        "file": "config/Python/Main.sublime-menu"
    }}
    
  4. Save it.

It's done! You can type any key-combinations instead of "ctrl+alt+b", but make sure it's not reserved by Sublime itself (check in Preferences > Key Bindings - Default)

Note: This works for Sublime in Windows. I don't think there would be any difference for Sublime on Mac OS/Linux.

screenshot