Create global tab-changing keyboard shortcuts
Mar 31, '10 07:30:00AM
Contributed by: nathanator11
In OS X, you can change Spaces, apps, and windows with the keyboard. What's missing? An easy way to globally navigate tabs in a Web browser, Terminal window, or other tabbed program. Many programs come with a keyboard shortcut to change tabs, but they vary by program and are frequently hard to reach. The solution: use System Preferences to change the shortcut to a single, easy-to-reach command for all programs.
I'll go through the steps of creating a shortcut for Apple's Safari browser. Other programs work the same way.
- Open System Preferences and go to the Keyboard Shortcuts tab of the Keyboard Pane. Click Application Shortcuts in the list on the left, and then the [+] button to add a new shortcut.
- Open the application you want to create a shortcut for, and find the Menu Bar commands to switch tabs (usually in the Window menu). Remember exactly what they are called. In Safari, they are Select Next Tab and Select Previous Tab.
- Back in System Preferences, set the Application menu to the app you want the shortcut to apply to (in this case, Safari). Type the name of the command to go to the next tab (in this case, Select Next Tab). Select the Keyboard Shortcut: field and press your desired shortcut. In my case, I used Command-Period. Click Add to make your new shortcut.
- Do the same thing for the Select Previous Tab command (for Safari), and set it to another shortcut. I used Command-Comma. Because Command-Comma is already used for Preferences, I created a new (global, all applications) shortcut for the Preferences... command with the shortcut Shift-Command-Comma.
Now try out your commands in Safari (restarting Safari shouldn't be necessary). Open a few tabs and press Command-Comma and Command-Period to cycle through tabs, left and right respectively. If you're at the first tab and press Command-Comma, you are taken to the last tab; you'll go to the first tab from the last with Command-Period.
Complete this process with other tabbed programs you use, such as Chrome, Firefox, other browsers, Terminal, and anything else that has a menu bar command to change tabs.
These shortcuts are very easy to hit, but can take a little getting used to. It's worth it! It takes very little time to use these combinations, especially compared to the mouse or trackpad.
[robg adds: This is a semi-obvious but great idea, and you can extend it beyond tabs. I've set the same shortcuts to switch between open documents in BBEdit, for instance. Personally, I wouldn't choose Command-Period and Command-Comma, because both have other meanings in various programs. I've used Command-Option and the Left/Right arrow keys, which is still fairly easy to type and very easy to remember.]
Comments (16)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20100326171150707