如何自动对齐以下代码? [英] How to auto align following code?

查看:117
本文介绍了如何自动对齐以下代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  get_base_exp(PlayerLv) - > 
case Player $ $
1-> 30;
2-> 30;
3-> 60;
4-> 100;
5-> 160;
6-> 240;
7-> 330;
8-> 440;
9-> 570;
10-> 710;
11-> 880;
12-> 1060
结束。

如下:

  get_base_exp(PlayerLv) - > 
case Player $ $
1 - > 30;
2 - > 30;
3 - > 60;
4 - > 100;
5 - > 160;
6 - > 240;
7 - > 330;
8 - > 440;
9 - > 570;
10 - > 710;
11 - > 880;
12 - > 1060
结束。


解决方案


  1. 选择你的行想要对齐

  2. Mx align-regexp RET - RET

  3. Mx align-regexp [0-9] +; - RET

作为一个完美缩进和对齐代码的粉丝,我有一个键盘对齐正则表达式,另一个用于对齐。 / p>

get_base_exp(PlayerLv)->
    case PlayerLv of
        1->30;
        2->30;
        3->60;
        4->100;
        5->160;
        6->240;
        7->330;
        8->440;
        9->570;
        10->710;
        11->880;
        12->1060
    end.

To the following:

get_base_exp(PlayerLv)->
    case PlayerLv of
        1  -> 30;
        2  -> 30;
        3  -> 60;
        4  -> 100;
        5  -> 160;
        6  -> 240;
        7  -> 330;
        8  -> 440;
        9  -> 570;
        10 -> 710;
        11 -> 880;
        12 -> 1060
    end.

解决方案

  1. Select the lines you want aligned
  2. M-x align-regexp RET - RET
  3. M-x align-regexp [0-9]+; - RET

Being a little fan of perfectly indented and aligned code, I have a keybinging for align-regexp and another for align.

这篇关于如何自动对齐以下代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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