Friday, April 27, 2012

Re: vim and doxygen (c-style) block comment problems

On Fri, Apr 27, 2012 at 10:32 AM, Justin <jrrandall@gmail.com> wrote:
> Hello all,
>
> I have this annoying problem and I'm hoping some of the vim gurus out
> there will be able to help me.  I'm a C++ programmer and I love
> working with vim.  My new project is requiring C-style block comments
> be used on our source files, and we also use doxygen.  Herein lies the
> problem.  Doxygen needs special comment block styles in order to
> properly generate the documentation (see http://www.stack.nl/~dimitri/doxygen/docblocks.html
> ).  We're using doxygen comment style #4 in our project, and
> unfortunately this is causing me headaches within vim.
>
> Basically, the comment style is using two c-style comment blocks on
> one line (a full /* ... */ followed by the start of another /* ... )
> and this is causing vim's auto-intent to become confused.  Here is a
> quick example of what I'm talking about.
>
> This is what I want vim to do with it's indenting for these comment
> blocks:
>
> class Test
> {
>    public:
>        /
> ****************************************************************//**
>         * @brief
>         *      This is the class constructor
>
> ********************************************************************/
>        Test() { }
>
>        /
> ****************************************************************//**
>         * @brief
>         *      This is the class destructor
>
> ********************************************************************/
>        ~Test() { }
> };
>
> And this is what I'm actually getting:
>
> class Test
> {
>    public:
>        /
> ****************************************************************//**
>        * @brief
>            *      This is the class constructor
>
> ********************************************************************/
>            Test() { }
>
>        /
> ****************************************************************//**
>        * @brief
>            *      This is the class destructor
>
> ********************************************************************/
>            ~Test() { }
> };
>
> I think that vim's indenting is not working properly because it sees
> multiple comment delimiters within a single line. I'm at a loss as to
> how to fix this, but maybe there is a way to override or modify the
> indent behavior in this particular case?  Any help from the vim user
> community would be much appreciated!
>
> I have both autoindent and smartindent enabled in my .vimrc, but the
> behavior of vim is the same in this case regardless of what indenting
> options I set.
>
> Thanks for your time in this matter!


Sorry the text got garbled in the original example. Let me try again.
This is what I want:

class Test
{
public:
/************************************************//**
* @brief
* This is the class constructor
****************************************************/
Test() { }

/************************************************//**
* @brief
* This is the class destructor
****************************************************/
~Test() { }
};

And this is what I get:

class Test
{
public:
/************************************************//**
* @brief
* This is the class constructor
****************************************************/
Test() { }

/************************************************//**
* @brief
* This is the class destructor
****************************************************/
~Test() { }
};

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