Tuesday, October 23, 2012

Re: gvim --help

On Wed, October 24, 2012 01:13, Tony Mechelynck wrote:
> On 23/10/12 21:48, Marc Weber wrote:
>> What magic is gvim doing to hide its documentation?
>>
>> I understand this:
>> [marc@nixos:~]$ gvim --help 1> /tmp/file; ls -l /tmp/file
>> 3326 (bytes in /tmp/file)
>>
>> I'd expect stdout to be printed to my console
>> [marc@nixos:~]$ gvim --help 2> /tmp/file; ls -l /tmp/file
>> 0 (bytes in /tmp/file)
>>
>> I'd expect stdout to be written to the file
>> [marc@nixos:~]$ bash -c "(gvim --help) >/tmp/file 2>&1" ; ls -l
>> /tmp/file
>> 0 (bytes in /tmp/file)
>>
>> So why is gvim hiding its documentation when stderr is redirected to a
>> file?
>>
>> Marc Weber
>>
>
> The following works for me when using gvim 7.3.712 with GTK2-GNOME GUI:
>
> gvim --help
> help appears in the terminal
>
> gvim --help >gvimhelp.txt
> help is written to gvimhelp.txt
>
> gvim --help >gvimhelp1.txt 2>&1
> help is written to gvimhelp1.txt
>
> gvim --help |tee gvimhelp2.txt
> help is written to gvimhelp2.txt
>
> gvim --help 2>&1 |tee gvimhelp3.txt
> help is written to gvimhelp3.txt
>
> gvim --help 2>gvim.stderr.txt
> help appears in the terminal
> gvim.stderr.txt is created zero-length
>
> gvim --help 1>gvimhelp4.txt 2>gvim.stderr2.txt
> help (2236 bytes) appears in gvimhelp4.txt
> gvim.stderr2.txt is created zero-length
>
> (gvim --help) >gvimhelp5.txt 2>&1
> help (2236 bytes) appears in gvimhelp5.txt
>
> bash -c '(gvim --help) >gvimhelp6.txt 2>&1'
> (with single quotes)
> help appears in gvimhelp6.txt
>
> bash -c "(gvim --help) >gvimhelp7.txt 2>&1"
> (with double quotes)
> help appears in gvimhelp7.txt
>
> The fact that I look at the file afterwards is not the reason:
>
> bash -c "(gvim --help) >gvimhelp8.txt 2>&1" ; ls -l gvimhelp8.txt
> -rw-r--r-- 1 root root 2236 Oct 24 00:34 gvimhelp8.txt
>
> However:
> linux:~ # su -l tonymec
> tonymec@linux:~> gvim --help >gvimhelp.txt; ls -l gvimhelp.txt
> E233: cannot open displayVim: Warning: Output is not to a terminal
>
> Press ENTER or type command to continue
>
> (then nothing else appears, and keyboard stops being responsive, until I
> hit Ctrl-Alt-F4 to log in as root to /dev/tty4 and kill gvim from there)
>
> Writing viminfo file "/home/tonymec/.viminfo"
> Terminated
> -rw-r--r-- 1 tonymec ajm-user 11925 Oct 24 00:55 gvimhelp.txt
>
> Inspection of this gvimhelp.txt shows that it contains one "vim screen"
> (in colorscheme colours), the help (in konsole colours) then the bottom
> of the Vim screen including a "wildmenu" but no statusline.
>
> Which gvim flavour are you using? The first lines of :version in my gvim
> (see ":help :redir" about how to capture them into @+ which is the
> clipboard) are as follows:
>
> VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Oct 23 2012 05:40:32)
> Included patches: 1-712
> Compiled by antoine.mechelynck@gmail.com
> Huge version with GTK2-GNOME GUI. Features included (+) or not (-):
>

Yes, there is a #ifdef FEAT_GUI_GNOME in main.c that let's vim.gnome
(vim compiled with gnome gui) behave as expected, but all other gui
versions won't.

regards,
Christian

--
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: