On 6/15/06, Sylvain <[EMAIL PROTECTED]> wrote: ...
> I get a line break at the front. You don't say if you're using > setline() or what. Both setline() and append() will use the literal > values for \r and \n. As far as I know, the only way to get it to use > them as line breaks is to use some form of "put" (after deleting the > existing text, of course). > If there's a better way, I'd like to hear it, as this has always been > an annoyance for me also. Yes !! You found my problem :-) I'm using setline() function to replace the line..so I will delete it before I add mine, it's not very elegant so if anyone has a better way, I will take it also :-)
I'm now using lists, everywhere I can, in preference to concatinated strings with newline separators. I usually will split() any such strings I find into a list for easier manipulation. I think this is satisfactorily elegant, and it sidesteps all the usual pitfalls trying to handle line breaks manually.
> In Vim7 you have the option of giving a list to setline() and > append() , which solves the line break ambiguity: > > call setline(".", [ '"", lineString ] ) >
...