The attached patch adds the "j" flag to 'formatoptions' which is
described in todo.txt as follows:
7   Add 'j' flag to 'formatoptions': Remove comment leader when joining lines.

It makes it possible to perform a join on the following lines:
#v+
/*
 * Comment
 */
#v-

to obtain:
#v+
/* Comment */
#v-

It detects comments after some code, so:
#v+
if (condition) /* Comment
                * comment.
                */
#v-

will become:
#v+
if (condition) /* Comment comment */
#v-

and is intelligent enough to convert:
#v+
if (condition) // comment
               // comment
{
#v-

into:
#v+
if (condition) // comment comment
{
#v-

but to keep the comment leader in the following situation:
#v+
if (condition) /* comment */
               // comment
{
#v-

and yield:
#v+
if (condition) /* comment */ // comment
{
#v-

I added some tests for the functionality.

Cheers,
Lech

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

Attachment: formatoptions-j-join-removes-comments.patch
Description: Binary data

Raspunde prin e-mail lui