How to keybind sublime repl and terminus for Sublime text on the Mac

This is how.

go in:

  • sublime text (in the menu on top of the screen)
  • preferences
  • key binding

and vcopy this

[


    {"keys": ["ctrl+alt+b"], "command": "repl_open",
 "caption": "Python - RUN current file",
 "id": "repl_python_run",
 "mnemonic": "d",
 "args": {
    "type": "subprocess",
    "encoding": "utf8",
    "cmd": ["/Library/Frameworks/Python.framework/Versions/3.9/bin/python3", "-u", "-i", "$file_basename"],
    "cwd": "$file_path",
    "syntax": "Packages/Python/Python.tmLanguage",
    "external_id": "python",
    "extend_env": {"PYTHONIOENCODING": "utf-8"}
        }},


    // Open cmd.exe Command Prompt when Alt+1 is pressed
    {
        // The key press to look out for
        "keys": ["alt+1"],

        // Tell terminus to open something
        "command": "terminus_open",

        // Tell terminus what to open
        "args" : {
            // Open Command Prompt
            "cmd": "cmd.exe",

            // Provide Command Prompt with Current Working Directory
            "cwd": "${file_path:${folder}}",

            // Tell terminus to put it in the panel at the bottom of the screen
            "panel_name": "Terminus"
        }
    },

]

you must install the plugins for sublime repl and terminus, of course. the first is to use the python terminal in sublime, the second is to use the mac os terminal in sublime. have fun.

Install package control

Go to tools/command palette /ctrl+shift+P) and digit inst… then choose
choose install Package

After you installed package control, go again in tools, command palette and choose again Install Package, this will appear

Now write into the input box…
write terminus and you will see the plug in (you do not see it here because I have already installed it, so there isn’t anymore)

Ok, now you are ready for the key binding

Keybinding

Go here

preferences / keybinding

You will get a window like this

Your panel on the right will be with just 2 square parenthesis, you put what you see in the right panel of mine into yours
[

    {
        "keys": ["alt+1"],
        "command": "terminus_open",
        "args" : {
            "cmd": "cmd.exe",
            "cwd": "${file_path:${folder}}",
            // Tell terminus to put it in the panel at the bottom of the screen
            "panel_name": "Terminus"
        }
    },
]

We’re done.

Now when you press alt+1 will appear something like this below. If it does not, close sublime and reopen it. save the keybinding file too (with control+s)

That’s the terminal into Sublime text that appears pressing Alt+1 once you do the keybinding
sublime repl

terminus

Published by pythonprogramming

Started with basic on the spectrum, loved javascript in the 90ies and python in the 2000, now I am back with python, still making some javascript stuff when needed.