Re-use tab when running python code with SublimeREPL

北城以北 提交于 2019-11-29 01:21:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!