How can I remap CTRL-h in Mac OS X?

3

1

I'd like to remap CTRL + H from delete to nothing in Leopard.

Justin Tanner

Posted 2009-08-21T03:58:46.547

Reputation: 615

Was trying to get http://emacsformacosx.com/ to work. Still no luck.

– Justin Tanner – 2011-07-24T07:35:08.517

Did you try to fix it for the emacs command-line client? Aquamacs? or what? – jtbandes – 2009-09-02T06:23:50.320

Answers

5

The default ⌃H behavior comes from the Standard Key Bindings file in the AppKit framework resources. You can override this easily.

Create a file with this as the contents:

{ "^h" = ""; }

And save it to ~/Library/KeyBindings/DefaultKeyBinding.dict, creating the KeyBindings folder if it doesn't exist. (Note: you will need to restart your applications for this to start working.)

(Another side note: I'm not entirely sure if using "" is the right way to make it do nothing, but it works. The documentation I found said nothing about any no-op methods.)

jtbandes

Posted 2009-08-21T03:58:46.547

Reputation: 8 350

Looks like you can use "noop:" as nothing.

Interesting but install can't get this to override the system behavior – Justin Tanner – 2009-08-28T04:05:06.837

I'm absolutely sure it works for me. Are you sure you're restarting your applications? Maybe try logging out and back in, or restarting your computer. Note, this will only work in apps which use the normal OS X text entry, no old nasty Carbon apps, I'm pretty sure. – jtbandes – 2009-08-28T05:40:15.583

1Also make sure you're putting it in the right place, your library folder. A good way to test would be to change it to "^h" = ("insertText:", "ctrl-h pressed"); temporarily, or testing things besides ^h. (I think "noop:" only works because it's not actually a method, so nothing happens.) – jtbandes – 2009-08-28T05:42:55.250

Okay good i was able to remap ^h for most apps except emacs 23.1 ( the app i really cared about ), which is cocoa i believe. – Justin Tanner – 2009-09-02T02:32:11.987

1

DoubleCommand will let you do this.

John T

Posted 2009-08-21T03:58:46.547

Reputation: 149 037

I tried double command but it froze my keyboard completely – Justin Tanner – 2009-08-21T05:09:59.227

0

If DoubleCommand isn't working for you you could try creating your own keyboard layout using something like Ukelele. I've never done it though, so i'm not sure how much work it is.

Alex.Bullard

Posted 2009-08-21T03:58:46.547

Reputation: 291