0

I want to learn emac keybindings, but I have a bad habit of using arrow keys. Is there a way to disable the arrow keys temporarily (through software)?

0

You can disable them in most text views by saving a property list like this as ~/Library/KeyBindings/DefaultKeyBinding.dict:

{
    "\UF700" = noop:;
    "\UF701" = noop:;
    "\UF702" = noop:;
    "\UF703" = noop:;
    "$\UF700" = noop:;
    "$\UF701" = noop:;
    "$\UF702" = noop:;
    "$\UF703" = noop:;
    "~\UF700" = noop:;
    "~\UF701" = noop:;
    "~\UF702" = noop:;
    "~\UF703" = noop:;
    "~$\UF700" = noop:;
    "~$\UF701" = noop:;
    "~$\UF702" = noop:;
    "~$\UF703" = noop:;
    "@\UF700" = noop:;
    "@\UF701" = noop:;
    "@\UF702" = noop:;
    "@\UF703" = noop:;
    "@$\UF700" = noop:;
    "@$\UF701" = noop:;
    "@$\UF702" = noop:;
    "@$\UF703" = noop:;
}

If you use bash, you can disable arrow keys (without other modifier keys) by adding this to ~/.inputrc:

"\e[A":
"\e[B":
"\e[C":
"\e[D":

If you want to disable them completely, you can add this to KeyRemap4MacBook's private.xml:

<autogen>__KeyToKey__ KeyCode::CURSOR_LEFT, KeyCode::VK_NONE</autogen>
<autogen>__KeyToKey__ KeyCode::CURSOR_RIGHT, KeyCode::VK_NONE</autogen>
<autogen>__KeyToKey__ KeyCode::CURSOR_UP, KeyCode::VK_NONE</autogen>
<autogen>__KeyToKey__ KeyCode::CURSOR_DOWN, KeyCode::VK_NONE</autogen>

This would only disable them in TextMate, TextEdit, Terminal, and iTerm, and only affect some key combinations:

<only>TEXTMATE, EDITOR, TERMINAL</only>
<autogen>__KeyToKey__ KeyCode::CURSOR_LEFT, ModifierFlag::NONE, KeyCode::VK_NONE</autogen>
<autogen>__KeyToKey__ KeyCode::CURSOR_RIGHT, ModifierFlag::NONE, KeyCode::VK_NONE</autogen>
<autogen>__KeyToKey__ KeyCode::CURSOR_UP, ModifierFlag::NONE, KeyCode::VK_NONE</autogen>
<autogen>__KeyToKey__ KeyCode::CURSOR_DOWN, ModifierFlag::NONE, KeyCode::VK_NONE</autogen>
<autogen>__KeyToKey__ KeyCode::CURSOR_LEFT, VK_SHIFT | ModifierFlag::NONE, KeyCode::VK_NONE</autogen>
<autogen>__KeyToKey__ KeyCode::CURSOR_RIGHT, VK_SHIFT | ModifierFlag::NONE, KeyCode::VK_NONE</autogen>
<autogen>__KeyToKey__ KeyCode::CURSOR_UP, VK_SHIFT | ModifierFlag::NONE, KeyCode::VK_NONE</autogen>
<autogen>__KeyToKey__ KeyCode::CURSOR_DOWN, VK_SHIFT | ModifierFlag::NONE, KeyCode::VK_NONE</autogen>
<autogen>__KeyToKey__ KeyCode::CURSOR_LEFT, VK_OPTION | VK_SHIFT | ModifierFlag::NONE, KeyCode::VK_NONE</autogen>
<autogen>__KeyToKey__ KeyCode::CURSOR_RIGHT, VK_OPTION | VK_SHIFT | ModifierFlag::NONE, KeyCode::VK_NONE</autogen>
<autogen>__KeyToKey__ KeyCode::CURSOR_UP, VK_OPTION | VK_SHIFT | ModifierFlag::NONE, KeyCode::VK_NONE</autogen>
<autogen>__KeyToKey__ KeyCode::CURSOR_DOWN, VK_OPTION | VK_SHIFT | ModifierFlag::NONE, KeyCode::VK_NONE</autogen>
<autogen>__KeyToKey__ KeyCode::CURSOR_LEFT, VK_OPTION | ModifierFlag::NONE, KeyCode::VK_NONE</autogen>
<autogen>__KeyToKey__ KeyCode::CURSOR_RIGHT, VK_OPTION | ModifierFlag::NONE, KeyCode::VK_NONE</autogen>
<autogen>__KeyToKey__ KeyCode::CURSOR_UP, VK_OPTION | ModifierFlag::NONE, KeyCode::VK_NONE</autogen>
<autogen>__KeyToKey__ KeyCode::CURSOR_DOWN, VK_OPTION | ModifierFlag::NONE, KeyCode::VK_NONE</autogen>
  • Whoa, I did not know there was such a broad range of ways to manipulate the keyboard! Thanks! – AaronAAA Jul 3 '13 at 14:46
  • The .inputrc one for Bash doesn't work for me. :( – Rudolf Adamkovic Jan 31 '15 at 23:12

You must log in to answer this question.

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