Я использую Terminus в качестве REPL в Sublime Text. В SublimeREPL есть удобная опция, позволяющая выбрать группу, в которой откроется вкладка REPL:
// Specify whether to move repls to a different Sublime Text group (frame)
// immediately on opening. Setting this to true will simply move it to
// the 'next' group from the one that was in focus when it was opened
// (one down with row layout, one to the right with column and grid
// layout). Alternatively, you can set this to the index of the group in
// which you want all repls to be opened (index 0 being the top-left group).
// Activating this option will NOT automatically change your layout/create
// a new group if it isn't open.
"open_repl_in_group": 2,
и я пытаюсь воспроизвести этот вариант с помощью Terminus. Terminus позволяет перемещать вкладку REPL, но использует команду Origami переноса_файла_to_pane, которая позволяет установить только направление новой вкладки, а не группу.
Вот что у меня есть на данный момент:
import sublime_plugin
class OpenTerminusReplCommand(sublime_plugin.TextCommand):
def run(self, edit, open_file="$file"):
# Save unsaved changes before proceeding
window = self.view.window()
for view in window.views():
if view.is_dirty() and view.file_name():
view.run_command("save")
# Return the project's specified python interpreter, if any
settings = self.view.settings()
cmd_list = settings.get("python_interpreter")
# Add file if given
if open_file:
cmd_list = [cmd_list, "$file"]
target = 2 # Group where to open the REPL
for view_i in window.views():
if view_i.id() == self.view.id():
view = view_i
break
self._window = view.window()
self._window.set_view_index(
view, target, len(self._window.views_in_group(target))
)
self._window.run_command(
"terminus_open",
{
"cmd": cmd_list,
"cwd": "$file_path",
"title": "Terminus",
"auto_close": False,
},
)
что вроде как работает, но продолжает перетаскивать вкладку, из которой я выполняю команду, на выбранную панель.
Это моя возвышенная раскладка клавиатуры сочетания клавиш:
// Run the file in a Python REPL using a Terminus
{ "keys": ["f5"], "command": "open_terminus_repl",
},
// Open an empty Python REPL using a Terminus
{ "keys": ["f4"], "command": "open_terminus_repl",
"args": {"open_file": null},
},
Подробнее здесь: https://stackoverflow.com/questions/790 ... pane-group