Wednesday, December 23, 2009

Re: Best practice to put lines into new buffer

On 23 déc, 21:23, Christian Brabandt <cbli...@256bit.org> wrote:
> Hi epanda!
>
> On Mi, 23 Dez 2009, epanda wrote:
>
> > Hi,
>
> > I have some data into Dict or List
>
> > I use actually this command in order to put data from my List to the
> > current buffer and saving it to a new file.
>
> > let newContent .= join(g:myListOfLines,'')
> > exec 'norm O' . newContent
>
> > Is there a better solution to have a real gain of time ?
>
> Well you could test usinghttp://www.vim.org/scripts/script.php?script_id=1530
>
> Here is a simple test case:
> :TIME 100 :call append('$', join(g:a))
> Execution took   0.005195 sec. (count=100)
> :TIME 100 :put =join(g:a)
> Execution took   0.004757 sec. (count=100)
> :TIME :exe 'norm o'.join(g:a)
> Execution took   0.036771 sec. (count=100)
>
> So :exe 'norm o' is one order of magnitude slower. But I am interested
> in your timings.
>
> regards,
> Christian
> --
> :wq

put does not understand either \n or windows CR : ^M
It put my string which contains CR on one line.

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments: