Vim Scrolling Slowly

Viewed 43158

Vim is acting slow when I scroll. The cursor skips some lines when I'm pressing j/k continually.

I'm using xterm and urxvt. In both vim acts like this.

This happens locally, with small or big files. I do use Control + F/B they work just fine.

EDIT: ttyfast in small files did the trick but in bigger is the same. When running without customization it goes allright.

10 Answers

:set lazyredraw will buffer screen updates instead of updating all the time. I generally enable it when I'm doing a complex macro playback. Might help you here.

Have you tried the 'ttyfast' option? See:

:help 'ttyfast'

for help, and:

:set ttyfast

to enable it.

Also, what version are you using? And have you tried this with no customizations to see if something you've set is interfering?

Run it like this to omit any of your vimrc settings and plugins:

vim -u NONE

EDIT: If removal of customizations fixes it. Remove things iteratively until the behavior returns. Start by narrowing it down to either a vimrc problem or to plugins.

Late answer, but the above did not help me.

First, figure out what the exact problem is rather than flailing about disabling random stuff. Vim has a super nifty profiler.

:help prof

will get you started, but I did

:prof start ~/vim_profile
:prof func *
:prof file *

Then did a bunch of super slow scrolling. Afterwards,

:prof exit

You can then look at the vim_profile and see exactly what the problem is. In my case it was the matchparen which I fixed by adding

set noshowmatch

to .vimrc, but could be different for you.

As an aside, after I got vim itself tuned, I was able to improve performance more by using a different terminal (iTerm2, or Alacritty) instead of the built in one.

Check your silent mappings as well. If you have mappings starting with j, k, h,l then that may also cause a momentary lag.

I was running vim on a Raspberry Pi 1. Disabling this one line sped things up for me:

set foldmethod=syntax  "slow!

I came here with similar scrolling problems. I really didn't want to turn off syntax highlighting altogether, so I disabled "set cursorcolumn" and "set cursorline" and my scrolling became much faster.

Related