Abridged Man Pages

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Abridged Man Pages

A. S. Budden
Hi there,

I've recently set up vim to act as the man page viewer, by adding:

export MANPAGER="col -b | view -c 'set ft=man nomod nolist ts=8' -"

to my ~/.bashrc.

However, if I type "man bash" at the prompt, I only get the first 1429
lines of the manual page, whereas there should be over 3000 lines.  I
can't remember where I got the above command, but I _think_ that it
was one of the Vim Tips from the website.

Can anyone suggest what might be going wrong here?

Many thanks in advance,

Al
Reply | Threaded
Open this post in threaded view
|

Re: Abridged Man Pages

Ciaran McCreesh
On Tue, 24 May 2005 10:11:19 +0100 "A. S. Budden" <[hidden email]>
wrote:
| export MANPAGER="col -b | view -c 'set ft=man nomod nolist ts=8' -"
|
| to my ~/.bashrc.
|
| However, if I type "man bash" at the prompt, I only get the first 1429
| lines of the manual page, whereas there should be over 3000 lines.  I
| can't remember where I got the above command, but I _think_ that it
| was one of the Vim Tips from the website.

Use something like this:

tr '\267' '.' | col -b | \
                vim \
                        -c 'let no_plugin_maps = 1' \
                        -c 'set nolist nomod ft=man' \
                        -c 'let g:showmarks_enable=0' \
                        -c 'runtime! macros/less.vim' -

--
Ciaran McCreesh : Gentoo Developer (Vim, Shell tools, Fluxbox, Cron)
Mail            : ciaranm at gentoo.org
Web             : http://dev.gentoo.org/~ciaranm


attachment0 (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Abridged Man Pages

Charles E Campbell Jr
In reply to this post by A. S. Budden
Quoting "A. S. Budden" <[hidden email]>:

> I've recently set up vim to act as the man page viewer, by adding:
> export MANPAGER="col -b | view -c 'set ft=man nomod nolist ts=8' -"
> to my ~/.bashrc.
> However, if I type "man bash" at the prompt, I only get the first 1429
> lines of the manual page, whereas there should be over 3000 lines.  I
> can't remember where I got the above command, but I _think_ that it
> was one of the Vim Tips from the website...

The vim tip was likely to have been "Using vim as a man-page viewer under Unix",
http://vim.sourceforge.net/tips/tip.php?tip_id=167 .

On a RH8 Linux box, I use a Korn shell function:

# man: {{{2
function man
{
keepPager=${MANPAGER}
export MANPAGER="cat"
/usr/bin/man $* | col -b | /usr/local/bin/view -c 'set ft=man nomod nolist' -
if [[ "${keepPager}" = "" ]]; then
    unset MANPAGER
else
    export MANPAGER=${keepPager}
fi
}

I don't see anything (other than perhaps some paths) that wouldn't work
with bash; when I do  man bash  with it, I get 4517 lines.

Do you get a full manual in a tmp file using the following command?

  /usr/bin/man bash > tmp

(assuming that your man command is in /usr/bin/man; full path was specified
so as to avoid alias/function modification of the command).

Regards,
Chip Campbell


Reply | Threaded
Open this post in threaded view
|

Re: Abridged Man Pages

A. S. Budden
On 5/25/05, [hidden email] <[hidden email]> wrote:

> Quoting "A. S. Budden" <[hidden email] >:
>
> > I've recently set up vim to act as the man page viewer, by adding:
> > export MANPAGER="col -b | view -c 'set ft=man nomod nolist ts=8' -"
> > to my ~/.bashrc.
> > However, if I type "man bash" at the prompt, I only get the first 1429
> > lines of the manual page, whereas there should be over 3000 lines.  I
> > can't remember where I got the above command, but I _think_ that it
> > was one of the Vim Tips from the website...
>
> The vim tip was likely to have been "Using vim as a man-page viewer under Unix",
> http://vim.sourceforge.net/tips/tip.php?tip_id=167 .

Yes, I think that's the one... thank you for the tip!

>
> On a RH8 Linux box, I use a Korn shell function:
>
> # man: {{{2
> function man
> {
> keepPager=${MANPAGER}
> export MANPAGER="cat"
> /usr/bin/man $* | col -b | /usr/local/bin/view -c 'set ft=man nomod nolist' -
> if [[ "${keepPager}" = "" ]]; then
>     unset MANPAGER
> else
>     export MANPAGER=${keepPager}
> fi
> }
>
> I don't see anything (other than perhaps some paths) that wouldn't work
> with bash; when I do  man bash  with it, I get 4517 lines.
>
> Do you get a full manual in a tmp file using the following command?
>
>   /usr/bin/man bash > tmp
>
> (assuming that your man command is in /usr/bin/man; full path was specified
> so as to avoid alias/function modification of the command).

As it is, I get "Vim: Warning: Output is not to a terminal" -- I guess
it's still using MANPAGER.  If I run "MANPAGER=tee /usr/bin/man bash >
tmp" then I get the whole file in the "tmp" file.  I guess that what
is happening is that either "col -b" or vim itself is doing something
funny when it gets the '\267' character somewhere in the file -- hence
Ciaran's suggestion for using 'tr'.

Anyway, it seems to work fine now, so I guess I can adopt an "if it
ain't broke, don't fix it" attitude now!

On an irrelevant-to-this-email note, thank you so much for all the
tips, scripts and mailing-list help you've given -- they've
contributed more to my .vim/ and .vimrc than anyone/thing else!

Al