增加Sublime Text 2中最近的项目数量?

问题描述 投票:24回答:2

是否可以增加Sublime Text 2中“项目->最近的项目”菜单中显示的最近的项目数量?我已经搜索了设置,但没有找到任何内容。

sublimetext2
2个回答
39
投票

编辑此文件:

~/Library/Application Support/Sublime Text 2/Packages/Default/Main.sublime-menu

在715行附近,您将看到此:

"caption": "Recent Projects",
            "mnemonic": "R",
            "children":
            [
                { "command": "open_recent_project", "args": {"index": 0 } },
                { "command": "open_recent_project", "args": {"index": 1 } },
                { "command": "open_recent_project", "args": {"index": 2 } },
                { "command": "open_recent_project", "args": {"index": 3 } },
                { "command": "open_recent_project", "args": {"index": 4 } },
                { "command": "open_recent_project", "args": {"index": 5 } },
                { "command": "open_recent_project", "args": {"index": 6 } },
                { "command": "open_recent_project", "args": {"index": 7 } },
                { "command": "open_recent_project", "args": {"index": 8 } },
                { "command": "open_recent_project", "args": {"index": 9 } },
                { "caption": "-" },
                { "command": "clear_recent_projects", "caption": "Clear Items" }
            ]

添加其他行

{ "command": "open_recent_project", "args": {"index": n } },

I.E。

"caption": "Recent Projects",
            "mnemonic": "R",
            "children":
            [
                { "command": "open_recent_project", "args": {"index": 0 } },
                { "command": "open_recent_project", "args": {"index": 1 } },
                { "command": "open_recent_project", "args": {"index": 2 } },
                { "command": "open_recent_project", "args": {"index": 3 } },
                { "command": "open_recent_project", "args": {"index": 4 } },
                { "command": "open_recent_project", "args": {"index": 5 } },
                { "command": "open_recent_project", "args": {"index": 6 } },
                { "command": "open_recent_project", "args": {"index": 7 } },
                { "command": "open_recent_project", "args": {"index": 8 } },
                { "command": "open_recent_project", "args": {"index": 9 } },
                { "command": "open_recent_project", "args": {"index": 10 } },
                { "caption": "-" },
                { "command": "clear_recent_projects", "caption": "Clear Items" }
            ]

现在您有11个最近的项目


0
投票

对于崇高的文字3,我建议(基于https://stackoverflow.com/a/34512015/3061838)将具有以下内容的新文件Main.sublime-menu添加到%APPDATA%\Sublime Text 3\Packages\User文件夹中

[
    {
        "caption": "Project",
        "id": "project",
        "mnemonic": "P",
        "children":
        [
            {
                "caption": "Open Recent More",
                "children":
                [
                    { "command": "open_recent_project_or_workspace", "args": {"index": 0 } },
                    { "command": "open_recent_project_or_workspace", "args": {"index": 1 } },
                    { "command": "open_recent_project_or_workspace", "args": {"index": 2 } },
                    { "command": "open_recent_project_or_workspace", "args": {"index": 3 } },
                    { "command": "open_recent_project_or_workspace", "args": {"index": 4 } },
                    { "command": "open_recent_project_or_workspace", "args": {"index": 5 } },
                    { "command": "open_recent_project_or_workspace", "args": {"index": 6 } },
                    { "command": "open_recent_project_or_workspace", "args": {"index": 7 } },
                    { "command": "open_recent_project_or_workspace", "args": {"index": 8 } },
                    { "command": "open_recent_project_or_workspace", "args": {"index": 9 } },
                    { "command": "open_recent_project_or_workspace", "args": {"index": 10 } },
                    { "command": "open_recent_project_or_workspace", "args": {"index": 11 } },
                    { "command": "open_recent_project_or_workspace", "args": {"index": 12 } },
                    { "command": "open_recent_project_or_workspace", "args": {"index": 13 } },
                    { "command": "open_recent_project_or_workspace", "args": {"index": 14 } },
                    { "command": "open_recent_project_or_workspace", "args": {"index": 15 } },
                    { "caption": "-" },
                    { "command": "clear_recent_projects_and_workspaces", "caption": "Clear Items" }
                ]
            },
        ]
    },]

此解决方案的优点是它将在Sublime Text更新中保留下来。缺点是您将有2个最近打开的菜单。

您可以选择删除索引为0-7的行,因为它们出现在原始菜单中。

© www.soinside.com 2019 - 2024. All rights reserved.