Textmate's tutorial may help you.
You may want to look up in Apple's document for Function-Key Codes (see Constants > Function-Key Unicodes) and Cocoa Event Names (see Instance Methods).
Put this file under ~/Library/KeyBindings/DefaultKeyBinding.dict
and restart a Cocoa Application.
This hack makes Home and End key not working in the address bar of Firefox. (It's not a native Cocoa Application)
- http://developer.apple.com/library/mac/#documentation/cocoa/conceptual/eventoverview/HandlingKeyEvents/HandlingKeyEvents.html
- http://apple.stackexchange.com/questions/25051/defaultkeybinding-dict-old-style-next-format-vs-xml-plist-format
- http://lri.me/keybindings
- https://github.com/ttscoff/KeyBindings/