2012-07-05 6 views
7

2つのバリエーションがあります。私はあなたが長方形を選択し、すべての行の始めと終わりに物を追加すると思う。Emacsでは複数のポイントを同時に編集するにはどうしたらいいですか?

また、すべてのポイントを一度に編集する場所に異なるオフセットにある複数のポイントを選択できるかどうかを知りたいと思います。私は、Yasnippetは、あらかじめ定義されたテンプレートを使用する場合に限り、同様のことを提供していると思います。このようなもの。

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

ここで私は両方のクラスのものにマークを付けることができ、入力は両方のクラス属性を編集します。出来ますか?

答えて

10

Emacs Rocks!あなたが望むことを実行するmark-multipleを提供します。

+0

これは、以来、[ 'マルチcursors']に取って代わられていることに注意してください(https://github.com/magnars/multiple-cursors .el)(まだ開発中のようです)。 – 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 
関連する問題