Vim navigation hangs on larger files

1.3k views Asked by At

I'm using vim now for almost over a month and I am very dedicated to it. But since I added a few plugins, navigating through larger files (400+ lines... especially PHP files) makes vim pretty slow. It doesn't bother me much, because it is still pretty fast.

But I sometimes face the problem that navigating with hjkl hangs and even though I stopped pressing j for instance it keeps going for quite a while which is very annoying.

I run vim in iTerm on my mac and I'm not sure what to do here.

Thank you for any help.

//edit: Okay I found now what causes trouble. Everything that changes the current line style or messes with line numbers causes trouble.

So set cursorline or set rnu nu are causing my vim to lag. I think it is because the "redraw" is a pain for my terminal.

1

There are 1 answers

6
bitifet On BEST ANSWER

This is absolutely normal.

Some vim plugins are powerful, but not intended to be used handling large files (because it will require an enormous memory usage).

But the solution is simple: Use the LargeFile plugin which automatically detects when the file you are opening is too big and, in that case, disable some plugins and features just for that buffer.