Richard Crowley‘s blog

q, r, s, t

This has happened to me several times and I have never been able to reason or Google an answer.  @rcrowley on Twitter or email if you know. (I will not be adding comments to this blog.)

I was in vim(1) and pressed some key combination that likely involved escape or keys near it that caused the ‘1’ key to print ‘q’, the ‘2’ key to print ‘r’, and so on.  The ‘0’ key printed ‘p’.  The printed character was preceded by a newline.  The cursor was placed in front of both characters.  vim was otherwise fully functional and the problem happened while the screen indicated I was in insert mode.

This occurred on a remote server, where I was logged in via SSH running within bash(1), running within iTerm, on OS X 10.5.  The problem persisted through exiting and re-running vim, exiting my login shell and re-connecting via SSH, and completely exiting iTerm.

Further, vim run directly under OS X began displaying the same problem.  nano(1) did not print any characters when number keys were pressed.  OS X GUI applications and bash itself were never affected.  vim and nano running within were never affected.

A full OS X reboot restored normal behavior both locally and remotely.

Does anyone know what key combination I pressed?  Is this is a bug or expected behavior?  If this is a bug, which layer is buggy?

Update 2010-05-17: It happened again today and by some miracle I only had to restart vi to get back to business.