Vim: insert mode is very slow with 400+ lines

I have a file with 400 + lines (this is a thesis). When I edit it somewhere near the top (say, on line 20), Vim is instantly, as always. However, editing it near the bottom (around line 400) causes a noticeable delay between the way I type and Vim displays it on the screen. As a result, it’s almost impossible to edit the file so large.

What is the reason for this and what can I do?

I tried switching swapfile , syntax , scrolloff , etc., but that doesn't seem to help. The maximum number of lines for Vim should be 2147483647, so I really have a long way to go :)

If this is related to installing maxmem , then what would be a reasonable value, considering that I edit files up to 2500 lines?

Thanks so much for any help! Greetings.

+7
source share
1 answer

Well, bending was a problem here (I had some bad settings for foldlevelstart ). So based on my experience and these issues :

 set foldenable " can slow Vim down with some plugins set foldlevelstart=99 " can slow Vim down with some plugins set foldmethod=syntax " can slow Vim down with some plugins 

Other things to check / switch are syntax , filetype , wrap and line length (some plugins can be slow with very long lines).

Running Vim without your current settings is a good starting point. Thanks @Frederik for pointing me to this:

 vim -u NONE 

After that, disconnecting all plugins is a good start. See also general information :help slow

+12
source

All Articles