> 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.
>
> Here's an example:
>
> someVariable = (someOtherVariable + stillSomeOtherVariable)
> * (someOtherVariable - stillSomeOtherVariable)
> * - someVariable * someOtherVariable;
> ^
> ^
> Vim inserted the leading '*' automagically
>
>
> Does anyone know if there's a way to limit the automatic insertion of
> characters at the beginning of a line to just the comment sequence?
> Short of that, maybe somebody knows what setting controls this behavior?
>
> -- Jay
>
> --
> 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
I think Vim mistakes your multiply operator for the middle part of a
three-piece comment, as in
/*
* void foobar(int a, char_u *b)
* Lorem ipsum dolor sit amet, consectetur adipisicing
* elit, sed do eiusmod tempor incididunt ut labore et
* dolore magna aliqua. Ut enim ad minim veniam, quis
* nostrud exercitation ullamco laboris nisi ut aliquip ex
* ea commodo consequat. Duis aute irure dolor in
*
* a: reprehenderit in voluptate velit esse cillum dolore eu
* b: fugiat nulla pariatur. Excepteur sint occaecat
*/
void
foobar(a, b)
int a;
char_u *b;
{
int i;
int j;
etc.
See
:help 'comments'
:help format-comments
Best regards,
Tony.
--
Pittsburgh Driver's Test
(8) Pedestrians are
(a) irrelevant.
(b) communists.
(c) a nuisance.
(d) difficult to clean off the front grille.
The correct answer is (a). Pedestrians are not in cars, so they are
totally irrelevant to driving; you should ignore them completely.
--
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