The sublime repl plugin for Sublime text is very useful, you can have your results in full color instead of black and white text, first of all.
Go in the install package system of sublime text:
- goto tools / command palette (or ctrl+schift+p)
Write repl and you will see the sublimerepl plugin. Install it.
After that go in preferences and choose keybindings.
And copy this (only the part for sublime repl, but if you install also terminus, you ca use the second part for it, it’s another very useful plugin to use the command line interface of windows or linux inside sublime text without have to use the external app of the cmd).
If you do not want to write it just copy and paste this text. Check if your python version in in the Python311 path like mine. If not, open python in the cmd, import sys and print sys.path[4] to see where your python.exe is
[ {"keys": ["ctrl+b"], "command": "repl_open", "caption": "SublimeRepl", "id": "SublimeRepl", "mnemonic": "R", "args": { "type": "subprocess", "encoding": "utf8", "cmd": ["C:/Users/giova/AppData/Local/Programs/Python/Python311/python.exe", "-u", "-i", "$file_basename"], "cwd": "$file_path", "syntax": "Packages/Python/Python.tmLanguage", "external_id": "python", "extend_env": {"PYTHONIOENCODING": "utf-8"} }}, ]
The other part of this post is an older version… so it should not interest you. I leave it, just in case could be useful to somebody, who knows for what.
Speed up python testing with Sublime text and Sublime Repl
You can use some shortcut keys to run different versions of python for your code in sublime text 3 with the sublime repl plugin.
In the Window (default).sublime-keymap file
This can be found through preferences/browse pakages and then going into the user folder.
[ {"keys": ["ctrl+alt+p"], "command": "repl_open", "caption": "SublimeRepl", "id": "SublimeRepl", "mnemonic": "R", "args": { "type": "subprocess", "encoding": "utf8", "cmd": ["C:/Users/giova/AppData/Local/Programs/Python/Python37/python.exe", "-u", "-i", "$file_basename"], "cwd": "$file_path", "syntax": "Packages/Python/Python.tmLanguage", "external_id": "python", "extend_env": {"PYTHONIOENCODING": "utf-8"} }}, {"keys": ["ctrl+b"], "command": "repl_open", "caption": "SublimeRepl", "id": "SublimeRepl", "mnemonic": "R", "args": { "type": "subprocess", "encoding": "utf8", "cmd": ["C:/Users/giova/AppData/Local/Programs/Python/Python38/python.exe", "-u", "-i", "$file_basename"], "cwd": "$file_path", "syntax": "Packages/Python/Python.tmLanguage", "external_id": "python", "extend_env": {"PYTHONIOENCODING": "utf-8"} }}, {"keys": ["ctrl+alt+b"], "command": "repl_open", "caption": "SublimeRepl", "id": "SublimeRepl", "mnemonic": "R", "args": { "type": "subprocess", "encoding": "utf8", "cmd": ["C:/Users/giova/AppData/Local/Programs/Python/Python311/python.exe", "-u", "-i", "$file_basename"], "cwd": "$file_path", "syntax": "Packages/Python/Python.tmLanguage", "external_id": "python", "extend_env": {"PYTHONIOENCODING": "utf-8"} }}, ]
Whatch the video with the explanation of how to use the different versions of Python
Subscribe to the newsletter for updates
Tkinter templates
My youtube channel
Twitter: @pythonprogrammi - python_pygame