Thursday, October 4, 2012

Re: vim: how to gq a visual block?

On 10/04/2012 12:04 PM, Charles Campbell wrote:
> ping wrote:
>> as in subject, suppose we have a gq'ed block already:
>>
>> 0 1 2
>> 12345678901234567890123456789
>> lsdjflsdlksjfsdlfjsld 123
>> lsjfsdfksdjfldsfsdlsl 456
>> lsjdlfsdlfjsalfslfsjs 789
>>
>>
>> now I want to re-format the character blocks , for example, extend
>> them from current length 21 to some other length, say, 25, or squeeze
>> to 18, without affacting the "digit blocks".
>>
>> is it possible at all with any command or plugins?
>>
> Not a perfect solution, because the righthand side digits may move (as a
> column) a bit, but:
>
> * set tw=(new value here)
> * ctrl-v block of characters
> * :B norm! gqap
>
> That also assumes that the text within is a paragraph, too.
>
> The ":B" is supported by my vis plugin:
>
> You can get vis.vim from:
>
> http://vim.sourceforge.net/scripts/script.php?script_id=1195
> (stable)
> http://www.drchip.org/astronaut/vim/index.html#VIS (cutting
> edge)
>
> Regards,
> C Campbell
>

thanks! I was just thinking to look at your vim website for some help...

but it looks not always work well, sometime it even change the text
sequences, is there any internal "sort" in the process flows?


the example text:

LUCY CRAFT: Japan and China 'normal
40 years ago and i n terms of econom
relations, are lit erally 'joined'
their cross-border trade reaching $
last year. Their p olitical relation
meanwhile, has bee n a constant sour
And yet while anti -Japanese 'hostil
has 'flared up' re peatedly over the
the recent widespr ead 'fury' target
government offices and businesses o
week, 'blindsided' many here - like
72-year-old 'green grocer' Hiroko Iw



I set tw=50, c-v selected the left block, move cursor to the bottom CHAR
'n', then :B normal! gqap
and I got this:



Their p meanwhile, has and China 'normal n terms
bee And yet while anti of econom erally 'joined'
has 'flared up' re the trade reaching $ olitical
recent widespr relation n a constant sour
government offices week, -Japanese 'hostil peatedly
'blindsided' 72-year-old over the ead 'fury' target
'green and businesses o many here
- like grocer' Hiroko Iw
LUCY CRAFT: Japan 40
years ago and i
relations, are lit their
cross-border last year.


so the text block that I applied the gqap just got indented, making them
looks like 50 textwidth, but not re-wrap the whole block?

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: