Monday, June 21, 2010

Re: Automatic lists

On 2010-06-21, Jay Heyl wrote:
> On Mon, Jun 21, 2010 at 11:03 AM, Ben Fritz <fritzophrenic@gmail.com> wrote:
>
>
> On Jun 20, 6:36 pm, Tony Mechelynck <antoine.mechely...@gmail.com>
> wrote:
> > On 20/06/10 23:10, Jay Heyl wrote:
> >
> > > I use Vim primarily for editing C source files. The feature that
> > > automatically repeats the comment marker, "//", at the start of a new
> > > line in insert mode is great.
> >
> > > Unfortunately, what I suspect is a related characteristic is not so
> > > great. Several times now I've been editing a line that begins with a
> > > multiply symbol, "*", separated by a space from the variable name that
> > > follows. When I press Enter I get a multiply symbol at the start of the
> > > next line. This isn't a major annoyance when I'm entering new code
> > > because it's readily noticeable, but when I'm reformatting existing
> code
> > > it's very easy to overlook and can create some highly unwanted results.
> > > Recently this happened and I didn't catch it. The result was an
> infinite
> > > loop that cost about two man-days to find.
> >
> >
> > I think Vim mistakes your multiply operator for the middle part of a
> > three-piece comment
>
> I think this as well. You can fix this (but lose the automatic
> insertion of these three-piece comments) by tweaking your 'comments'
> option, probably in ~/.vim/after/ftplugin/c.vim, to remove the "s1:/
> *,mb:*,ex:*/" that is included by default.
>
>
> It would seem to be something else. I commented out the whole "setlocal
> comments..." line in ftplugin/c.vim to see what would happen and I'm still
> seeing the same behavior.

That's what I thought at first, too, since I thought the three-part
comment feature was smarter than that. However, I tried an
experiment starting vim as

vim -N -u NONE -c 'set fo+=ro'

then pasting your example code into the buffer and typing "o" on the
last line. The new line started with an "*".

I also thought it might be a new bug, so I repeated the experiment
using vim 6.3. Same result.

Note that the default value of the 'comments' option includes the C
three-part comment. That's why your commenting out of the
"setlocal" stuff had no effect on this behavior.

So I think your stuck with Ben's solution.

Regards,
Gary

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