4

I'm trying to add to the emacs-like key bindings in OS X 10.7.5. In particular, in the default key bindings, alt-d and alt-b insert special characters, while I would like them to delete a word and move back a word. I've created a file ~\Library\KeyBindings\DefaultKeyBinding.dict with the following content:

{
    "~d" = "deleteWordForward:";
}

(as suggested in the answers to this question) and opened a new terminal window (I tried rebooting, too) but now the alt-d combination just beeps at me, and does nothing else. Any clues?

Community
  • 1
  • 1
garyp
  • 967
  • 7
  • 36
  • Can you please help me understand why the standard Emacs key-bindings don't work for you? For example, putting these inside the `.emacs` file in the home directory seem to work well: `(global-set-key (kbd "M-b") 'backward-kill-word)` `(global-set-key (kbd "M-d") 'kill-word)`. I have never had to play around with `~\Library\KeyBindings\DefaultKeyBinding.dict` and I've been using Emacs on OSX for about a year now. – lawlist Feb 21 '14 at 15:42
  • 2
    I want to use the emacs keybindings *outside* of the GUI version of emacs, e.g. in a terminal window. But specifically, the usual emacs keybindings do not work in the *console / terminal* emacsclient/server version of emacs. I use this version frequently because it starts instantly and that feature is useful for quick editing tasks, and for editing 'git' commit messages and rebase scripts. – garyp Feb 21 '14 at 19:45
  • Note that DefaultKeyBinding.dict is good for mappings in standard OS X text fields (e.g. in TextEdit, in web page text boxes, in address bars, etc.), not in Terminal. – echristopherson Feb 22 '14 at 16:45

1 Answers1

3

This should do the trick -- within the Terminal.app Keyboard settings, check the box Use option as meta key. [I verified the solution works with OSX Snow Leopard 10.6.8.] Solution obtained from here: http://iancwill.com/blog/?p=116

Example

pkamb
  • 33,281
  • 23
  • 160
  • 191
lawlist
  • 13,099
  • 3
  • 49
  • 158