Re: break very long line into short one with one g-command

2006-10-03 Thread Tim Chase

I have a line from about 40.000 characters.
I want to break this up into lines which are 80 charactes long.

In a previous thread, a few months ago this was possible with one g-command.
I did use it then also, but can't recall it anymore.


I presume you must be misremembering g.  I've done it with :s 
before:


:%s/.\{80\}/\r/g

It's a little trickier if you want it to fall exactly on 
word-boundaries, rather than hacking in the middle of words. 
However, if this is the case, drop a line back and I'll see what 
I can do.


-tim




Re: break very long line into short one with one g-command

2006-10-03 Thread A.J.Mechelynck

Eric Leenman wrote:

Hi,

I have a line from about 40.000 characters.
I want to break this up into lines which are 80 charactes long.

In a previous thread, a few months ago this was possible with one 
g-command.

I did use it then also, but can't recall it anymore.

Thanks,

Kind regards,
Eric

[ad snipped]

For one line:

:setlocal tw=80
gqq

Replace gqq by gqap for a paragraph, gggqG for the whole file, Visualgq etc.


Best regards,
Tony.


Re: break very long line into short one with one g-command

2006-10-03 Thread Eric Leenman

Hi Tim,

I might be mistaking, yes.

The line contains a codes like:
X200, X040, X200, X040, X3FF, X000, X000, X2AC,
Breaking the line after a , would be fine.

Rgds,
Eric


[...]

I presume you must be misremembering g.  I've done it with :s before:

:%s/.\{80\}/\r/g

It's a little trickier if you want it to fall exactly on word-boundaries, 
rather than hacking in the middle of words. However, if this is the case, 
drop a line back and I'll see what I can do.


-tim


_
Search—Your way, your world, right now!  
http://imagine-windowslive.com/minisites/searchlaunch/?locale=en-usFORM=WLMTAG




RE: break very long line into short one with one g-command

2006-10-03 Thread Suresh Govindachar

   I have a line from about 40.000 characters. I want to break 
   this up into lines which are 80 charactes long.
  
   In a previous thread, a few months ago this was possible with
   one g-command. I did use it then also, but can't recall it
   anymore.
  
   I presume you must be misremembering g. I've done it with
   :s before:
  
   :%s/.\{80\}/\r/g
  
   It's a little trickier if you want it to fall exactly on word-
   boundaries, rather than hacking in the middle of words.
   However, if this is the case, drop a line back and I'll see
   what I can do.

  :set tw=80 followed by gqq  

  Whether line break up happens at word boundaries or not depends on
  some parameter -- I have forgotten which.

  --Suresh



Re: break very long line into short one with one g-command

2006-10-03 Thread A.J.Mechelynck

Suresh Govindachar wrote:
   I have a line from about 40.000 characters. I want to break 
   this up into lines which are 80 charactes long.

  
   In a previous thread, a few months ago this was possible with
   one g-command. I did use it then also, but can't recall it
   anymore.
  
   I presume you must be misremembering g. I've done it with
   :s before:
  
   :%s/.\{80\}/\r/g
  
   It's a little trickier if you want it to fall exactly on word-
   boundaries, rather than hacking in the middle of words.
   However, if this is the case, drop a line back and I'll see
   what I can do.

  :set tw=80 followed by gqq  


  Whether line break up happens at word boundaries or not depends on
  some parameter -- I have forgotten which.

  --Suresh




IIUC, hard line breaks always happen between words. When 'formatoptions' 
includes m then multibyte characters 255 are regarded as one word each in 
this respect (useful for CJK).


Soft breaks (i.e. line wrapping with 'wrap' on) happens at the screen edge 
(even in the middle of a word) unless you have both 'linebreak' and 'nolist'.



Best regards,
Tony.