7

有两种变体。我认为您可以选择一个矩形并将内容添加到所有行的开头和结尾。

我还想知道是否可以选择位于不同偏移量上的多个点,以便一次编辑所有点。我认为 Yasnippet 提供了类似的功能,但仅限于使用预定义模板时。像这样的东西。

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

我可以在两个类的东西上标记一个点,键入将编辑两个类属性。是否可以?

4

2 回答 2

11

Emacs 摇滚!描述mark-multiple,它可以满足您的需求。(这是他们的视频介绍。)

编辑: @Lifton 指出它已被multiple-cursors取代。

于 2012-07-05T16:21:28.633 回答
3

除了 Juancho 的回答之外,我还multi-select为您的目的使用了 Steve Yegge 的回答。示例用法(第一个示例将提供我认为您想要的内容):

 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
于 2012-07-05T16:46:54.713 回答