Question

I have a file contains some very long string(about 3000 characters), When I open it with Vim, and navigate with h,l,j,k. Vim became very very slow, each time I type a key, I need to wait for seconds. But when I open it with Vi, it seems very fast, So I was wondering is there any options I can set to Let vim process long string fast?

I am using Vim 7.3 on SunOS. my work involves lot's of long text lines everyday.

Was it helpful?

Solution

Syntax highlighting is defined via regular expressions, and the matching can consume a lot of resources, especially on long lines and large buffers. You can turn off syntax for the problematic buffer with :setlocal syntax=, or disable it completely with :syntax off.

Recent Vim versions (7.4 with a "huge" build) also have a :syntime command that can show you which syntax rule is problematic, so that you may be able to disable only parts of the syntax highlighting.

Other settings can make working with large files slow. The LargeFile - Edit large files quickly plugin detects and disables those automatically for you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top