I have found a better way to do this using Terminus
- install terminus
- create a new build system
- enter the following in the build system:
{
"target": "terminus_open",
"title": "Python REPL",
"tag": "python-repl",
"auto_close": false,
"shell_cmd": "python -u -i \"$file\"",
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
"env": {"PYTHONIOENCODING": "utf-8"},
}
- now build using this new build system
screenshot of using terminus like repl:
This will basically create a repl for you without the new tab opening after each build, you can further modify it with origami to show the console on right, left, up, bottom of your screen if you want too.
You can also use terminus and run it in the default output console window while accepting inputs and making it interactable too
for this-
- create a new build system
- enter the following in the build system:
{
"target": "terminus_exec",
"cancel": "terminus_cancel_build",
"focus": true,
"timeit": false,
"shell_cmd": "python -u -i \"$file\"",
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
"env": {"PYTHONIOENCODING": "utf-8"},
}
- now build using this new build system
- also be sure to add these into the key - binding
[
//----------------------- OPEN CMD CONSOLE -----------------------
{
"keys": ["ctrl+enter"], // you can change the keys
"command": "terminus_open",
"args" : {
"cmd": "cmd.exe",
"cwd": "${file_path:${folder}}",
"panel_name": "Terminus"
}
},
//----------------------- CLOSE TERMINUS CONSOLE -----------------------
{
"keys": ["ctrl+x"], "command": "terminus_close", // you can change the keys
"context": [{ "key": "terminus_view"}]
},
]
- the 1st one allows you to create a cmd shell in the default console area(ctrl + enter) and 2nd one allows to close the default console by closing terminus(ctrl + x) that's it enjoy.
screenshot of terminus in console:
I wasted a lot of time trying to find a way to re use tab in repl that's when i found out sublime repl isn't actively maintained anymore. thats how i found terminus which is actively maintained and can do similar things like repl, hope this helps you.
here is the github guide link: https://github.com/wuub/SublimeREPL/issues/481#issuecomment-917862655