search

Home  >  Q&A  >  body text

How to solve the problem that vim starts slowly after installing the plug-in?

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?

習慣沉默習慣沉默2773 days ago1386

reply all(6)I'll reply

  • 为情所困

    为情所困2017-05-16 16:39:58

    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.

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-16 16:39:58

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

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-16 16:39:58

    Then remove unnecessary plug-ins

    reply
    0
  • 阿神

    阿神2017-05-16 16:39:58

    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

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-16 16:39:58

    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.

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-16 16:39:58

    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'

    reply
    0
  • Cancelreply