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

2011-08-08 Thread Bram Moolenaar
Christian Brabandt wrote: On Do, 04 Aug 2011, Tim Chase wrote: [fullquote, cause forwarding to vim-dev] On 08/04/2011 10:02 AM, ranou...@gmx.com wrote: A remark about :put =list I tried :put =[ 'str1', 'str2', '', 'str3', '' ] the '' are here to insert empty lines. The last one is

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

2011-08-08 Thread Christian Brabandt
Hi Bram! On Mo, 08 Aug 2011, Bram Moolenaar wrote: Christian Brabandt wrote: On Do, 04 Aug 2011, Tim Chase wrote: [fullquote, cause forwarding to vim-dev] On 08/04/2011 10:02 AM, ranou...@gmx.com wrote: A remark about :put =list I tried :put =[ 'str1', 'str2', '', 'str3', ''

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

2011-08-07 Thread Christian Brabandt
On Do, 04 Aug 2011, Tim Chase wrote: [fullquote, cause forwarding to vim-dev] On 08/04/2011 10:02 AM, ranou...@gmx.com wrote: 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

Re: A few questions about :append and ex

2011-08-04 Thread Tim Chase
On 08/04/2011 03:16 AM, ranou...@gmx.com wrote: 1) If I understand right, :append is used this way :append line1 line2 . and . means end, in a similar way as catEOF line1 line2 EOF What could I do if I want to insert a line containing only a point. I don't really need this but I'm curious ;-)

RE: A few questions about :append and ex

2011-08-04 Thread John Beckett
ranousse wrote: 1) If I understand right, :append is used this way :append line1 line2 . I suspect that :append is not used much. Try these examples: :let var = 'Hello world' :put =var :let list = ['one', 'two', 'three', var] :put =list John -- You received this message from the vim_use

Re: A few questions about :append and ex

2011-08-04 Thread ranousse
sh -s '%s/pattern/replace/g | w' file I'm not sure I follow this example...you never invoke vim/vi/ed/ex to edit the stream. And for the change in question, unless your pattern includes vim-specific tokens, I'd be tempted just to use sed. Oups I did not write the right command. I meant

Re: A few questions about :append and ex

2011-08-04 Thread ranousse
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'] which pretty cleanly seems to do what you want for both cases. And thank you for the explanation. It's really cleaner than my

Re: A few questions about :append and ex

2011-08-04 Thread Tim Chase
On 08/04/2011 08:59 AM, ranou...@gmx.com wrote: 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'] Just to be clear, I should have said :put with the expression register, which *can

Re: A few questions about :append and ex

2011-08-04 Thread ranousse
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

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

2011-08-04 Thread Tim Chase
On 08/04/2011 10:02 AM, ranou...@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

Re: A few questions about :append and ex

2011-08-04 Thread John Little
ranousse wrote: 1) If I understand right, :append is used this way :append line1 line2 . :append is a relic (in the sense of something left behind) of line editors for teletype terminals, from the 1960s, roughly qed begat ed begat ex begat vi begat vim. IMHO of historical interest only.