How can I change the keyboard shortcut for switching tabs in Mac Terminal?

79

11

I know that you can switch tabs with shift cmd [arrow key] in Mac Terminal, but it is painful to reach the arrow key. How can I change the default keybinding?

Léo Léopold Hertz 준영

Posted 2009-03-12T20:58:16.577

Reputation: 4 828

Not quite programming-related enough for my tastes. – Dana – 2009-03-12T21:00:03.920

@Dana: It may be: I do not know whether I need to change some rc files such as in the xmodmap case. – Léo Léopold Hertz 준영 – 2009-03-12T21:08:25.523

4Use the Cmd and Shift keys next to the arrow keys. – Daniel Beck – 2011-09-29T06:24:17.163

Answers

62

Before Sierra (El Capitan and earlier), the window menu shows a different shortcut key.

Igor

Posted 2009-03-12T20:58:16.577

Reputation: 800

3I just learned that you can change keybindings that appear on menus, and I've been using OS X for about 3 years. I think that step is not trivial. – Jan Segre – 2014-08-14T05:01:01.843

3The screenshot didn't help me att all. In fact it misled me. On top of that, I just cannot find any way to change the shortcut key for the Next and Previous go to tabs keys of the Terminal. Some one would give additional details on where to configure this change ? – Stephane – 2015-03-23T11:57:23.853

21In what way does this answer the question? (I know the answer, but I don’t see how this helps anyone who didn’t already know how to customize menu item shortcut keys using System Preferences.) – Chris Page – 2012-06-14T23:29:09.837

1@ChrisPage Those are defaults. I haven't set up any special shortcut keys, and they are present in mine. – Ben Mordecai – 2013-01-31T05:33:51.007

4@BenMordecai So, if this answer had a written answer (rather than just a screenshot), it would read “by default there are already command keys that don’t use the arrow keys, so you don’t need to change the default keybinding”? I ask because the question appears to be “How can I change the default keybinding?”, which isn’t mentioned in this, the currently accepted answer. – Chris Page – 2013-02-01T00:44:59.703

@ChrisPage, well the main question is how to switch tabs efficiently. The OP assumed the answer would have to do with remapping the bindings, but when he saw the screenshot it solved the issue. Your comment gave the impression that this answer had a missing step, namely, remap the key of the menu item, so I was clarifying that the implied step isn't necessary. – Ben Mordecai – 2013-02-01T01:03:43.867

Ha! That works for Safari and Chrome too. – daviewales – 2013-02-13T14:39:33.520

52

You can change key bindings for almost all Cocoa apps in System Preferences, including Terminal.app.

Go to System Preferences > Keyboard > Shortcuts > App Shortcuts, then add a new shortcut for Terminal (located in /Applications/Utilities).

guns

Posted 2009-03-12T20:58:16.577

Reputation: 631

1Where? I don't see anything under System Preferences > Keyboard > Shortcuts. – Ian Dunn – 2015-05-02T00:16:08.443

5Click on "App Shortcuts" then click on the "+" button. In the Application drop-down box, scroll all the way down and select "Other..." and go to "/Applications/Utilities" folder and select Terminal. Then type "Show Next Tab" or whichever menu shortcut you want to replace. Then type the keyboard shortcut you want. And then click "Add". – jojo – 2015-10-28T19:49:32.793

2It seems you can't utilise all the keys this way. For example I can't use PageUp / PageDown for shortcuts defined here. – Chris – 2016-04-15T23:54:52.483

3This should be the accepted answer. Thank you for this. – Damon – 2017-01-31T10:47:16.777

I'll try that, thanks! Using the default shortcuts is very cumbersome on a Macbook without mouse. – None – 2010-03-17T10:00:11.653

6

1: Install SIMBL (plugin enabler): http://www.culater.net/software/SIMBL/SIMBL.php

2: Install the TerminalTabSwitching.bundle

git clone https://github.com/dabeeeenster/terminaltabswitching
cp -r terminaltabswitching/TerminalTabSwitching.bundle "/Library/Application Support/SIMBL/Plugins"

3: Restart the Terminal app, and enjoy Cmd+[0-9] tab-switching.

FYI: If something like plugin is not verified in terminal version # (a number) appears when you open your terminal again, maybe the following information can help.

(1) Open

/Library/Application\ Support/SIMBL/Plugins/Terminal/TerminalTabSwitching.bundle/Contents/Info.plist

using your favorite text editor under sudo.

(2) Search For <key>MaxBundleVersion</key>.

(3) Change <string>280</string> at next line to your terminal version number or higher like <string>300</string>. Save.

(4) Quit terminal and reopen it. Hopefully that prompt would disappear and you can use Cmd+[0:9] for tab switching.

Roberto

Posted 2009-03-12T20:58:16.577

Reputation:

guns's answer above is spot on. this answer is too complicated – angry kiwi – 2019-07-14T08:27:09.737

4

cmd brace will also switch tabs.

Jeremy L

Posted 2009-03-12T20:58:16.577

Reputation: 2 587

4

If you don't mind downloading new software, I recommend iTerm 2: http://www.iterm2.com/#/section/home

It not only allows rebinding keys almost arbitrarily plus fast switching between tabs with cmd+TabNumber (or your favorite meta key), but quite a few other nifty features as well.

(I would post a screen shot, but I'm new around here).

jhclark

Posted 2009-03-12T20:58:16.577

Reputation: 203

Down-voted because it doesn’t really answer the question, and there’s nothing stopping the user from customizing the shortcuts in Terminal using System Preferences, the usual answer for this type of question. – Chris Page – 2013-02-01T00:47:31.977