Tuesday, July 27, 2010

OSX Key Remapping Hell

I'm in OSX keyboard remaping hell. For decades I used a PC. Then I switched to a Mac because I wanted huge memory and I didn't want 64-bit XP. I have a Kinesis keyboard, and because ctrl-c and ctrl-v are now hardwired into my brain (or into my fingers--this is muscle memory I'm talking about, not actual key labels), I wanted to get my mac to understand that copy is ctrl-c and paste is ctrl-v.

Simple enough using the "Keyboard Shortcuts". It worked for years.

Until one day my IT team updated my OS and all of a sudden ctrl-v in mail.app sends my cursor to the bottom of the email that I'm composing. When I hit ctrl-v *again*, it pastes. At the fucking bottom of the email. I poked around some forums and recalled from my days as a Unix programmer that ctrl-v is Emacs for "page down". Why the shit OSX's Mail.app decided to all of a sudden start speaking partial Emacs is totally bizarro. But that's what it did. Fuckers.

How to fix this? Open up /System/Library/Frameworks/AppKit.framework/Resources/StandardKeyBinding.dict and yank these lines:


<key:>^C</key>
<string>insertNewline:</string>

<key:>~^C</key>
<string>insertNewlineIgnoringFieldEditor:</string>

<key:>^V</key>
<string>pageDownAndModifySelection:</string>

<key:>^v</key>
<string>pageDown:</string>

Oh yeah, and then as a final up yours from Apple, you have to reboot.