zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
50.53k stars 3.13k forks source link

Allow creating multiple cursor based on search in selection #19651

Open timokoesters opened 1 month ago

timokoesters commented 1 month ago

Check for existing issues

Describe the feature

Helix allow selecting text and pressing "s" to create a multicursor at each instance of a search term: https://docs.helix-editor.com/keymap.html#selection-manipulation. This is pretty useful to do changes in some portion of the file. Limiting it to a selection avoids unintended side effects. For example this can be used to replace " with '.

If applicable, add mockups / screenshots to help present your vision of the feature

No response

andrewbanchich commented 3 weeks ago

I wonder if this and #19934 could be generalized to a limit_to_selection setting.

JosephTLyons commented 3 weeks ago

Hey @timokoesters, there is a way to get this to work in Zed currently. You can use the buffer search, highlight the text, engage the Toggle Search Selection, then, while the cursor is in the search field, use option-enter to drop the cursors on matches within the selection. Is this sufficient, or should is there something we should improve on to make the workflow a bit better?

https://github.com/user-attachments/assets/5bb3a978-0ddd-4cda-b564-0f8eb3be9638

andrewbanchich commented 3 weeks ago

@JosephTLyons i think that's a question for @timokoesters - my issue is #19934