By josh / June 7, 2014

How to learn any keyboard shortcut in Sublime Text

Sublime Text has keyboard shortcuts for almost everything, but it’s sometimes hard to track them down. Here a few strategies that will help you uncover the shortcuts for all of your favorite features.

Dedicate a few minutes to browsing through Sublime’s menus.

Looking at the menus when you’re not already on a mission to find something specific is a great way to discover new features. And in many cases, the keyboard shortcuts are listed right next to the command, which is handy when you forget a shortcut you don’t use very often.

Now pretend the menus don’t exist.

Get comfortable using the Command Palette for everything. The Command Palette is Sublime’s equivalent of an Easy Button—you can use it to perform almost any command without reaching for the mouse, even if you can’t remember the keyboard shortcut. Using it gets you out of the habit of reaching for the mouse all the time, and it’s still usually faster than using the menus.

And as you enter commands, take note: In many cases the keyboard shortcuts are listed right next to the name of the command.

When you can’t find a shortcut in the menus, it’s time to dig.

Open the default keybindings file for your operating system by launching the Command Palette and entering keybindings default. This is the master file where Sublime defines all of its default keyboard shortcuts.

It’s not always obvious what the shortcuts are mapped to because the shortcuts use the Sublime API terms for commands, but you can often find what you’re looking for. For example, the Distraction Free Mode shortcut, which I was trying to remember while writing this email, is Command+Shift+Ctrl+F on my Mac. If you search for “distraction” in the keybindings file, you’ll see that this shortcut is bound to the command toggle_distraction_free. Clear enough.

Shortcuts for plugins are a little trickier.

Most won’t show up in the Command Palette or application menus. But since all keyboard shortcuts are defined in easily readable JSON-formatted files , you can uncover them with a little detective work. Open the Command Palette and type browse packages to open the Packages folder, then hunt around for the name of the plugin you’re interested in. Once you find the folder, look for the keybinding file, which will have a sublime-keymap extension.

Many plugins put a link to the keybindings file under the Preferences | Package Settings menu, which is a lot more convenient than hunting through folders. If your favorite plugin doesn’t include a menu entry for its keyboard shortcuts, consider creating the entry yourself and submitting a pull request to the plugin’s owner.

P.S. Want to improve your mastery of Sublime Text? Start here:

http://sublimetexttips.com/newsletter

About the author

josh

Click here to add a comment

Leave a comment: