25

Is it possible to increase the number of recent projects that appear in the Projects -> Recent Projects menu in Sublime Text 2? I have searched through the settings and I haven't found anything.

Steve Sanders
  • 8,444
  • 2
  • 30
  • 32

2 Answers2

42

Edit this file:

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

At around line 715 you'll see this:

"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" }
            ]

Add additional lines of

{ "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" }
            ]

Now you have 11 recent projects

AGS
  • 14,288
  • 5
  • 52
  • 67
  • 4
    That worked! If anyone on Windows (like myself) is wondering where that file is located, it is in: \AppData\Roaming\Sublime Text 2\Packages\Default – Steve Sanders Apr 08 '13 at 18:49
  • It works. Too bad it's a hack, and not an actual configuration in the settings. If Sublime gets updated, the modified configuration may be overwritten. – Gor May 15 '14 at 13:43
  • 5
    For ST3: combining this advice with the answers in http://stackoverflow.com/questions/20540492/how-to-increase-number-of-recent-files-in-sublime-text-3 works nicely – ptim May 28 '14 at 01:07
  • If you are just trying to find what file/folder/project you opened and it's further back than what you can see in the menu, you can also look inside `~/.config/sublime-text-2/Settings/Session.sublime_session` (or `Auto Save Session.sublime_session`). Sublime remembers the last hundred or so entries. – Dale C. Anderson Feb 25 '15 at 18:34
  • Dale, where can I find this in Windows? – CrazyTim Aug 03 '16 at 01:47
1

For sublime text 3 I would recommend (based on https://stackoverflow.com/a/34512015/3061838) to add a new file Main.sublime-menu to your %APPDATA%\Sublime Text 3\Packages\User folder with the following content

[
    {
        "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" }
                ]
            },
        ]
    },]

The advantage of this solution is that it will survive Sublime Text updates. The disadvantage is that you will have 2 open-recent menus.

You may choose to remove the lines with index 0-7 since they are present in the original menu.

mrtnlrsn
  • 1,105
  • 11
  • 19