Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

sublimetext3

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.

like image 241
kinORnirvana Avatar asked Dec 12 '13 10:12

kinORnirvana


People also ask

How do I select multiple files in Sublime Text?

Multiple Selections To select multiple regions using the keyboard, select a block of text, then press Ctrl+Shift+L to split it into one selection per line. When you're done with using multiple selections, just press Ctrl+K to trim all but the first.

How do I add multiple projects in Sublime Text 3?

There are 2 ways that you can do is. 1) Select the option from Project -> Add project to folder and select project menu. 2) You can also drag your folder to the sublime.


2 Answers

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.

like image 103
ptim Avatar answered Sep 18 '22 17:09

ptim


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 
like image 27
Sam Avatar answered Sep 16 '22 17:09

Sam