-.- --. .-. --..

A Faster Vim For A Better manpager

18 Jun 2016

I’ve been using Vim as a man pager for a long time and I love it! I used this guide by Zameer Manji for setting it up. However, the load times are anything but impressive when compared to the default less pager. I use a considerable amount of simple plugins and autocommands, which can result in this problem. I use vim-plug for managing plugins, and it provides a way to load plugins based on file types. This improves the startup time quite a bit in the normal case (where I don’t load heavier plugins like YouCompleteMe).

Tip: If you’re planning to learn Vim, using it as a manpager is a very good idea. This will avoid the dip in productivity that comes with a text-editor switch, and at the same time, give a reasonable time for trying out various Vim commands

I noticed a way to make the load time of Vim faster for man paging without manually blacklisting plugins. The vim option of --noplugin ensures that no plugin gets loaded. Here are the results when measured with --startuptime command line option:

With --noplugin:

$ export MANPAGER="col -b | vim --noplugin -c 'set ft=man ts=8 nomod nolist nonu noma' -"
$ man git
150.908  000.006: --- VIM STARTED ---

Without --noplugin:

$ export MANPAGER="col -b | vim -c 'set ft=man ts=8 nomod nolist nonu noma' -"
$ man git

357.728  000.003: --- VIM STARTED ---

By using the --noplugin option , we still have access to key remaps from our VIMRC, yet keep the loading time fast. As opposed to -u NONE where key remaps won’t be present.