9

I have a USB keyboard where I swapped my Cmd and Ctrl keys, because I come from the world of Linux and that's just what I'm used to.

However, this causes a problem in the Terminal because all of a sudden the Ctrl key (used for escapes and whatnot [^C, ^D, and so on]) is in the wrong place. As a result, I keep accidentally pressing the wrong key.

Is there a way to swap my Cmd and Ctrl keys again only in Terminal (so that the keys are all in the right place)?

  • 3
    You probably don't want to hear this... but it's far simpler, long-term, to just learn the new paradigm. – Tetsujin Apr 25 '16 at 18:31
  • 2
    @Tetsujin While that sounds good on paper, it still is a pretty big pain especially if you're constantly booting back and forth between Linux and OS X. – Kaz Wolfe Apr 25 '16 at 19:14
  • 1
    This is what I do, on both my linux and mac, I use Capslock as control key, and on my mac, I use my control key as command. This mostly works.. but might need to get used it to on the mac as others suggest. making the capslock as control in linux as well helps maintain the relearning so that hitting capslock V capslock C also works, and using it as ctrl in things like tmux also works – Karthik T Apr 26 '16 at 7:21
18

iTerm2 will let you remap your modifier keys. This has the effect of just remapping them for terminals. Bonus: it's also a better terminal program for OS X than the built-in Terminal.app that ships with OS X.

You can alter the modifier keys on a per-profile basis as well. That lets you switch profiles for terminals depending on what you're doing with the terminal so you get the correct behaviour for local and remote sessions.

iTerm2 modifier mappings

  • how do you alter modifiers on a per-profile basis? I'd like to do this but cannot figure out how. – jstevenco Feb 16 '18 at 21:39
  • @jstevenco AFAIK you can't. Good idea though... – Ian C. Feb 19 '18 at 17:49
  • @IanC. this doesn't seem to make any effect on external keyboards. The macbook keyboard is now working with switched keys but the external one is not – harpratap Dec 3 '18 at 0:15
  • @harpratap you have to set it when the external keyboard is synced and working with your machine. System Preferences lets you set it differently for each keyboard. – Ian C. Dec 3 '18 at 3:19
6

You may find "Karabiner" app to fit your needs. I have used this app for similar reasons as to swap keys with modifiers.

You won't find a per app setting in the preferences. You will, however, find a setting where you can switch the left 'command' key with the left 'control' key ONLY in certain apps (ie. Terminal, Chrome, Emacs, etc.)

You can do a filtered search for "terminal" or "Command_L" to specify the effect you are seeking.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .