Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
vim: how to gq a visual block?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
ping  
View profile  
 More options Oct 3 2012, 3:22 pm
From: ping <songpingem...@gmail.com>
Date: Wed, 03 Oct 2012 15:22:29 -0400
Local: Wed, Oct 3 2012 3:22 pm
Subject: vim: how to gq a visual block?
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?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ping  
View profile  
 More options Oct 4 2012, 11:30 am
From: ping <songpingem...@gmail.com>
Date: Thu, 04 Oct 2012 11:29:40 -0400
Local: Thurs, Oct 4 2012 11:29 am
Subject: Re: vim: how to gq a visual block?
guys,
any better solution on this?
b.t.w currently I'm working around with 3 steps:

1) visual selecting right (digit) block and remove them
2) gq to re-format with a new 'tw' on the left (letter) block
3) add the removed right (digit) block back on the right

On 10/03/2012 03:22 PM, ping wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Charles Campbell  
View profile  
 More options Oct 4 2012, 12:05 pm
From: Charles Campbell <Charles.E.Campb...@nasa.gov>
Date: Thu, 04 Oct 2012 12:04:56 -0400
Local: Thurs, Oct 4 2012 12:04 pm
Subject: Re: vim: how to gq a visual block?

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ping  
View profile  
 More options Oct 4 2012, 2:05 pm
From: ping <songpingem...@gmail.com>
Date: Thu, 04 Oct 2012 14:04:49 -0400
Local: Thurs, Oct 4 2012 2:04 pm
Subject: Re: vim: how to gq a visual block?

On 10/04/2012 12:04 PM, Charles Campbell wrote:

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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ping  
View profile  
 More options Oct 4 2012, 2:20 pm
From: ping <songpingem...@gmail.com>
Date: Thu, 04 Oct 2012 14:20:24 -0400
Local: Thurs, Oct 4 2012 2:20 pm
Subject: Re: vim: how to gq a visual block?

On 10/04/2012 02:04 PM, ping wrote:

   "That also assumes that the text within is a paragraph, too."

oh I got it, I have to test it with these text, making it "within a
parag"...

LUCY CRAFT: Japan and China             'normalized ties'      
40 years ago and in terms of             economic
relations, are literally 'jo            ined'  'at the hip';
their cross-border trade rea            ching $340 billion
last year. Their political r            elationship,
meanwhile, has been a consta            nt source of 'tension'
And yet while anti-Japanese             'hostility' in China
has 'flared up' repeatedly o            ver the years,
the recent widespread 'fury'             targeted at Japanese
<\n>            <---- must have a new line here

it work!

on the other hand, sometime it doesn't work well...

see I have this texts:

LUCY CRAFT: Japan and China 'normalized ties'                   aaaaaaaaaaa
40 years ago and in terms of economic                           aaaaaaaaaaa
relations, are literally 'joined'  'at the hip';                aaaaaaaaaaa
their cross-border trade reaching $340 billion                  aaaaaaaaaaa
last year. Their political relationship,                        aaaaaaaaaaa
meanwhile, has been a constant source of 'tension'.             aaaaaaaaaaa
And yet while anti-Japanese 'hostility' in China                aaaaaaaaaaa
has 'flared up' repeatedly over the years,                      aaaaaaaaaaa
the recent widespread 'fury' targeted at Japanese               aaaaaaaaaaa
government offices and businesses over the last                 aaaaaaaaaaa
week, 'blindsided' many here - like                             aaaaaaaaaaa
72-year-old 'greengrocer' Hiroko Iwasaki.                       aaaaaaaaaaa

now I set tw=60 and a :B normal! gqap turned it into:

LUCY CRAFT: Japan and China 'normalized ties'           40      aaaaaaaaaaa
years ago and in terms of economic              relations,      aaaaaaaaaaa
are literally 'joined'  'at the hip';        their              aaaaaaaaaaa
cross-border trade reaching $340 billion          last year.    aaaaaaaaaaa
Their political relationship,                meanwhile, has     aaaaaaaaaaa
been a constant source of 'tension'.     And yet while          aaaaaaaaaaa
anti-Japanese 'hostility' in China      has 'flared up'         aaaaaaaaaaa
repeatedly over the years,              the recent              aaaaaaaaaaa
widespread 'fury' targeted at Japanese  government offices      aaaaaaaaaaa
and businesses over the last         week, 'blindsided' many
aaaaaaaaaaa
here - like                     72-year-old 'greengrocer'       aaaaaaaaaaa
Hiroko Iwasaki.                                                 aaaaaaaaaaa

now look at:
'normalized ties'               40
economic                relations,
hip';        their
....

why there are many gaps between the last word of each line to the
previous word?

thanks!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ping  
View profile  
 More options Oct 4 2012, 3:04 pm
From: ping <songpingem...@gmail.com>
Date: Thu, 04 Oct 2012 15:04:20 -0400
Local: Thurs, Oct 4 2012 3:04 pm
Subject: Re: vim: how to gq a visual block?

On 10/04/2012 02:20 PM, ping wrote:

ok that is the 'old' version in www.vim.org

I tested with the cutting version and it looks better.

I'll try using it at my work and feedback issues if I have.
thanks!

regards
ping


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »