Vim's cursor keys work in Mac OS X again

export TERM=linux

Ever since my Macbook died and was fixed again Vim hasn’t worked properly in iTerm.

I’m a big fan of SSH and Screen. SSH to connect to a remote server, and Screen is like a workspace organiser for your SSH session.

First of all the backspace key worked in Vim even when not in insert mode, but worst of all, the cursor keys refused to work and only succeeded in ringing bells in the terminal. Previous attempts at fixing the problem failed but I must have searched for the right terms this time. This review of Mac OS X led me part of the way. Sébastien recommended setting the TERM to “dtterm” but Screen didn’t recognise that. Setting it to “linux” fixes my SSH sessions, and also fixes Vim locally as well!

I added the snippet of code above to my ~/.bash_profile to make the change permanent and everything is back to normal now! I have a vague memory of fixing this before but I wish now I had blogged it then!

How much of your Macbook's battery is gone for good?

coconutbattery.png

Rechargeable batteries start deteriorating from the moment they are manufactured. I’ve noticed my Canon 20D’s batteries don’t last quite as long as they did 2 years ago. AA and AAA batteries seem to be even worse. As I’m heading to San Francisco in July I’ll be doing a lot of flying so it’ll be important that my Apple Macbook laptop have a decent battery life.

There’s no quick fix for this as it’s not reversible but if you’re wondering how much life is left, then Coconut Battery is a must have. I installed it last night and it looks like my battery still has 85% of it’s capacity left after 11 months of use. That’s not bad. It’s not enough to get me across the Atlantic but I don’t know if I want to spend €139 on a second battery when I’ll only ever use it once a year.

I think it is possible to slow down the deterioration. Don’t unplug your laptop! The less you use the battery, the longer the battery will last.

I made my Macbook cry

If Macs are so perfect why do they keep crashing and dying and need to be rebooted seeminly after every update? I’m just back from another reboot when Flock brought the system down. Yes, yes, must switch to another browser but after Mark’s ranting about the slowness and general bloatedness of OS X Firefox I’m wondering what I’ll use.

For all the fans of Microsoft Windows out there, here’s a sort of BSOD from the Mac. This happened at the last BarCamp in Waterford. I have witnesses!

2007-01-20__mg_8276.jpg

In the interests of fairness, I should also say that Linux died horribly on me when Firefox, Flock, GIMP and Bibblepro were all loaded and swap went haywire. It was quicker to put it out of it’s misery and reboot than wait for the kernel to kill one of the above apps. But why spoil a good anti-Mac rant by injecting some perspective?

How to rename a file in Mac OS X

Silly bugger, doesn’t he know Macs are easy to use? Well, yes they are but it’s not obvious how you can rename a file or folder in Finder. I had to look it up in a book to find out. (Thanks Barry for “The Missing Manual”!)

It is rather simple to rename a file actually, although not obvious.

  • In Finder, open the folder with your file in it.
  • See all those pretty icons? Don’t click on them. Find the icon for your file. Click once on that icon then click and hold the mouse button down on the filename below it.
  • After about a second of holding down the mouse button the text will become editable and you can type over the filename. Be careful you don’t change the extension because bad things will happen!

Simple when you know how.

Meanwhile, Mark is documenting his own experiences with a Mac Mini. Must try X-Chat Aqua.

Mac OS X – how to update /etc/hosts

Way back in the good old days of Linux and Windows it was much easier to update my hosts file. There it was, /etc/hosts or C:\windows\hosts, edit, save and the change becomes active.

MacOS X is a little more complicated. Once you update /etc/hosts you’ll have to update the Netinfo Database. That’s why I’m blogging this so I’ll remember it. This page documents the steps required but the important command is this one:

sudo niload -v -m hosts . < /etc/hosts

There is a GUI but it’s a little clunky and duplicating an existing entry isn’t the most elegant method of adding a new one. Especially when a warning dialog pops up!

Thanks Barry for suggesting a similar fix while I was in SF and getting used to my new laptop! :)