修改 tab 中 SublimeREPL 的标题

Modify title of SublimeREPL in tab

我正在使用 SublimeREPL 包。代码为 运行 的选项卡中的标题很长,导致浏览选项卡很麻烦:

能否修改REPL标签中显示的标题and/or一起抑制?

answer you linked 中,其中一个步骤是为 运行 您的 virtualenv REPL 创建自定义插件。您可以通过更改 repl_open 方法以传递 "external_id" 键和值来自定义选项卡的标题。这是修改后的插件代码:

import sublime_plugin


class ProjectVenvReplCommand(sublime_plugin.TextCommand):
    """
    Starts a SublimeREPL, attempting to use project's specified
    python interpreter.
    """

    def run(self, edit, open_file='$file', name='Python'):
        """Called on project_venv_repl command"""
        cmd_list = [self.get_project_interpreter(), '-i', '-u']

        if open_file:
            cmd_list.append(open_file)

        self.repl_open(cmd_list=cmd_list, name=name)

    def get_project_interpreter(self):
        """Return the project's specified python interpreter, if any"""
        settings = self.view.settings()
        return settings.get('python_interpreter', '/usr/bin/python')

    def repl_open(self, cmd_list, name):
        """Open a SublimeREPL using provided commands"""
        self.view.window().run_command(
            'repl_open', {
                'encoding': 'utf8',
                'type': 'subprocess',
                'cmd': cmd_list,
                'cwd': '$file_path',
                'syntax': 'Packages/Python/Python.sublime-syntax',
                'external_id': name
            }
        )

在这里您可以修改发送给插件的参数以定义选项卡的名称(默认为 Python):

{
    "keys": ["f6"],
    "command": "project_venv_repl",
    "args": {
        "open_file": null,
        "name": "My Project Name"  // insert name of choice here.
    }
},