在Emacs中,如何在一系列初始化语句中排列等号? [英] In Emacs, how to line up equals signs in a series of initialization statements?

查看:19
本文介绍了在Emacs中,如何在一系列初始化语句中排列等号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在某处看到过,但现在找不到了.emacs 中是否有内置函数,或者有人有 elisp,可以在 cc 模式下排列一系列初始化语句中的所有等号?

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?

之前:

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>();

推荐答案

使用 M-x align-regexp(这里是 M-x align-regexp RET = RET).您还可以在变量 align-rules-list 中添加对齐规则",以便将来 M-x align 会这样做.有关详细信息,请参阅文档 (C-h f align).

Use M-x align-regexp (here, M-x align-regexp RET = RET). You can also add an "alignment rule" to the variable align-rules-list, so that in future M-x align will do it. See the documentation (C-h f align) for details.

这篇关于在Emacs中,如何在一系列初始化语句中排列等号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆