In Emacs, how do I change multiple points at once?

There are two options. I think you can select a rectangle and add material to the beginning and end of all lines.

I would also like to know if it is possible to select several points located at different offsets, where you edit all the points at once. I think Yasnippet provides something similar, but only when using a predefined template. Something like that.

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

where I can mark a point in both classes, and text input will change both attributes of the class. Is it possible?

+7
source share
2 answers

Emacs Rocks! provides a mark-multiple that does what you want.

+10
source

In addition to Juancho's answer, I used Steve Yegge multi-select for your purpose. Usage example (the first example will provide what I think you want):

  Cu CMm w foo <RET> <RET> - inserts/prepends "foo" to every multi-selection (you can also append or replace text) Cu -1 CMm r <pre>\(\w+\).+\s-+\(.+\)</pre> - selects first and last word of the contents every <pre> tag (provided the contents don't span multiple lines) CMm x Mx upcase-region - converts all multi-selections in buffer to uppercase Cu Mw Cq Cj --- Cq Cj <RET> - saves all multi-selections to kill-ring as a single item, with selections separated by "---" on a line by itself 
+3
source

All Articles