如何对齐 C++ emacs 中的一列中的类成员名称?
我想将所有 C++ 类成员名称(不要与成员类型混淆)对齐在一列中。
让我们看一下入口处的示例:
class Foo
{
public:
void method1( );
int method2( );
const Bar * method3( ) const;
protected:
float m_member;
};
这就是我们希望在结尾处看到的内容:
class Foo
{
public:
void method1( );
int method2( );
const Bar * method3( ) const;
protected:
float m_member;
};
因此,最长的成员类型声明定义了类成员名称将与其对齐的列。 我怎样才能在 emacs 中执行这样的转换?
I would like to align all C++ class member names ( do not confuse with member types ) in one column.
Lets look at the example of what we have at entrance:
class Foo
{
public:
void method1( );
int method2( );
const Bar * method3( ) const;
protected:
float m_member;
};
and this is what we would like to have at the end:
class Foo
{
public:
void method1( );
int method2( );
const Bar * method3( ) const;
protected:
float m_member;
};
So the longest member type declaration defines the column to which class member names will be aligned.
How can i perform such transformation in emacs ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
选择包含方法声明的区域
输入字符串
[^ ]+\((\|;\)
并按 EnterEdited 添加
;
在匹配中,它也对齐成员变量。Select the region with the method declarations
Enter the string
[^ ]+\((\|;\)
and press EnterEdited to add the
;
in the matching, which aligns the member variable as well.