Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine the reason vim freezes

Tags:

vim

While using vim the editor freezes for about a minute at random moments and while that happens vim uses 100% of one of my cores.

The problem is that I don't want to go through disabling and enabling everything in order to find if there is some plugin causing it. The reason for this is that I want something more optimal than this to understand better how to troubleshoot vim problems. And due to the randomness of the freezes I cannot reproduce the problem, thus when I disable a plugin there is no way for me to know if it fixed the problem.

Is there a fast general way to determine which plugin or .vimrc command is causing such problems? Or a way to reproduce the freeze?

I tried attaching to the process when the freeze happened to see if anything some plugin or function occupies the CPU cycles but that didn't helped.

like image 713
zbs Avatar asked Jun 19 '14 13:06

zbs


1 Answers

As Vim "unfreezes" itself after some time, it doesn't go into an endless loop or crashes. So, Vim "just" spends an inacceptably long time in some function. You should be able to find out where via profiling. Unfortunately, the default builds don't have this built-in; you need a huge build of Vim; for Windows, you can get such binaries from the Cream project. See :help profiling.

Also, you can capture a full log of a Vim session with vim -V20vimlog. When a freeze occurs, quit Vim and inspect the last lines of the log to see what Vim was doing, or monitor the log with tail -f.

like image 51
Ingo Karkat Avatar answered Sep 18 '22 17:09

Ingo Karkat