emacs中的矩形函数 [英] Rectangle functions in emacs
问题描述
我在几个地方读过矩形在emacs中的功能非常有用。我已经读了一些关于他们,我不太明白为什么。我的意思是,当你想杀死一个段落,你标记第一行/列,然后是最后一个,这实际上是一个矩形,对吗?但是你仍然可以使用正常的kill ...
I've read in several places that the rectangle functions in emacs are very useful. I've read a bit about them, and I can't quite figure why. I mean, when you want to kill a paragraph, you mark the first row/column and then the last one, and that's actually a rectangle, right? But you can still use the normal kill...
那么你可以用什么样的转换?
So what kind of transformations would you do with them?
推荐答案
如果您在具有 Mx delete-rectangle
或的文本文件列中的数据,矩形
可以删除单列数据。类似地, Mx yank-rectangle
将粘贴在文本列中。
If you have data in columns in a text file with M-x delete-rectangle
or M-x kill-rectangle
you can delete a single column of data. Similarly, M-x yank-rectangle
will paste in a column of text.
例如,请输入以下文本:
For example, take the following text:
1. alligator alphorn
2. baboon bugle
3. crocodile cornet
4. dog didgeridoo
5. elephant euphonium
6. fish flugelhorn
7. gopher guitar
从鳄鱼吉他中选择吉他。选择的开始和结束标记出矩形的两个相对的角。输入 M-x杀死矩形
,你马上有:
Select from the a of alligator to the g of guitar. The beginning and end of the selection mark out two opposite corners of the rectangle. Enter M-x kill-rectangle
and you immediately have:
1. alphorn
2. bugle
3. cornet
4. didgeridoo
5. euphonium
6. flugelhorn
7. guitar
下一步将标记放在顶行末尾,如果需要,添加几个空格,然后输入 Mx yank - rectangle
和ta-da!您已重新排序列:
Next put the mark at the end of the top line, add a few spaces if required and enter M-x yank-rectangle
and ta-da! You have re-ordered the columns:
1. alphorn alligator
2. bugle baboon
3. cornet crocodile
4. didgeridoo dog
5. euphonium elephant
6. flugelhorn fish
7. guitar gopher
这篇关于emacs中的矩形函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!