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
Message from discussion vim: how to gq a visual block?

Received: by 10.224.189.75 with SMTP id dd11mr6006540qab.6.1349377468333;
        Thu, 04 Oct 2012 12:04:28 -0700 (PDT)
X-BeenThere: vim_use@googlegroups.com
Received: by 10.224.180.143 with SMTP id bu15ls5502032qab.4.gmail; Thu, 04 Oct
 2012 12:04:21 -0700 (PDT)
Received: by 10.224.183.13 with SMTP id ce13mr5997488qab.4.1349377461858;
        Thu, 04 Oct 2012 12:04:21 -0700 (PDT)
Received: by 10.224.183.13 with SMTP id ce13mr5997487qab.4.1349377461847;
        Thu, 04 Oct 2012 12:04:21 -0700 (PDT)
Return-Path: <songpingem...@gmail.com>
Received: from mail-qc0-f169.google.com (mail-qc0-f169.google.com [209.85.216.169])
        by gmr-mx.google.com with ESMTPS id a27si1687245qck.3.2012.10.04.12.04.21
        (version=TLSv1/SSLv3 cipher=OTHER);
        Thu, 04 Oct 2012 12:04:21 -0700 (PDT)
Received-SPF: pass (google.com: domain of songpingem...@gmail.com designates 209.85.216.169 as permitted sender) client-ip=209.85.216.169;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of songpingem...@gmail.com designates 209.85.216.169 as permitted sender) smtp.mail=songpingem...@gmail.com; dkim=pass header...@gmail.com
Received: by mail-qc0-f169.google.com with SMTP id t2so908779qcq.0
        for <vim_use@googlegroups.com>; Thu, 04 Oct 2012 12:04:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=message-id:date:from:user-agent:mime-version:to:cc:subject
         :references:in-reply-to:content-type:content-transfer-encoding;
        bh=BBC/gdYGNBASt4OspJvTOZEwQ4X7UjUh8MdrEhchiW0=;
        b=rEJZar6XJ3ed+Vuqvvcj40DSZ9GLkKTJ8MXZBAUuBYQb60rl8kXkFhclr0yyiCWHNX
         aQj/5QXbdKL53VoOl/AUQKyXAgmzHf0cNOBOLImN0CevrrSFb6ai02adkNSSgEvIe5qL
         oxWld0IPnaaU3ttVEDFaXVm1/qV4tPVpAWVEAjbl6F1UIC01dIC+J5Pd/ozLCZ7jTtu+
         DVsex1e1n3h//tatMzQ+iEQhZkAQhjKw8QRumuOiCgoAGNDg12mRM6FHT41nPvpkp/ry
         TN41Y/VgNeoIdxpt1h5LswwooiSti9/Varo0A25eDpPEmRBt0FyINMjTgPooI+Xg8Xqv
         WSrw==
Received: by 10.49.26.100 with SMTP id k4mr20755585qeg.58.1349377461637;
        Thu, 04 Oct 2012 12:04:21 -0700 (PDT)
Return-Path: <songpingem...@gmail.com>
Received: from [172.25.83.73] (wsip-98-172-152-198.dc.dc.cox.net. [98.172.152.198])
        by mx.google.com with ESMTPS id y17sm7872526qaa.2.2012.10.04.12.04.20
        (version=SSLv3 cipher=OTHER);
        Thu, 04 Oct 2012 12:04:20 -0700 (PDT)
Message-ID: <506DDDB4.2080...@gmail.com>
Date: Thu, 04 Oct 2012 15:04:20 -0400
From: ping <songpingem...@gmail.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120912 Thunderbird/15.0.1
MIME-Version: 1.0
To: vim_use@googlegroups.com
CC: Charles Campbell <Charles.E.Campb...@nasa.gov>
Subject: Re: vim: how to gq a visual block?
References: <506C9075.7040...@gmail.com> <506DB3A8.4060...@nasa.gov> <506DCFC1.5030...@gmail.com> <506DD368.40...@gmail.com>
In-Reply-To: <506DD368.40...@gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit



On 10/04/2012 02:20 PM, ping wrote:
>
>
> On 10/04/2012 02:04 PM, ping wrote:
>>
>>
>> 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?
>>
>
>
>    "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!

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