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

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

问题描述

我在某处看到这个,但现在找不到。
Emacs中有内置函数,还是有人使用elisp来排列cc-mode中一系列初始化语句中的所有等号?



之前:

  int t = 9; 
图形g = new Graphics();
列表< String> list = new List< String>();

之后:

 code> int t = 9; 
图形g = new Graphics();
列表< String> list = new List< String>();


解决方案

使用 Mx align-regexp (这里, Mx align-regexp RET = RET )。您还可以向变量 align-rules-list 添加对齐规则,以便将来 Mx align 会做的。有关详细信息,请参阅文档( C-h f align )。


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

解决方案

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天全站免登陆