Thursday, August 4, 2011

Re: BUG with :put=[..., ''] (was: A few questions about :append and ex)

On 08/04/2011 10:02 AM, ranousse@gmx.com wrote:
>> How are you finding that "-c does not do exactly the same thing"? I
>> just issued:
>>
>> bash$ seq 20> test.txt
>> bash$ ex -c '10s/$/hello' -c '15>' -c 'wq' test.txt
>
> The result in the file is the same, but when I launch the command I see
> a kind of flash (like when something is opened and then closed and I have
> not enough time to see it well).
> Whereas with stdin, I do not see this flash, ex window is never opened
> in this case. Everything is done entirely silently.

That's Vim painting itself on the screen. You can hide/prevent
that with

ex -c '%s/$/hello/' -c '15>' -c 'wq' test.txt > /dev/null

(pipe the redraw to /dev/null or use "NUL" if at a Win32 command
shell)

>>>> For such an example, I'd use a combination of :put with the
>>>> expression register, which takes a list:
>>>>
>>>> :put=[var, 'line2', '.', 'that was a line with 1 period']
>
> A remark about :put =list
> I tried :put =[ 'str1', 'str2', '', 'str3', '' ]
> the '' are here to insert empty lines.
> The last one is not inserted.

I see the same results here (the first empty string is added, the
second/last one isn't) and I would call this a bug.

-tim

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