问题
In this question How to Run Python Code on SublimeREPL, an answer is given on how to use the usual Ctrl+b
shortcut to run a python code using SublimeREPL within SublimeText.
The steps are simple:
1- Create a new empty file and paste into it the commands:
{
"target": "run_existing_window_command",
"id": "repl_python_run",
"file": "config/Python/Main.sublime-menu"
}
2- Save the file as:
/home/USER/.config/sublime-text-3/Packages/User/SublimeREPL-python.sublime-build
3- Go to your Python file tab and select:
Tools > Build System > SublimeREPL-python
After that the usual Ctrl+b
shortcut will open a new tab where the code is executed.
The issue with this is that the tabs are not re-used. This means every time you hit Ctrl+b
, a new tab opens up instead of the code running in the same tab that was opened before.
Is there a way to make SublimeREPL re-use the tab?
回答1:
Unfortunatly you can't do that even on the latest version of SublimREPL. What you can do is open a ticket to the developper to ask for this implementation. But I'm not sure Sublime Text is able to do that.
回答2:
Add the following line in the "repl_python_run" command in SublimeREPL\config\Python\Main.sublime-menu, right before the "external_id": "python" argument:
"view_id": "*REPL* [python]",
and then to change the line:
if view.id() == view_id
into:
if view.name() == view_id
in SublimeREPL\sublimerepl.py.
Found here.
来源:https://stackoverflow.com/questions/30100899/re-use-tab-when-running-python-code-with-sublimerepl