Map a Hash Key on the Mac Keyboard

To type a # (hash) symbol on a Mac with a UK keyboard, an obscure key combination, alt+3, is used. The hash key is not marked and you would be unlikely to guess this key combination. Using the key combination with one hand is possible but not particularly easy or comfortable.

As a web developer, the hash key is essential for coding, so rather than use the key combination, it would be easier to map a dedicated key to the hash character. The ideal candidate for this is the sectional (‘double S’) key: §, which is used to denote sections of a legal document, but probably of very little use for anyone not creating legal documents.

Map the § key to produce a # character

In finder, click ‘go’ on the menu and select the ‘Go to Folder’ Menu item.

Enter’~/Library’ in the ‘Go to the folder’ input field and click [Go]

If there is no folder within the ‘Library’ folder called ‘KeyBindings’, create one, then within this folder, create a file called ‘DefaultKeyBinding.dict’ with the following content:

/* Map # to § key*/
"§" = ("insertText:", "#");

Some apps, including textwrangler, will ignore this mapping if they have their own keymapping, but this does work perfectly with coda, the main editor I use.