benma / visual-regexp.el

A regexp/replace command for Emacs with interactive visual feedback
396 stars 28 forks source link

Selecting the match contents #8

Closed failable closed 10 years ago

failable commented 10 years ago

Hi,

I'm wondering if visual-regexp supports selecting all the match contents will be greater lib ? Or it has already supported ? I'm used to use Sublime Text 2's regular expression to extract some contents such as opening a html file, use regular expression to find all the media download links(like "http://abc.com/01.mp4"), then select, copy or cut them for other usages.

Visual-regexp is an awesome library. I think it's more than a find and replace tool. Please tell me if you have any information about this. Thanks ! :)

benma commented 10 years ago

Hi

Thank you! At the moment, only search/replace is supported, but adding more features like the one you mentioned is doable. What exactly is the result of copying the selected elements, i.e., what exactly will be pasted when you yank it?

We could think about integration with multple-cursors: make sections with visual-regexp and convert them to multiple cursors. Then you could apply almost all Emacs commands to each selection. What do you think?

failable commented 10 years ago

What I meant is just like applying multiple cursors to all selections. To integrate with multiple-cursors will really be a great idea. :)

benma commented 10 years ago

However, can multiple cursors be used to copy the selections like you want to?

failable commented 10 years ago

I'm emacs newbie, but I think as long as we can select all the contents we are looking for, any other thing should be OK. @magnars

magnars commented 10 years ago

Yes, multiple-cursors can copy all regions. It integrates with Emacs' rectangle package, so you paste them back out again with yank-rectangle (normally on C-x r y).

failable commented 10 years ago

Excellent.

benma commented 10 years ago

Great. Thanks isolet, this is a neat idea, I am looking forward to using this functionality myself. I do not have a lot of time right now, I will start working on it in as soon as I can though (should be at the start of December).

benma commented 10 years ago

Please check out the mc branch. There is a new function called vr/mc-mark which hopefully does what you expect. If it works well for you, I will merge it.

failable commented 10 years ago

Thanks for your great work. I've tried this simply since I'm not having much time right now. It' really awesome. I have one more question:

Will having a key binding in vr--query-replace-map for switching between vc/mark, vc/query-replace and vc/replace be a better user experience?

benma commented 10 years ago

I am not sure yet how to handle switching between the commands, or whether it is a neccessary feature at all. Please open a new issue for this.