2012-07-05 41 views
7

有兩種變化。我想你可以選擇一個矩形,並添加所有行的開始和結束的東西。在Emacs中,我如何一次編輯多個點?

我還想知道是否可以選擇不同偏移量的多個點,以便一次編輯所有點。我認爲Yasnippet提供了類似的東西,但只有當您使用預定義的模板時。像這樣的東西。

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

我可以在這兩個類的事情上標記一個點,鍵入將編輯這兩個類的屬性。可能嗎?

回答

10

Emacs岩石!提供mark-multiple,它做你想做的。

+0

注意,這點已經得到['多cursors'(https://github.com/magnars/multiple-cursors取代.el)(看起來它仍在開發中)。 – Liffon 2014-09-28 20:31:39

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 
相關問題