October 26, 2009

Mac OSX Terminal Settings for a sane shell

I just switched from a two year old MBP to a new 17" one. First off, this thing is amazing. It's a bigger footprint, but weighs about the same. Not surprising since it is so much thinner. The battery lifetime is outrageous. I've gone most of a day at work without a charger. The screen is gorgeous and very easy to read. So that's all great.

However, I had to recreate all my settings from my last one. Since I had to dig this up from scratch again, I'll record here so that I don't have to do that again in the future. Maybe this is useful for someone else as well:

Launch Terminal.app and open preferences. Go to keyboard tab and select "Use option as meta-key". Next, enter the following keycodes:
  • control cursor down - \033Ob
  • control cursor left - \033Od
  • control cursor right - \033Oc
  • control cursor up - \033Oa
  • end - \033[4~
  • page down - \033[6~
  • page up - \033[5~
  • shift cursor down - \033[b
  • shift cursor left - \033[d
  • shift cursor right - \033[c
  • shift cursor up - \033[a
  • shift end - \033[F
  • shift home - \033[H
  • shift page down - \033[6~
  • shift page up - \033[5~
Finally, go to "Advanced" and select "Delete sends Ctrl-H".

This isn't totally sane though. I don't know the good codes for "shift-page-up" and I'm too lazy to go spend a few hours messing with terminfo.