vim: format each long lines and insert just one break afterward

2013-05-18 Thread ping
tested long time no good results... so the goal here sounds simple: say I have * a long text file (over 50K lines), and * each line by itself is a nature paragraph, so sometime is very long (over 1000 charactors). * there are sometimes one of more empty line in between, sometimes not I wanted

Re: vim: format each long lines and insert just one break afterward

2013-05-18 Thread Gary Johnson
On 2013-05-18, ping wrote: > tested long time no good results... > > so the goal here sounds simple: say I have > > * a long text file (over 50K lines), and > * each line by itself is a nature paragraph, so sometime is very long > (over 1000 charactors). > * there are sometimes one of more empty

Re: vim: format each long lines and insert just one break afterward

2013-05-18 Thread ping
On 5/18/2013 5:33 PM, Gary Johnson wrote: On 2013-05-18, ping wrote: tested long time no good results... so the goal here sounds simple: say I have * a long text file (over 50K lines), and * each line by itself is a nature paragraph, so sometime is very long (over 1000 charactors). * there are

Re: vim: format each long lines and insert just one break afterward

2013-05-18 Thread Tim Chase
On 2013-05-18 20:22, ping wrote: > 1) :'<,'>g/.*/exec "normal! o\" > unconditionally insert a new line after each line (this may bring a > lot of empty lines , if the original book already contains empty > lines) Any line matching ".*" could be written as just "^", and the "normal..." bit can be d

Re: vim: format each long lines and insert just one break afterward

2013-05-18 Thread ping
On 5/18/2013 11:13 PM, Tim Chase wrote: On 2013-05-18 20:22, ping wrote: 1) :'<,'>g/.*/exec "normal! o\" unconditionally insert a new line after each line (this may bring a lot of empty lines , if the original book already contains empty lines) Any line matching ".*" could be written as just "^

Re: vim: format each long lines and insert just one break afterward

2013-05-19 Thread Gary Johnson
On 2013-05-19, ping wrote: > On 5/18/2013 11:13 PM, Tim Chase wrote: > >On 2013-05-18 20:22, ping wrote: > >>1) :'<,'>g/.*/exec "normal! o\" > >>unconditionally insert a new line after each line (this may bring a > >>lot of empty lines , if the original book already contains empty > >>lines) > >Any

Re: vim: format each long lines and insert just one break afterward

2013-05-20 Thread ping
this look much simpler, quick and works great. good to learn! On 05/19/2013 02:30 PM, Gary Johnson wrote: Putting those together with a visual-mode mapping yields this: :vnoremap ,bf :s/\(\s*\n\)\+/\r\r/gvgq still, just for a learning purpose, I'm curious about what's wrong with the

Re: vim: format each long lines and insert just one break afterward

2013-05-20 Thread Gary Johnson
On 2013-05-20, ping wrote: > this look much simpler, quick and works great. good to learn! > > On 05/19/2013 02:30 PM, Gary Johnson wrote: > > >Putting those together with a visual-mode mapping yields this: > > > > :vnoremap ,bf :s/\(\s*\n\)\+/\r\r/gvgq > > > still, just for a learning pur

Re: vim: format each long lines and insert just one break afterward

2013-05-20 Thread ping
On 05/20/2013 01:03 PM, Gary Johnson wrote: The action of the first exec is to expand and execute its arguments, which in this case is a single argument, the string a:firstline . "," . a:lastline . "g/^/exec " . "normal! gqq" Assuming for sake of a concrete example a firstline of 123 and