vim: strange issue with gq

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

vim: strange issue with gq

ping song
hi:
I have following text (from Dickens)

I was born with a caul, which was advertised for sale, in
the newspapers, at the low price of fifteen guineas. Whether


whenever I gqap it with tw=45, it will persistently produce:

I was born with a caul, which was advertised
for sale, in the newspapers, at the low price
     of fifteen guineas. Whether

I tested some other paragraphs from the same novel, can't reproduce it.

I know there must be sth in my .vimrc, since another machine (and vim -u
NONE) there is no issues with the same texts. But I just can't locate
the issues.

any idea how to narrow it down?

--
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
Reply | Threaded
Open this post in threaded view
|

Re: vim: strange issue with gq

Tony Mechelynck
On 05/12/12 03:08, ping wrote:

> hi:
> I have following text (from Dickens)
>
> I was born with a caul, which was advertised for sale, in
> the newspapers, at the low price of fifteen guineas. Whether
>
>
> whenever I gqap it with tw=45, it will persistently produce:
>
> I was born with a caul, which was advertised
> for sale, in the newspapers, at the low price
>      of fifteen guineas. Whether
>
> I tested some other paragraphs from the same novel, can't reproduce it.
>
> I know there must be sth in my .vimrc, since another machine (and vim -u
> NONE) there is no issues with the same texts. But I just can't locate
> the issues.
>
> any idea how to narrow it down?
>

1. Make that file current (Place the blinking cursor in its window),
either by clicking, by Ctrl-W w, by means of ":e filename" or ":new
filename", or by any other appropriate means.

2. :verbose setlocal formatexpr? formatoptions?


Best regards,
Tony.
--
"They told me I was gullible ... and I believed them!"

--
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
Reply | Threaded
Open this post in threaded view
|

Re: vim: strange issue with gq

scott-268
In reply to this post by ping song
On Tue, Dec 04, 2012 at 09:08:42PM -0500, ping wrote:
> hi:
> I have following text (from Dickens)

> I was born with a caul, which was advertised for sale, in
> the newspapers, at the low price of fifteen guineas. Whether


> whenever I gqap it with tw=45, it will persistently produce:

> I was born with a caul, which was advertised
> for sale, in the newspapers, at the low price
>    of fifteen guineas. Whether

> I tested some other paragraphs from the same novel, can't reproduce it.

> I know there must be sth in my .vimrc, since another machine (and vim -u
> NONE) there is no issues with the same texts. But I just can't locate
> the issues.

> any idea how to narrow it down?

I'd start by asking vim what he believes is the filetype -- this looks
to me like a syntax buggaboo.

sc

--
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
Reply | Threaded
Open this post in threaded view
|

Re: vim: strange issue with gq

ping song
In reply to this post by Tony Mechelynck
On 12/4/2012 9:24 PM, Tony Mechelynck wrote:
> 1. Make that file current (Place the blinking cursor in its window),
> either by clicking, by Ctrl-W w, by means of ":e filename" or ":new
> filename", or by any other appropriate means.
>
> 2. :verbose setlocal formatexpr? formatoptions?

here is the values of :verbose setlocal
formatoptions=tcqmB
formatexpr=
filetype=text
Last set from /usr/share/vim/vim73/filetype.vim

thanks!

--
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
Reply | Threaded
Open this post in threaded view
|

Re: vim: strange issue with gq

Benjamin R. Haskell-8
In reply to this post by ping song
On Tue, 4 Dec 2012, ping wrote:

> hi:
> I have following text (from Dickens)
>
> I was born with a caul, which was advertised for sale, in
> the newspapers, at the low price of fifteen guineas. Whether
>
>
> whenever I gqap it with tw=45, it will persistently produce:
>
> I was born with a caul, which was advertised
> for sale, in the newspapers, at the low price
>    of fifteen guineas. Whether
>
> I tested some other paragraphs from the same novel, can't reproduce
> it.
>
> I know there must be sth in my .vimrc, since another machine (and vim
> -u NONE) there is no issues with the same texts. But I just can't
> locate the issues.
>
> any idea how to narrow it down?

It's a side-effect of 'smartindent' ('si').

From :help 'smartindent':

"""
  An indent is automatically inserted:
  [...]
  - After a line starting with a keyword from 'cinwords'.
"""

Default value of 'cinwords': "if,else,while,do,for,switch"

So, it's because the second line starts with 'for'.

In my experience, 'smartindent' is rarely smart.  Most languages to
which it might apply already have smarter indent functions.  And outside
of programming, you definitely don't want it turned on.

--
Best,
Ben

--
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
Reply | Threaded
Open this post in threaded view
|

Re: vim: strange issue with gq

ping song
In reply to this post by ping song
On 12/5/2012 12:07 AM, ping wrote:

> On 12/4/2012 9:24 PM, Tony Mechelynck wrote:
>> 1. Make that file current (Place the blinking cursor in its window),
>> either by clicking, by Ctrl-W w, by means of ":e filename" or ":new
>> filename", or by any other appropriate means.
>>
>> 2. :verbose setlocal formatexpr? formatoptions?
>
> here is the values of :verbose setlocal
> formatoptions=tcqmB
> formatexpr=
> filetype=text
> Last set from /usr/share/vim/vim73/filetype.vim
>
> thanks!

it looks this is permanently reproducible , even with:
* vim -u NONE
* another linux machine
as long as I set 'smartindent'.

steps to reproduce:
1. vim -u NONE
2. paste following texts (from Dickens noval)

I was born with a caul, which was advertised for sale, in the
newspapers, at the
low price of fifteen guineas. Whether sea-going people were short of
money about
that time, or were short of faith and preferred cork jackets, I don't
know; all

3. set tw=45
4. set smartindent
5. gqap

you'll see it.

I check :help smartindent, but I couldn't find anything related to this,
maybe I missed sth (stupid)?

thanks

regards
ping


--
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
Reply | Threaded
Open this post in threaded view
|

Re: vim: strange issue with gq

ping song
In reply to this post by Benjamin R. Haskell-8
On 12/5/2012 12:20 AM, Benjamin R. Haskell wrote:

> It's a side-effect of 'smartindent' ('si').
>
>  From :help 'smartindent':
>
> """
>      An indent is automatically inserted:
>      [...]
>      - After a line starting with a keyword from 'cinwords'.
> """
>
> Default value of 'cinwords': "if,else,while,do,for,switch"
>
> So, it's because the second line starts with 'for'.
>
> In my experience, 'smartindent' is rarely smart.  Most languages to
> which it might apply already have smarter indent functions.  And outside
> of programming, you definitely don't want it turned on.

exactly that's what I just found of...
thanks for the smart response!
I'll turn it off from now on...

regards
ping

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