Loading ...
Sorry, an error occurred while loading the content.

How to set vim as the default pager for perldoc?

Expand Messages
  • Peng Yu
    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
    Message 1 of 4 , Aug 6, 2012
    • 0 Attachment
      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"

      Thanks,
      Peng

      --
      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
    • Christian Brabandt
      Hi Peng! ... 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
      Message 2 of 4 , Aug 7, 2012
      • 0 Attachment
        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
      • Peng Yu
        ... Thanks, Christian. Using the above export, I tried perldoc -f open. But the following line is not showing correctly. I think that probably ft be changed
        Message 3 of 4 , Aug 7, 2012
        • 0 Attachment
          > export PERLDOC_PAGER="sh -c \"col -b -x| vim -R -c 'set ft=man' - \" <"

          Thanks, Christian.

          Using the above export, I tried perldoc -f open. But the following
          line is not showing correctly. I think that probably "ft" be changed
          to something other than man. Are you aware of the alternative?

          These various prefixes correspond to the 4mfopen24m(3) modes of "r",

          --
          Regards,
          Peng

          --
          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
        • Charles Campbell
          ... Hello, Peng! You could try manpageview (http://www.drchip.org/astronaut/vim/index.html#MANPAGEVIEW). ex. :Man sprintf.pl One may use the shell, too: gvim
          Message 4 of 4 , Aug 7, 2012
          • 0 Attachment
            Peng Yu wrote:
            >> export PERLDOC_PAGER="sh -c \"col -b -x| vim -R -c 'set ft=man' - \"<"
            >>
            > Thanks, Christian.
            >
            > Using the above export, I tried perldoc -f open. But the following
            > line is not showing correctly. I think that probably "ft" be changed
            > to something other than man. Are you aware of the alternative?
            >
            > These various prefixes correspond to the 4mfopen24m(3) modes of "r",
            >
            >
            Hello, Peng!

            You could try manpageview
            (http://www.drchip.org/astronaut/vim/index.html#MANPAGEVIEW).

            ex. :Man sprintf.pl

            One may use the shell, too:

            gvim -c "Man $*" -c "silent! only" sprintf.pl

            You can wrap the shell command above into a function:


            function man
            {
            gvim -c "Man $*" -c "silent! only"
            }

            then man sprintf.pl will bring up the manpage for Perl's sprintf()
            function. When editing a Perl script, a "K" pressed in normal mode
            while atop something that perldoc knows about will bring up the manpage
            for it.

            Regards,
            Chip Campbell


            --
            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
          Your message has been successfully submitted and would be delivered to recipients shortly.