Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world. I installed it, but don’t see how to remap the home and end keys to behave like windows. Also, as a new to mac user, how do I create the “DefaultKeyBinding.dict” file? In windows I would have gone to the directory in explorer, used the context menu to create new text file, made the edits and saved as.dict. This documentation is generated automatically from the comments and commands in the DefaultKeyBinding.dict file. The script documentkeybindings.rb is free for use, but it's specifically designed for use with my formatting in the bindings plist (i.e. It's a little finicky).
- DefaultKeyBinding.dict · GitHub
- KeyFixer - Fix Your OS X Home And End Keys
- My Defaultkeybinding.dict For Macbook
- My Defaultkeybinding.dict For Mac Os
Asked by koalaok
Is there any way to change the key mapping of the apple keyboard?
As programmer I find annoying there’s a comma instead a dot in numeric keypad. I would remap this key to have dot …
3 Answers
based on Matías González answer:
Step 1, Add the remapping (paste this command on your console):
Step 2, Restart the mac
The #
indicates the remapping is for the keypad only. More reference for that file: https://gist.github.com/trusktr/1e5e516df4e8032cbc3d
Answered by Jose Paez with 4 upvotes
The simplest solution is to create the file DefaultKeyBinding.dict
in /Users/[user]/Library/KeyBindings
if it does not already exist, and add the remapping:
Then restart the mac.
The #
indicates the remapping is for the keypad only. More reference for that file: https://gist.github.com/trusktr/1e5e516df4e8032cbc3d
Answered by Matías González with 16 upvotes
One solution is Karabiner (prior to version 9.3.0, Karabiner was called KeyRemap4MacBook). It allows you to remap specific keys or change then entire keyboard layout, as described here.
It is a powerful keyboard remapper that can change not only the functionality of keys and key combinations, but just about everything related to how a key repeats when you hold it down. Keyboard remappings are highly customizable (although it's not a so simple process). You can change practically anything: you can search through all the options and quickly find what you're looking for, or just browse by category. It's very powerful and usage is pretty straightforward.
The drawback is that keyboard remapping functions are predefined and you can just check them off. If you want to add custom remapping functions, you have to edit an XML file. When you're using a GUI application this is not exactly the ideal experience. That said, this is the only significant drawback.
DefaultKeyBinding.dict · GitHub
Answered by mgiordi with 1 upvote
Add your own answer!
Help others by answering this question!
Update august 4th 2011: Behaviour slightly pooped since Lion (Mac OS X 10.7). Now Home and End act as a back and forward button respectively, unless the cursor is within a text field in your browser.
Nothing I tried worked until I installed KeyRemap4MacBook (http://pqrs.org/macosx/keyremap4macbook).
This installs to your preference pane and the option is found under “For PC Users” and is called “Use PC Style Home/End”.
Everything below this point is useless, and only saved for luls.
This is how I altered ~/Library/KeyBindings/DefaultKeyBinding.dict to change the behaviour of the Home and End keys in Mac OS X 10.6.8. (The directory and file did not exist so I had to create them manually.)
{
/* Remap Home / End to be correct :-) */
'UF729' = 'moveToBeginningOfLine:'; /* Home */
'UF72B' = 'moveToEndOfLine:'; /* End */
'$UF729' = 'moveToBeginningOfLineAndModifySelection:'; /* Shift + Home */
'$UF72B' = 'moveToEndOfLineAndModifySelection:'; /* Shift + End */
'^UF729' = 'moveToBeginningOfDocument:'; /* Ctrl + Home */
'^UF72B' = 'moveToEndOfDocument:'; /* Ctrl + End */
'$^UF729' = 'moveToBeginningOfDocumentAndModifySelection:'; /* Shift + Ctrl + Home */
'$^UF72B' = 'moveToEndOfDocumentAndModifySelection:'; /* Shift + Ctrl + End */
}
Copied from http://evansweb.info/2005/03/24/mac-os-x-and-home-end-keys
KeyFixer - Fix Your OS X Home And End Keys
Mac OS X and Home / End keys
My Defaultkeybinding.dict For Macbook
The default key bindings for the home and end keys in Mac OS X are different to any other operating system I’ve ever used. By default, they seem to be bound to the viewport, rather than the line of text you are editing. In a multi-line document, the Home key scrolls up to the top of the document, and the End key scrolls down to the bottom. In each case the caret stays where it was.
My Defaultkeybinding.dict For Mac Os
As a programmer I find this behaviour to be just plain wrong— I want Home and End to move to the start and end of the current line.
I have found a way to “fix” this problem by editing the default keybindings file,~/Library/KeyBindings/DefaultKeyBinding.dict. Create the directory and / or the file if they’re not already there, and make it look like this:
If there are already entries in DefaultKeyBinding.dict, just add the 4 new mappings above to the main section of your file.
Other more or less relevant sources:
- http://www.starryhope.com/tech/apple/2006/keyfixer/ (comments)