On 2011-01-08, Bram Moolenaar wrote:
> Gary Johnson wrote:
> 
> > This problem was recently posted to superuser:
> > http://superuser.com/questions/230351/vim-format-latex-issues-with-line-breaks/230380#230380
> > 
> > Vim's indent command, =, obeys the 'cinoptions' '+' flag even though
> > 'cindent' is off.
> > 
> > Start vim like this:
> > 
> >     $ vim -N -u NONE
> > 
> > Enter these lines:
> > 
> >     asdf\\
> >     sdf\\
> >     dfg
> > 
> > Execute
> > 
> >     gg=G
> > 
> > The result looks like this:
> > 
> >     asdf\\
> >                     sdf\\
> >                     dfg
> > 
> > where the second and third lines are indented by two tabs.
> > 
> > Now execute these commands:
> > 
> >     :set cinoptions=+0
> >     gg=G
> > 
> > The indentation is removed.
> > 
> > Since 'cindent' is not set, nor is any other indent option, it seems
> > to me that Vim should not indent those lines.  Their indentation
> > certainly should not be affected by their contents, and should not
> > be affected by the value of 'cinoptions' when 'cindent' is not set.
> > 
> > It also seems odd that with and empty 'cinoptions' the indentation
> > is two tabs when the default value of the '+' flag is one
> > shiftwidth.
> > 
> > The behavior is the same on 7.2.148 on Linux and 7.3.46 on Windows.
> 
> This works as intended.  When you use the "=" operator it has to indent
> some way, and the default is C indenting.  See ":help =".

Thanks for the explanation.  That makes sense.  So I guess that
means that where ":help 'cindent'" says that it "Enables automatic C
program indenting," the emphasis is on the "automatic", i.e., when
the user hits Enter.

In that case, there seems to be a bug in either the default value of
'+' or in the documentation, since the documentation says "(default
'shiftwidth')" while the actual behavior is two times 'shiftwidth'.

Regards,
Gary

-- 
You received this message from the "vim_dev" 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

Raspunde prin e-mail lui