How to Fix Slow Scrolling in Vim and MacVim on OS X

I finally discovered the cause of my #1 OS X problem: slow scrolling in Vim, both in Terminal.app and in MacVim.

There was always a marked difference between Vim on my Mac and Vim on Linux. Scrolling with the movement keys (j/k in particular) was blindingly fast on Linux, but plodded along on my Mac so slowly that I began using Control-F and Control-B most of the time.

It turns out there was a simple cause for the problem: key repeat settings. The setting was too low for me.

You can change Key Repeat settings in System Preferences -> Keyboard. Tweak the Key Repeat and Delay Until Repeat settings to find a good speed. I had to restart after changing these settings to see any effect.

Now, the vanilla options helped some, but in order to get really fast scrolling speed, I had to take two more steps:

  • Switch to iTerm 2 for my terminal. Terminal.app, even Lion’s, couldn’t cope with faster key repeat settings – Vim was still slow, though a bit faster.
  • Tweak the repeat values even more with KeyRemap4MacBook.

The magic KeyRemap4MacBook values for me were:

  • [Key Repeat] Initial Wait: 15 (Update: 500)
  • [Key Repeat] Wait: 35