[英]What elisp or macro magic can make this text transformation?
I have a set of SQL statements formatted like so: 我有一组格式如下的SQL语句:
INSERT INTO reports.workload (workload_id,event_time,event_type_id,agent_id) VALUES
(-42000,'2010-02-23 07:30:38.941436',1,NULL);
Right now, the VALUES tuple is aligned at the start with the column name tuple. 现在,VALUES元组在开头与列名元组对齐。 However, what I want is to have the tuple's elements aligned as well, like so:
但是,我想要的是将元组的元素对齐,如下所示:
INSERT INTO reports.workload (workload_id,event_time, event_type_id,agent_id) VALUES
(-42000, '2010-02-23 07:30:38.941436',1 ,NULL);
My elisp-fu and regexp-fu are moderate, but not sufficient to this task. 我的elisp-fu和regexp-fu是温和的,但不足以完成这项任务。 How can I do this?
我怎样才能做到这一点?
Select the region you'd like to align, and type Cu Cx \\ (that is a shortcut for align-regexp
). 选择您要对齐的区域,然后键入Cu Cx \\ (这是
align-regexp
的快捷方式)。 Choose \\(,\\)
as regex pattern and repeat it throughout line. 选择
\\(,\\)
作为正则表达式模式并在整行中重复。
For more on text align, see chapter AlignCommands in EmacsWiki. 有关文本对齐的更多信息,请参阅EmacsWiki中的AlignCommands一章。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.