在Emacs中,我如何同时编辑多个点?

7

有两种方法。我认为你可以选择矩形并在所有行的开头和结尾添加内容。

我还想知道是否可以选择多个点,这些点相对于您编辑的位置具有不同的偏移量,并同时编辑所有点。我认为Yasnippet提供了类似的功能,但仅当您使用预定义的模板时才能使用。类似于这样。

<div class="">
<a class="">

我能帮助你翻译这段内容。这段话询问是否可以在两个类上标记一个点,使得编辑时能够同时更改这两个类的属性。请问这个做法可行吗?
2个回答

11

请注意,此内容已被 multiple-cursors 取代(看起来它仍在开发中)。 - Liffon

3
除了Juancho的回答,我还使用了Steve Yegge的multi-select来满足你的需求。以下是示例用法(第一个示例将提供我认为你想要的内容):
 C-u C-M-m w foo <RET> <RET>
  - inserts/prepends "foo" to every multi-selection (you can also append or replace text)

 C-u -1 C-M-m r <pre>\(\w+\).+\s-+\(.+\)</pre>
  - selects first and last word of the contents every <pre> tag
    (provided the contents don't span multiple lines)

 C-M-m x M-x upcase-region
  - converts all multi-selections in buffer to uppercase

 C-u M-w C-q C-j --- C-q C-j <RET>
  - saves all multi-selections to kill-ring as a single item,
    with selections separated by "---" on a line by itself

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接