I have a strange issue. Sometimes (not every time, but often enough) the startup is extremely slow (ten seconds or more). Most of the time, when I run vim next time, it starts reasonably fast. Then in a few minutes or hours it starts up slowly again, just once. I can never reproduce the issue at will.
I tried to profile vim with --startuptime
option. Normally the output looks like this
...
079.057 000.613 000.468: sourcing /usr/share/vim/vim80/ftplugin/cpp.vim
209.450 136.220: opening buffers
209.540 000.090: BufEnter autocommands
...
but when the startup is slow, it may look like this:
...
077.801 000.340 000.268: sourcing /usr/share/vim/vim80/ftplugin/cpp.vim
10408.516 10333.252: opening buffers
10408.686 000.170: BufEnter autocommands
...
It is always the "opening buffers" line. No other action is abnormally long.
The intermittent nature of this slowness makes it very hard to debug.
What tools are at my disposal to troubleshoot the issue?
vim --clean
orvim -u NONE -N
orvim -u DEFAULTS
... if you cant, then I blame a plugin. If you can, more details will be necessary.vim --clean
etc doesn't reproduce the problem, I have no idea whether it's because clean runs never exhibit the problem, or because it just decided to run OK this time. But suppose it's a plugin; how do I find what part of what plugin is responsible?'verbose'
might help