O'Reilly logo

Mastering Vim by Ruslan Osipov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Profiling specific actions

If performing a particular action in Vim is slow, you can profile just a particular set of actions.

In this example, I created an obvious performance culprit. I downloaded the Python and Vim repositories from GitHub, and tried running the :CtrlP command that's provided by a CtrlP plugin (which we explored in Chapter 2, Advanced Editing and Navigation). :CtrlP will try to index all the files recursively starting at the current directory, which should be slow for such a large number of files.

Start Vim as usual, and execute the following set of commands:

:profile start profile.log:profile func *:profile file *

From now on, Vim will profile every action you'll perform. Run the slow command. In our case, let's run ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required