Sublime Text 2 - Assign a keyboard shortcut to a tool

2

1

Is there any possible way of assigning this tool to a keyboard shortcut? I'm using this tool because the builtin console in Sublime Text 2 doesn't support interactivity (entering inputs....etc).

this tool

Taher Elhouderi

Posted 2013-04-17T23:16:25.287

Reputation: 143

This answer might help: http://superuser.com/questions/544486/how-can-i-set-key-bindings-for-menu-items-in-sublime-text-2 . But, since it is a menu item added by a plugin, you would have to find out what the command the plugin is calling a different way. It might be shown in the console.

– d_rail – 2013-04-18T19:59:33.190

Answers

3

See the python menu commands for the package and the q/a: How can I set key bindings for menu items in Sublime Text 2?.

Add to your User keybindings file:

{ "keys": ["ctrl+shift+r"], "command": "repl_open",
                 "caption": "Python - RUN current file",
                 "id": "repl_python_run",
                 "mnemonic": "d",
                 "args": {
                    "type": "subprocess",
                    "encoding": "utf8",
                    "cmd": ["python", "-u", "$file_basename"],
                    "cwd": "$file_path",
                    "syntax": "Packages/Python/Python.tmLanguage",
                    "external_id": "python",
                    "extend_env": {"PYTHONIOENCODING": "utf-8"}
                    }
}

You'll have to do the testing because I don't have that package.

d_rail

Posted 2013-04-17T23:16:25.287

Reputation: 2 809

Note that this is simply a copy of what is contained in the SublimeREPL > config > Python > Main.sublime-menu file with an additional binding for keyboard keys. You can also use the User keybindings file to have custom configurations for Python (e.g. Python 2.7) with keyboard shortcuts without having the extra configuration in the menu item of the user interface. – Francis Laclé – 2017-10-17T13:27:03.817