在Sublime Text 3中将单独的Windows(和其中的选项卡)合并为一个

时间:2014-08-10 23:21:59

标签: tabs sublimetext3

在我的Mac上,我使用SublimeText 3中的很多标签和窗口。我经常喜欢拉出标签来创建一个新窗口,但后来我希望能够轻松地整合它们。

场景:我打开了两个SublimeText窗口,每个窗口都有5个选项卡。现在,我想将窗口2的所有选项卡合并到窗口1中,因此我只有一个剩余窗口,其中包含10个选项卡。

Chrome有一个名为Merge Windows的精彩扩展程序,可以完美地演示此行为。

我如何在SublimeText 3中执行此操作?

4 个答案:

答案 0 :(得分:9)

我创建了一个sublime包来帮助解决这个名为Merge Windows的问题。

可以使用 github

Package Control或通过Sublime下载

答案 1 :(得分:6)

这并不是你要求的,但我认为这已经足够了:

从"来源"拖动标签窗口到"目标"窗口和悬停在源窗口中的其他选项卡附近。然后放在那里。瞧。您已移动了一个标签。 冲洗并重复其他标签。

答案 2 :(得分:2)

[不确定其他操作系统,但对于MAC而言,这非常简单而且非常有用]

在Mac中,打开Sublime,

click Window -> Click Merge all Windows

还要确保如果只打开一个很明显的窗口,则此操作将不起作用。

答案 3 :(得分:0)

这是可行的,但不受支持,如果你陷入困境,可能会泄露你的缓冲区。所以备份这个文件。

/ Users / username / Library / Application Support / Sublime Text 3 / Local / Session.sublime_session

此文件包含所有会话数据,所有窗口,标签搜索历史记录等。

您可以按照以下说明将整个标签窗口从一个窗口移动到另一个窗口:

寻找" Windows" JSON条目,其中是一个窗口列表,列表用[]括号表示,并以逗号分隔。在每个窗口的内部'进入' Windows'列表是"缓冲区"列表,每个'缓冲区'代表一个标签。 还有一个"组"包含"表格的列表"列表功能相同,但包含有关选项卡的信息,而不是内容。

我们对此练习中没有其他一些数据,但在打开Sublime之前,文件通过JSON验证非常重要。

"windows":
[
    {
        "auto_complete":
        {
            "selected_items":
            [
            ]
        },
        "buffers":
        [
            {
                "contents": "This tab has not been saved and is in Window 1",
                "settings":
                {
                    "buffer_size": 46,
                    "line_ending": "Unix",
                    "name": "This tab has not been saved and is in Window 1"
                }
            },
            {
                "file": "/Users/username/Desktop/This file has been saved and not changed and is in Window 1",
                "settings":
                {
                    "buffer_size": 59,
                    "line_ending": "Unix",
                    "name": "This file has been saved and not changed and is in Window 1"
                }
            }
        ],
        "groups":
        [
            {
                "selected": 0,
                "sheets":
                [
                    {
                        "buffer": 0,
                        "semi_transient": false,
                        "settings":
                        {
                            "buffer_size": 46,
                            "regions":
                            {
                            },
                            "selection":
                            [
                                [
                                    46,
                                    46
                                ]
                            ],
                            "settings":
                            {
                                "auto_name": "This tab has not been saved and is in Window 1",
                                "syntax": "Packages/Text/Plain text.tmLanguage"
                            },
                            "translation.x": 0.0,
                            "translation.y": 0.0,
                            "zoom_level": 1.0
                        },
                        "stack_index": 0,
                        "type": "text"
                    },
                    {
                        "buffer": 1,
                        "file": "/Users/username/Desktop/This file has been saved and not changed and is in Window 1",
                        "semi_transient": false,
                        "settings":
                        {
                            "buffer_size": 59,
                            "regions":
                            {
                            },
                            "selection":
                            [
                                [
                                    59,
                                    59
                                ]
                            ],
                            "settings":
                            {
                                "auto_name": "This file has been saved and not changed and is in",
                                "syntax": "Packages/Text/Plain text.tmLanguage"
                            },
                            "translation.x": 0.0,
                            "translation.y": 0.0,
                            "zoom_level": 1.0
                        },
                        "stack_index": 1,
                        "type": "text"
                    }
                ]
            }
        ]
    },
    {
        "buffers":
        [
            {
                "contents": "This tab is also unsaved and in Window 2.",
                "settings":
                {
                    "buffer_size": 41,
                    "line_ending": "Unix",
                    "name": "This tab is also unsaved and in Window 2."
                }
            }
        ],
        "groups":
        [
            {
                "selected": 0,
                "sheets":
                [
                    {
                        "buffer": 0,
                        "semi_transient": false,
                        "settings":
                        {
                            "buffer_size": 41,
                            "regions":
                            {
                            },
                            "selection":
                            [
                                [
                                    41,
                                    41
                                ]
                            ],
                            "settings":
                            {
                                "auto_name": "This tab is also unsaved and in Window 2.",
                                "syntax": "Packages/Text/Plain text.tmLanguage"
                            },
                            "translation.x": 0.0,
                            "translation.y": 0.0,
                            "zoom_level": 1.0
                        },
                        "stack_index": 0,
                        "type": "text"
                    }
                ]
            }
        ]
    }

如果您重新定位每个缓冲区'从第二个窗口进入'到第一个结尾,并重复每个表格#39;在'组'。然后更新'缓冲区'对于每个工作表条目,要更高的数字,它们应该是先前存在的条目之后的顺序。当您打开Sublime 3时,您会注意到Window 2中的所有选项卡现在都在Window 1中。

编辑过的会话文件看起来有点像这样:

    "windows":
[
    {
        "auto_complete":
        {
            "selected_items":
            [
            ]
        },
        "buffers":
        [
            {
                "contents": "This tab has not been saved and is in Window 1",
                "settings":
                {
                    "buffer_size": 46,
                    "line_ending": "Unix",
                    "name": "This tab has not been saved and is in Window 1"
                }
            },
            {
                "file": "/Users/username/Desktop/This file has been saved and not changed and is in",
                "settings":
                {
                    "buffer_size": 59,
                    "line_ending": "Unix",
                    "name": "This file has been saved and not changed and is in"
                },

            },
            {
                "contents": "This tab is also unsaved and in Window 2.",
                "settings":
                {
                    "buffer_size": 41,
                    "line_ending": "Unix",
                    "name": "This tab is also unsaved and in Window 2."
                }
            }
        ],
        "groups":
        [
            {
                "selected": 0,
                "sheets":
                [
                    {
                        "buffer": 0,
                        "semi_transient": false,
                        "settings":
                        {
                            "buffer_size": 46,
                            "regions":
                            {
                            },
                            "selection":
                            [
                                [
                                    46,
                                    46
                                ]
                            ],
                            "settings":
                            {
                                "auto_name": "This tab has not been saved and is in Window 1",
                                "syntax": "Packages/Text/Plain text.tmLanguage"
                            },
                            "translation.x": 0.0,
                            "translation.y": 0.0,
                            "zoom_level": 1.0
                        },
                        "stack_index": 0,
                        "type": "text"
                    },
                    {
                        "buffer": 1,
                        "file": "/Users/username/Desktop/This file has been saved and not changed and is in",
                        "semi_transient": false,
                        "settings":
                        {
                            "buffer_size": 59,
                            "regions":
                            {
                            },
                            "selection":
                            [
                                [
                                    59,
                                    59
                                ]
                            ],
                            "settings":
                            {
                                "auto_name": "This file has been saved and not changed and is in",
                                "syntax": "Packages/Text/Plain text.tmLanguage"
                            },
                            "translation.x": 0.0,
                            "translation.y": 0.0,
                            "zoom_level": 1.0
                        },
                        "stack_index": 1,
                        "type": "text"
                    },
                    {
                        "buffer": 2,
                        "semi_transient": false,
                        "settings":
                        {
                            "buffer_size": 41,
                            "regions":
                            {
                            },
                            "selection":
                            [
                                [
                                    41,
                                    41
                                ]
                            ],
                            "settings":
                            {
                                "auto_name": "This tab is also unsaved and in Window 2.",
                                "syntax": "Packages/Text/Plain text.tmLanguage"
                            },
                            "translation.x": 0.0,
                            "translation.y": 0.0,
                            "zoom_level": 1.0
                        },
                        "stack_index": 0,
                        "type": "text"
                    }
                ]
            }
        ]
    },
    {
        "buffers":
        [
        ],
        "groups":
        [
            {
                "selected": 0,
                "sheets":
                [
                ]
            }
        ]
    }

你有它。它不漂亮或不直接,但它可以完成工作,并且可以使用Python,Perl或许多其他语言编写脚本,特别是如果您使用了JSON库。