Tuesday, December 4, 2012

Re: vim: strange issue with gq

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

No comments:

Post a Comment