21

I just done a fresh installation of Vim, and with this occasion I added some new plugins to my VIM configuration. The problem is that now, when I do the first change in the file, VIM blocks and one of my CPUs reach 100% load. This is also happening every now and then while I'm editing the file. This never happened in the previous configuration. How can I find what plugin is killing my CPU?

sica07
  • 4,896
  • 8
  • 35
  • 54
  • 6
    By removing every plugins and adding them back one by one. – romainl Apr 13 '12 at 08:50
  • This is the method I'm trying to avoid, but if there is no other way... – sica07 Apr 13 '12 at 09:06
  • Well, you could probably use a profiler. You could also think a few seconds about your plugins: some are completely passive until you invoke them and are probably unrelated to your issue, others may launch background processes at each keypress… The statusbar, for example, may update itself very often to display VCS status or whatever. – romainl Apr 13 '12 at 09:41
  • We don't know anything about your previous/current configuration. What plugins did you have? What plugins do you have? Your old `~/.vimrc`? Your new one? Your OS? Your Vim version? – romainl Apr 13 '12 at 09:44

1 Answers1

16

As an alternative to romainl's (nice and simple) trial-and-error approach:

I've done such once using vim's built-in profiler: :he profile.

You might need to compile vim by yourself to activate (profiling is not enabled in the default vim distribution).

Then

:profile start filename

to activate profiling and write your profile data to filename, edit your file (which pushes the CPU to 100%), once done

:profdel

to stop profiling. Quit vim and you'll find the profiling information written in filename.

Community
  • 1
  • 1
eckes
  • 64,417
  • 29
  • 168
  • 201
  • In debian squeeze, vim has profiling is enabled by default. Thanks eckes! – sica07 Apr 16 '12 at 21:25
  • 11
    To profile everything, run `:profile start filename`, then `:profile func *` Then do the slow thing, and close vim. `:profdel` is not needed - it doesn't stop profiling, it instead unmarks part of code for inclusion in profiling. – glebtv Jun 01 '13 at 11:00