How to increase number of recent files in Sublime Text 3?

The Default package in Sublime Text 3 on Linux is stored in (assuming you used the .deb installer) /opt/sublime_text/Packages/Default.sublime-package.

Default.sublime-package is a ZIP file, if you open it and extract the Main.sublime-menu file from it into ~/.config/sublime-text-3/Packages/Default/Main.sublime-menu, it can then be edited the same way as the linked answer describes.

Alternatively run following commands which will create the Default directory and extract the Main.sublime-menu file into it:

mkdir ~/.config/sublime-text-3/Packages/Default/
unzip -p /opt/sublime_text/Packages/Default.sublime-package Main.sublime-menu > ~/.config/sublime-text-3/Packages/Default/Main.sublime-menu

On OSX, at least, the Default.sublime-package is in the application itself: /Applications/Sublime Text.app/Contents/MacOS/Packages/Default.sublime-package.

To edit the config easily without changes being overwritten on update, you need a copy of Main.sublime-menu in your Packages directory ~/Library/Application Support/Sublime Text 3/Packages/Default/Main.sublime-menu

The easiest way to effect these changes is to install the excellent PackageResourceViewer by skuroda (using Package Control), then:

  1. Command+Shift+p
  2. type 'resource' and select 'PackageResourceViewer: Open resource'
  3. you see a list of available packages: select 'Default'
  4. select 'Main.sublime-menu'
  5. PackageResourceViewer now copies Main.sublime-menu into the correct location and opens the new file for editing (note: the file doesn't seem to be actually created in the filesystem until hitting save, and updates seem immediately visible without requiring an update).
  6. As per Rufus_12's answer, alter the number of open_recent_folder and open_recent_file statements that appear, increasing the index each time.

    { "command": "open_recent_folder", "args": {"index": 0 } },
    { "command": "open_recent_folder", "args": {"index": 1 } },
    { "command": "open_recent_folder", "args": {"index": 2 } },
    { "command": "open_recent_folder", "args": {"index": 3 } },
    { "command": "open_recent_folder", "args": {"index": 4 } },
    { "command": "open_recent_folder", "args": {"index": 5 } },
    { "command": "open_recent_folder", "args": {"index": 6 } },
    ...continue as many times as necessary... 
    

Update re: maintainability

As @drevicko points out, this method will not auto-update with Sublime, and may even cause conflicts in future.

@James' answer (editing the Packages/User/Default/Main.sublime-menus) is indeed update-proof, but does, unfortunately, result in a duplicate sub-menu (the duplicate entries appear for me at the very bottom of the menu). The user settings file is merged with the defaults, but in a manner which results in duplicate keys.

I find that if I update Packages/Default/Main.sublime-menus, then that file completely replaces the default (delete chunks and see your menus disappear in real time!) - my new file and the defaults are not merged.

In order to: a) avoid a duplicate entry, and b) stay current with Sublime updates, I can't see an alternative to tracking changes to the file using git, and when Sublime updates, repeating the Open Resource process (overwriting your edits), then reverting only relevant changes.

Tags:

Sublimetext3