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

8,818

Solution 1

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.)

Solution 2

DoubleCommand will let you do this.

Share:
8,818

Related videos on Youtube

Justin Tanner
Author by

Justin Tanner

Programming is fun.

Updated on September 17, 2022

Comments

  • Justin Tanner
    Justin Tanner over 1 year

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

    • Assembler
      Assembler over 14 years
      Did you try to fix it for the emacs command-line client? Aquamacs? or what?
    • Justin Tanner
      Justin Tanner almost 13 years
      Was trying to get emacsformacosx.com to work. Still no luck.
  • Justin Tanner
    Justin Tanner over 14 years
    I tried double command but it froze my keyboard completely
  • Justin Tanner
    Justin Tanner over 14 years
    Looks like you can use "noop:" as nothing. Interesting but install can't get this to override the system behavior
  • Assembler
    Assembler over 14 years
    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.
  • Assembler
    Assembler over 14 years
    Also 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.)
  • Justin Tanner
    Justin Tanner over 14 years
    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.