Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: $PAGER, man vs info - was: Re: zsh-lovers

> > [jae_0]cat ~/bin/pager
> > #!/bin/sh
> > col -b | view --cmd 'let no_plugin_maps = 1' \
> >     -c 'set ft=man nomod nolist' -c 'runtime! macros/less.vim' \
> >     -c "set ls=0" -c 'noremap <Up> <C-Y>' -c 'noremap <Down> <C-E>' -

Well, I wasn't going to bother jumping in on this thread, but since someone
brought up using vim as a manpager...

I use the wonderful vim script found here:

Combined with these quick functions:

~>which man
man () {
        [[ $# -eq 0 ]] && return 1
        view -c "Man $*" -c "silent! only"
~>which info
info () {
        [[ $# -eq 1 ]] || return 1
        view -c "Man $1.i" -c "silent! only"
~>which perldoc
perldoc () {
        [[ $# -eq 1 ]] || return 1
        view -c "Man $1.pl" -c "silent! only"

This lets me use any of the below forms to open vim with some documentation:
man printf
man printf 3
man 3 printf
man 'printf(3)'
info coreutils
perldoc perlfaq1

Then, I can use the useful vim keys for navigation.  For instance,
doing "man

    zshall" from a shell, vim will open with the zshall manpage.
Then, if I put
the cursor on zshparam and type an uppercase K, vim will jump right to the
zshparam man page.  Or, ":Man ctime" will open a new manpage.

On my widescreen monitor, I'm a big fan of a vertically-split vim window with a
manpage on one side and the stuff I'm writing on the other.  Useful for all the
times that I want to check exactly what errors can cause pthread_cond_init to

Beats pinfo, info, more, less, and most all hands-down.  :)

Although, I still hold on to less and most for general-purpose pagers.  It's
much nicer to have a "|less" than a "|vim -" because less doesn't need to wait
for the whole input stream to be read before it starts displaying something,
and vim does.


Messages sorted by: Reverse Date, Date, Thread, Author