Vim startup lag with yankring plugin

After I made a bunch of changes to my vim config, I found that it would occasionally take a while to open. That was infuriating and the answer took a bit of effort to figure out so I wanted to share. I traced it down to the plugin yankring.vim by removing all plugins and adding them back until I found the culprit. But yankring is useful and I didn’t want to just remove it, so I kept digging and found this post where it turned out to be X’s fault. I tried starting vim with vim -X on my setup and found the problem went away too. Apparently vim when compiled with GUI support tries to do some thing with the X clipboard even if you’re just running regular console vim, and if X is being laggy, so is your vim startup. Yankring doing whatever it does upon startup relating to the clipboard must compound the lag and create my issue. Thus, it seems that at least on my setup, vim’s X integration and yankring.vim are incompatible. Since I don’t use any of these features, I opted to disable the X integration rather than disable yankring by adding this to my bashrc/zshrc:

alias vim='vim -X'

Leave a Reply