I recently took the $$$ plunge and got a fancy new 15″ Macbook Pro to replace my 5-year old ASUS laptop. Though I’m not too fond of Apple’s business model, I just couldn’t seem to find (hardware wise) a more quality built and ascetically pleasing laptop than a Macbook Pro. After 6 years straight of using Linux as my main OS (I despise Windows), I’m now learning my way around OS X for the first time. Having never used a Mac before, everything about OS X’s GUI is new to me.
Once I open a terminal though (thankfully there is one!), I start to feel more at home… except, I do not like the default placement of the ctrl / alt / command keys! Fortunately, after a few days of trying various programs and experimenting with settings, I’ve found a solution that works for me – without having to change system-wide settings.
My Emacs Requirements
While I’m a late-comer to adopting Emacs, I’ve been using it as my editor of choice for the past year, and am forever hooked. Since I’ve started learning Emacs, I’ve gotten used to the Option key = Ctrl key and the Command key = Alt/Meta key. So, it came as a huge annoyance to find that on my new Macbook, THERE IS NO RIGHT CONTROL KEY! Ah, I refuse to re-learn all my emacs muscle memory!
Configuring Emacs Key Bindings
Emacs can run as a standalone GUI, or within a terminal. The following are my workarounds to regain my famailar key mappings for each case.
Aquamacs is a great standalone Emacs editor for OS X, and remapping its keys is pretty easy: simply add the following two lines to your .emacs file.
(setq mac-option-modifier 'control)
(setq mac-command-modifier 'meta)
Using custom emacs keybindings inside a terminal was a bit more tricky to figure out. Fortunately, I found iTerm2 is a nice Terminal replacement in OS X, and is very customizable. The following are screenshots of the settings to change:
As seen above:
In the Profiles > Keys screen:
* set left option as +esc
In Preferences > Keys screen:
* right option as control
* right command as left option
Even with the Option and Command keys mapped to the “right” keys, the placement of the Macbook Pro’s Option key is not suitable for little (pinky) finger use. The placement shifts the ctrl key duty to my ring finger, but with the two keys now acting how I expect, this change isn’t too hard to get used to. So far, I’m happy I decided to go with a Macbook, as it is indeed a major upgrade from my old ASUS laptop!
Shift-It is an incredible open-source utility for Mac OS X that mimics the window placement functionality found in Compiz on Ubuntu. The ability to move windows around using the arrow keys was something I felt was missing, until now!