How to solve the problem that vim starts slowly after installing the plug-in?
習慣沉默
習慣沉默 2017-05-16 16:37:58
0
6
1357

After installing some plug-ins, I found that the startup speed of vim was obviously slower. Use the following command to test it

vim --startuptime timefile test.php

See that the plug-in shown in the picture above takes the longest to load. Is there any way to solve this problem?

習慣沉默
習慣沉默

reply all(6)
为情所困

If there are too many plug-ins loaded at startup, the speed will definitely slow down. I don't know what plugin manager you are using. The vim-plug I use can delay loading. For example, the JavaScript-related plug-ins are only loaded when the js file is opened. A plug-in is only loaded when a certain command is triggered. You can take a look at this method and try to optimize it.

Also (if you use syntastic), because I write a lot of js and the speed of eslint is relatively slow, so I use https://github.com/ruanyl/vim-eslint. This plug-in can improve eslint to a certain extent. speed.

给我你的怀抱

Buy a better machine??? Installing YCM used to be slow, but now it’s not slow at all on i7....

漂亮男人

Then remove unnecessary plug-ins

阿神

If you install too many plug-ins, the startup will naturally be slow. Organize your own plug-ins and delete those that are not commonly used

过去多啦不再A梦

YCM is a very important plug-in. At least my local machine and development machine are slow. Even if it is not slow, there is definitely a delay! The author can selectively load plug-ins according to different scenarios.

漂亮男人

Plug-ins are files that need to be additionally loaded and executed.
Without plug-ins, before you open a file, you only need to load the main Vim program; after installing dozens of plug-ins, you have to read dozens of corresponding configuration files and execute them. It is natural that the startup speed is 100 times slower. of.
In addition, the preprocessing time of some plug-ins is a bit long, such as the Git system. For those like vim-airline and vim-gitgutter that need to execute Git commands when loading, a few additional Git commands will take additional time.


The subject’s question is about UltiSnips’ autoload, which is better than the two I mentioned. Maybe there is room for optimization in UltiSnips’ operating efficiency, but the problem of slow loading of many plug-ins is basically unsolvable in software.
The bottleneck of file IO is hard disk reading and writing. It will be faster if you replace it with SSD.
In addition, in some simple editing situations, if you need a lightweight Vim that starts quickly, you can use an alias.

alias vi='vim --noplugin'
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template