Lately my vim has become very slow. It’s only when I initially open a file or switch between files. Once i am working in a file everything is great. Any ideas what it could be or how I could track down the issue. It is taking about 3 seconds to open files.
If you start Vim without any plugins (
vim -u NONE) is it faster?
Yes. Almost instantaneous using
vim -u NONE. So it’s obviously a plugin slowing it down? Is there a good way to figure out which one, or just get rid of them all and add back in one at a time?
After some digging and logging out
--startuptime it looks like other than loading plugins, the big time difference is
With no plugins time is:
012.833 000.031: VimEnter autocommands
However when I am loading plugins here is the time:
2346.455 2228.540: VimEnter autocommands
Now that you’ve narrowed it down to
VimEnter autocmds, you can use
:verbose autocmd VimEnter to see a list of all the VimEnter autocmds and where they are set from. Unfortunately I think the next step after that is binary search disabling/enabling of the plugins creating the autocmds, but that should help narrow down a bit further at least.
@runyans7, hopefully you’ve got things sorted by now. This might be bad timing, but do you keep your vim configs under version control? I’ve felt pretty great ever since I started using this dotfile management system
You’ll likely be better off cloning down into ~, and overwriting all my files with your own (but leave make.sh and the README.md intact). Might want to give it a trial run on a VM first too and pushing to gh to make sure you can’t lose any dotfiles just in case.