Mac: Don’t like pressing ALT+3 to do a hash #? Bind the \ backspace key to hash just like on Windows!

Posted on November 29, 2012 Under OSX 0 Comments

I like my Macbook. Great for coding and internet browsing. I can’t really game on it, but who cares when you’ve got a gaming machine for those times? One small thing that annoys me is having to press ALT + 3 every time I need a hash #. Whether it be for CSS ids or hex colors, my thumb has to perform an awkward maneuver to reach that ALT key while my middle finger presses 3.

Only after a year have I ever thought about binding the backslash key to hash for ease of use. But what about doing backslashes if the key is bound to hash? Well you can press FN + \ to do a backspace.

Here’s how to bind your keys:

1) Download and Install KeyRemap4MacBook

2) Add an additional entry to the key binding’s XML file
Go to System Preferences, click KeyRemap4Macbook, then go to the Misc & Uninstall tab.
Click ‘Open private.xml’. You’ll want to open this in TextEdit or something similar.
Now add the following <item> so your private.xml looks like this:

<?xml version="1.0"?>
        <name>Backslash(\) to Hash # (Alt+3)</name>
        <appendix>(+Alt+Backslash to Backslash)</appendix>
        <autogen>--KeyToKey-- KeyCode::BACKSLASH, VK_OPTION, KeyCode::BACKSLASH</autogen>
        <autogen>--KeyToKey-- KeyCode::BACKSLASH, ModifierFlag::NONE, KeyCode::KEY_3, ModifierFlag::OPTION_L</autogen>

After adding that, save the file, close, then go to the ‘Change Key’ tab on the KeyRemap4Macbook window and click ‘ReloadXML’.

3) Enable the key binding:
First, check ‘Backslash(\) to Hash # (Alt+3)’.

There, you’re done. The hash # is now easily inserted by pressing the backslash key. If you need to do a backslash, press ALT+\, or if you need a pipe | just use SHIFT+ALT+\.

If you found this useful, share on facebook, twitter, or just make a comment. I’d appreciate the comment, actually :)

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.