The following is a list of some useful ways to use vim with the command-line.

vimhelp

Add the following to your .bashrc:

1
2
3
vimhelp() {
    vim -c "help $1 | only"
}

This nifty command opens the vim help page for its argument and makes it the only active window. The -c flag takes a list of commands and executes them.

vim-enchanced manpage (Credit).

You can color manpages using the LESS_TERMCAP_xx variables, but I prefer a neater way using vim. Add the following to your .bashrc:

1
2
3
man() {
    /usr/bin/man $@ | col -b | vim -R -c "set ft=man nomod nolist" -
}

Now when you type man grep, the manpage is piped to col which strips out reverse and half-reverse line feeds, then pipes the output to vim, which opens the file in read-only mode (-R), sets the filetype to man, marks the file as not modified and finally ensures that tab characters are not displayed as ctrl-I.

Now you have a syntax highlighted manpage with the power of vim, such as searching and copying.