On Sun, Jun 25, 2006 at 08:16:54PM -0600, Trent Michael Gamblin wrote:
> I'm having trouble getting the Man command working with Vim. I have the 
> line:
> 
>    runtime ftplugin/man.vim
> 
> in my ~/.vimrc. When I type :Man <man page> I get this:
> 
> >Vim: Warning: Output is not to a terminal
> >Vim: Warning: Input is not from a terminal
> >^M
> >Error executing formatting or display command.
> >System command (cd /usr/share/man && (echo ".pl 11i"; /usr/bin/gunzip 
> >-c '/usr/sNo manual entry for va_arg
> >"-stdin-"2[readonly]2157L,-5815C1;24r?12;25h?12l?25h27mmH2J1;1H35mSTDARG(3)
> >
> >33mSYNOPSISm
> >35m       #include m31m<stdarg.h>m11;8H32mvoidm 
> >36mva_startm(32mva_listm ap, las
> 
> 
> It looks like some errors followed by the beginning of the man page. Can 
> anyone help me?
> Thanks. Have a nice day.

On Mon, Jun 26, 2006 at 04:47:19PM -0600, Trent Michael Gamblin wrote:
> Benji Fisher wrote:
> 
> >    What version of vim and what OS are you using?
> >
> >    Unless someone has a better idea, I need more information to figure
> >this out.  You can try
> >
> >:redir > vimlog.txt
> >:12 verbose Man cvs
> >:redir END
> >
> >and then look at vimlog.txt or send it to the list.
> 
> I'm using Vim 7.0 and Fedora Core 4. Here is the output of the commands 
> you wrote, which
> doesn't show anything to me:
> 
[snip]
> continuing in BufEnter Auto commands for "*"
> 
> calling function <SNR>6_GetPage..<SNR>6_GetCmdArg
> 
> function <SNR>6_GetPage..<SNR>6_GetCmdArg returning 'cvs'
> 
> continuing in function <SNR>6_GetPage
> 
> Calling shell to execute: "(/usr/bin/man cvs | col -b) >/tmp/v364103/2 2>&1"
> 17 more lines
[snip]
> 
> I have also tried the manpageview script suggested but I get
> "Vim: Warning: Output is not to a terminal"
> And then the only thing I can do is Ctrl-Z and kill vim
> 
> I would appreciate any help very much. Thanks.

     I understand some of what is going on, but not all.

     The part I did not snip seems to be where the problem is.  When I
try it, I get something similar but with 1323 more lines, presumably the
whole man page, instead of 17 lines.

     The GetPage() function is defined in the default ftplugin/man.vim ;
the <SNR>6_ part means that it is a script-local function (defined as
s:GetPage() ) and this is the sixth script that was :source'd when you
started vim.  (You can confirm this with :scriptnames .)  Looking at
$VIMRUNTIME/ftplugin/man.vim and the definition of s:GetPage() (well, it
is defined as <SID>GetPage(), close enough), I see the line

  silent exec "r!/usr/bin/man ".s:GetCmdArg(sect, page)." | col -b"

and this is what calls "man cvs", filters it through "col -b" (to remove
backspaces and other nasties), and reads it into the empty buffer.

     I think this is important, but I do not understand it completely.
When I try

$ man cvs | col -b | less

or simply

$ man cvs | less

I get a similar error message, "Error executing formatting or display
command ... " after I exit less.  I guess that was sent to stderr?  (I
am pretty sure that man is /usr/bin/man .)  So somehow vim is reading
stderr into your buffer instead of stdout?

     Again, maybe someone else can figure this out.  If not, here are
some more things to try as we attempt to figure out what is going wrong.

$ vim -u NONE
:runtime ftplugin/man.vim
:Man cvs

This will start up vim without your usual vimrc file.  Is the problem
still there?  If the problem goes away, maybe you have some weird
setting for your 'shellredir' option or something.  What does

:set shell? shellredir?
:echo $SHELL

tell you?

     Next, you can try (from an empty buffer)

:r! man cvs

or

:r! man cvs | col -b

Do you get the same error message, or do you get the man page?

HTH                                     --Benji Fisher

Reply via email to