Tuesday, August 7, 2012

Re: How to set vim as the default pager for perldoc?

Hi Peng!

On Mo, 06 Aug 2012, Peng Yu wrote:

> Hi,
>
> I use the following to set vim as the default paper for man, which
> works fine.
>
> export MANPAGER="col -b -x | vim -R -c 'set ft=man' -"
>
> But when I do the same thing perldoc,
>
>
> export PERLDOC_PAGER="col -b -x | vim -R -c 'set ft=man' -"
>
> I got the following message. Does anybody know what is the correct way
> to set vim as the default paper for perldoc?
>
> ~$ perldoc Data::Dumper
> VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jul 26 2012 01:05:30)
> Too many edit arguments: "/var/folders/ok/okxjw3HGEsyvIrMaKBkHhE+++TI/-
> Tmp-/f9CAilKxGD"
> More info with: "vim -h"

Looks like, perldoc pager adds the temporary file as last argument, but
you told Vim to read the file from standard input.

You should make a script out of it, e.g. something like this:
#!/bin/sh

col -b -x <$1|vim -R -c 'set ft=man' -

Or try to use this one liner (not sure, this works everywhere):

export PERLDOC_PAGER="sh -c \"col -b -x| vim -R -c 'set ft=man' - \" <"

regards,
Christian
--
Das Beste, was wir von der Geschichte haben, ist der Enthusiasmus, den
sie erregt.
-- Johann Wolfgang von Goethe

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: