How to increase number of recent files in Sublime Text 3?
Is it possible to increase the number of recent files that appear in the File -> Open recent menu in Sublime Text 3 (Ubuntu)?
I have already read Increase number of recent projects in Sublime Text 2?
And I can't find this ~/Library folder at my PC. I can find ~/.config/sublime-text-3/Packages but there's no "Default" subfolder inside.
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:
- Command+Shift+p
- type 'resource' and select 'PackageResourceViewer: Open resource'
- you see a list of available packages: select 'Default'
- select 'Main.sublime-menu'
- 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). -
As per Rufus_12's answer, alter the number of
open_recent_folder
andopen_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.
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