RE: Wrapping by substitution

2006-10-18 Thread Steve Hall
From: Tim Chase, Wed, October 18, 2006 12:00 pm > > > The application is this :version pretty-fier: > > > > function! Str_wrap(str, len) > > return substitute(a:str, '[[:print:]]\{,'.a:len.'}','&\n','g') > > endfunction > > I must be missing something...in your original post, you didn't > have an

Re: Wrapping by substitution

2006-10-18 Thread Tim Chase
I'm having a mental block, how can I wrap a string via substitute() ? The following seems to do the trick for me: echo substitute(str, '[[:print:]]\{,10}', '&\n', 'g') This nearly works, but is doubling existing line breaks. The application is this :version pretty-fier: function! Str_wra

Re: Wrapping by substitution

2006-10-18 Thread A.J.Mechelynck
Steve Hall wrote: From: Tim Chase, Wed, October 18, 2006 6:46 am I'm having a mental block, how can I wrap a string via substitute() ? The following seems to do the trick for me: echo substitute(str, '[[:print:]]\{,10}', '&\n', 'g') This nearly works, but is doubling existing line breaks.

RE: Wrapping by substitution

2006-10-18 Thread Steve Hall
From: Tim Chase, Wed, October 18, 2006 6:46 am > > > I'm having a mental block, how can I wrap a string via > > substitute() ? > > The following seems to do the trick for me: > > echo substitute(str, '[[:print:]]\{,10}', '&\n', 'g') This nearly works, but is doubling existing line breaks. The a

Re: Wrapping by substitution

2006-10-18 Thread Yakov Lerner
On 10/18/06, Steve Hall <[EMAIL PROTECTED]> wrote: I'm having a mental block, how can I wrap a string via substitute() ? I've been trying something like: let str = "123456789012345678901234567890" let str = substitute(str, '\n\([[:print:]]\{-10,}\)', '\n\1\n', '') echo str to produce:

Re: Wrapping by substitution

2006-10-18 Thread Tim Chase
I'm having a mental block, how can I wrap a string via substitute() ? I've been trying something like: let str = "123456789012345678901234567890" let str = substitute(str, '\n\([[:print:]]\{-10,}\)', '\n\1\n', '') echo str to produce: 1234567890 1234567890 1234567890 The following