ST3 Open Recent – how to Shortcut

keyboard shortcutssublime-text-3

How do I make ST3 shortcut for menu command 'File › Open Recent'? Is there an ST3 plugin that provides/allows 'Open Recent' shortcut?

ST2 had 'Open Recent' plugins with shortcuts [packagecontrol.io] – GoToRecent was Shift-Command-R and OpenRecentFiles was Command-R. Installing those plugins, users could use shortcuts to open the list of recent files displayed by menu command 'Open Recent'. Those shortcuts worked in ST2, but in ST3 the plugins are no longer supported. ST3 uses the ST2 plugin shortcuts: Command-R is now 'Go to Symbol' and Shift-Command-R is now 'Go to Symbol in Project'…

Sublime Text › Preferences › Key Bindings… 'open' and 'recent' not even present.

Mac System Preferences › Keyboard › Shortcuts › App shortcuts… Try many shortcuts, nothing works. 'Unofficial Documentation' would indicate that we need to target a plugin behavior with a shortcut. Sublime Key Bindings are not available, so that plugin would have to provide keybindings to support its own shortcut.

Best Answer

I know it's been a year since you asked this, but ...

You can open the Quick Switch Project dialog using ctrl+alt+p (this actually this runs the prompt_select_workspace command). Selecting a Project form the dialog will close your current project and replace it with the selected project. While that has its uses, I wanted to actually open multiple recent projects at the same time.

What I ended up doing was mapping ctrl+super+p 1 to open the recent project, ctrl+super+p 2 for the next most recent, and so on for the top 5. So, to open the most recent project, I hit ctrl+super+p then hit 1.

I did this by adding keymappings to the the Default keymap for User. To do this yourself, from the main menu, select "Preferences" -> "Key Bindings". Sublime will open 2 files: "Default" (on the left) and "User" (on the right). Add the following to the "User" file:

{ "keys": ["ctrl+super+p", "1"], "command": "open_recent_project_or_workspace", "args": {"index" : 0} },
{ "keys": ["ctrl+super+p", "2"], "command": "open_recent_project_or_workspace", "args": {"index" : 1} },
{ "keys": ["ctrl+super+p", "3"], "command": "open_recent_project_or_workspace", "args": {"index" : 2} },
{ "keys": ["ctrl+super+p", "4"], "command": "open_recent_project_or_workspace", "args": {"index" : 3} },
{ "keys": ["ctrl+super+p", "5"], "command": "open_recent_project_or_workspace", "args": {"index" : 4} },

It should look something like this: enter image description here

You could map something like crtl+super+o 1 to open the most recent file (I use crtl+shitft+t to undo the last closed file ...a lot). To that same "User" file, add:

{ "keys": ["ctrl+super+o", "1"], "command": "open_recent_file", "args": {"index" : 0} },
{ "keys": ["ctrl+super+o", "2"], "command": "open_recent_file", "args": {"index" : 1} },
{ "keys": ["ctrl+super+o", "3"], "command": "open_recent_file", "args": {"index" : 2} },
{ "keys": ["ctrl+super+o", "4"], "command": "open_recent_file", "args": {"index" : 3} },
{ "keys": ["ctrl+super+o", "5"], "command": "open_recent_file", "args": {"index" : 4} },

Hope this helps!

Related Question