Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim indentation in C++ constructor initialization list

Tags:

c++

vim

#include<iostream>
using namespace std;
class Example
{
    public:
        Example(int a,int b,int c):m_a(a),m_b(b),m_c(c)
    {  // Wrong indentation here due to the colon in above line, { should be under E
        printf("\nThe 3 argument constructor invoked\n");
    } // Wrong indentation again
    private:
        int m_a;
        int m_b;
        int m_c;
};

Hi all,

I have a little problem in gvim's indentation in the constructor initialization list in C++. I am using cindent in the .gvimrc and i am unable to solve this problem even after changing my .gvimrc a number of times.

Can some benevolent soul give me some method to set this up. I have tried changing cinoptions as well as cinwords but nothing really helped.

I have highlighted the indentation problem in the code snippet provided above.

Thanks for your patience

Regards lali

like image 696
ghayalcoder Avatar asked Feb 18 '10 12:02

ghayalcoder


1 Answers

:set cino=i0
like image 133
Corwin Avatar answered Sep 30 '22 20:09

Corwin