在 Emacs 中,如何在一系列初始化语句中排列等号?
我在某处看到过这个,但现在找不到了。 emacs 中是否有内置函数,或者有人有 elisp,可以在 cc 模式下将一系列初始化语句中的所有等号排列起来?
之前:
int t=9;
Graphics g = new Graphics();
List<String> list = new List<String>();
之后:
int t = 9;
Graphics g = new Graphics();
List<String> list = new List<String>();
I saw this somewhere, but cannot find it now.
Is there a built-in function in emacs, or does someone have elisp, to line up all the equals signs in a series of inititialization statments in cc-mode?
Before:
int t=9;
Graphics g = new Graphics();
List<String> list = new List<String>();
After:
int t = 9;
Graphics g = new Graphics();
List<String> list = new List<String>();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用
Mxalign-regexp
(此处为Mxalign-regexp RET = RET
)。 您还可以向变量align-rules-list
添加“对齐规则”,以便将来Mxalign
执行此操作。 有关详细信息,请参阅文档 (Ch falign
)。Use
M-x align-regexp
(here,M-x align-regexp RET = RET
). You can also add an "alignment rule" to the variablealign-rules-list
, so that in futureM-x align
will do it. See the documentation (C-h f align
) for details.这是对 harpo 对 ShreevatsaR 答案的评论的回应:
以下是我为解决该问题所做的操作:
This is in response to harpo's comment to ShreevatsaR's answer:
Here's what I did to resolve that issue:
Mx 对齐应该可以解决问题。
M-x align should do the trick.