Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a keyboard shortcut for SublimeREPL

Tags:

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

like image 934
Colas Avatar asked Oct 04 '13 13:10

Colas


People also ask

How do I create a shortcut in Sublime Text 3?

Select the Key Bindings - User item under Sublime's Preferences, then add the following example line: {"keys": ["ctrl+shift+c"], "command": "insert_snippet", "args": {"contents": "hello!"}} This will add a CTRL + SHIFT + C shortcut to insert the hello! snippet.


2 Answers

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

like image 197
Reza Avatar answered Sep 28 '22 03:09

Reza


You can set keyboard shortcuts for any menu item that you can select, in any app.

  1. Go to System PreferencesKeyboardShortcutsApp Shortcuts

  2. Click the + to add a new shortcut.

  3. Set the Application to Sublime Text.app, the Menu Title to the exact name of the menu option, and choose a Keyboard Shortcut.

  4. Click Add.

like image 39
grg Avatar answered Sep 28 '22 04:09

grg