【问题标题】:Increase number of recent projects in Sublime Text 2?在 Sublime Text 2 中增加最近项目的数量?
【发布时间】:2013-04-02 16:20:12
【问题描述】:

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

【问题讨论】:

    标签: sublimetext2


    【解决方案1】:

    编辑此文件:

    ~/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 个最近的项目

    【讨论】:

    • 成功了!如果 Windows 上的任何人(比如我自己)想知道该文件的位置,它位于:\AppData\Roaming\Sublime Text 2\Packages\Default
    • 它有效。太糟糕了,这是一个 hack,而不是设置中的实际配置。如果 Sublime 得到更新,修改后的配置可能会被覆盖。
    • 对于 ST3:将此建议与 stackoverflow.com/questions/20540492/… 中的答案结合起来效果很好
    • 如果您只是想查找您打开的文件/文件夹/项目并且它比您在菜单中看到的更远,您还可以查看~/.config/sublime-text-2/Settings/Session.sublime_session(或Auto Save Session.sublime_session) . Sublime 会记住最后一百左右的条目。
    • Dale,在 Windows 中哪里可以找到这个?
    【解决方案2】:

    对于 sublime text 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 的行,因为它们存在于原始菜单中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-12-30
      • 2013-02-18
      • 1970-01-01
      • 1970-01-01
      • 2020-07-20
      • 2014-12-06
      • 1970-01-01
      • 2013-01-16
      相关资源
      最近更新 更多