Monday, February 27, 2012

Re: If there is a > in exactly the 80th character, the following lines will be double-quoted after gq

On Tue, February 28, 2012 01:57, Tim Chase wrote:
> On 02/27/12 14:11, Matt Ackeret wrote:
>
>> I got an email that had in exactly the 80th column. (I read
>> email in alpine, with vim as my alternate editor.)
>>
>> The text was not wrapped, so I gq it.
>
> I see the same peculiar behavior in my slightly older 7.2.445
> (stock on Debian Stable). To duplicate, I did the following:
>
> vim blank_file.txt
> :0put='>This is the first line of the quoted'
> :t.|t.|%j
> :set tw=40
> gqip
>
> and I ended up with sequential increments of ">" indentation
> where I would normally have expected one ">" on each line.

This depends on the value of the 'formatoptions' setting.
By default, vim includes the 'q'. If you remove the q, Vim won't
include a new comment-leader when wrapping the text.

I think how it actually works is that vim inspects the 'comments' setting
and uses it to recognize comments. After wrapping, the line already
contains the '>' at the beginning, but since nesting is allowed
(:set comments includes n:>), Vim insert the same amount of comment
leaders at the beginning of the line as on the previous line.

regards,
Christian

--
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:

Post a Comment