Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global search and replace #4335

Open
CBenoit opened this issue Oct 17, 2022 Discussed in #3793 · 6 comments
Open

Global search and replace #4335

CBenoit opened this issue Oct 17, 2022 Discussed in #3793 · 6 comments
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements E-hard Call for participation: Experience needed to fix: Hard / a lot

Comments

@CBenoit
Copy link
Member

CBenoit commented Oct 17, 2022

Add some form of support for global search-and-replace.

Discussed in #3793

Originally posted by nour-dev September 11, 2022
hey, the question is the title.
I know how to make per file search and replace. what I want to do is to search + replace in the entire workspace files (or sub of them by ext or some sort of regex).
for example when I want to search 'test' I do:

  • click space+/.
  • the search picker show list of files contain the regex.

then when I want to replace it I need to go to each file and replace manually.
so there is not way to replace them all with one or more commands.

is there any hack to do this ? or I need to use external shell tools like sed or sd ?

thanks.

@CBenoit CBenoit added C-enhancement Category: Improvements A-helix-term Area: Helix term improvements labels Oct 17, 2022
@kirawi kirawi added E-medium Call for participation: Experience needed to fix: Medium / intermediate E-good-first-issue Call for participation: Issues suitable for new contributors labels Oct 18, 2022
@Teiolass
Copy link

How should this behaviour interact with the undo? Add the change only to the alread open buffers?

I think this solution is quite dirty, but it is the best that comes to my mind. I think that letting this feature to be handled by external programs would be a better choice.

@helmesjo
Copy link

One approach I've seen before is a prompt where you'd say if to open all files when replacing (adding to undo buffer) or replace without opening (no undo). The prompt can be handled in many other ways of course, just that it's an explicit choice.
Personally I'd say this is an expected feature in any IDE, so I vote yay. (:

@QiBaobin
Copy link
Contributor

Open a buffer for the result, any changes on that buffer would effect related files? This can undo, something like https://github.com/mhayashi1120/Emacs-wgrep

@CBenoit
Copy link
Member Author

CBenoit commented Oct 24, 2022

#4381 sounds exactly like this 🙂

@wongjiahau
Copy link
Contributor

What we need is something like Vim’s cdo command, which allows user to apply Ex command to every entry in the quickfix list.

My suggestion, add a simple command call run-macro-on-last-picker.

@pascalkuthe pascalkuthe added E-hard Call for participation: Experience needed to fix: Hard / a lot and removed E-medium Call for participation: Experience needed to fix: Medium / intermediate E-good-first-issue Call for participation: Issues suitable for new contributors labels Mar 16, 2023
@pascalkuthe
Copy link
Member

The plan is very much something like #4381 that would leverage helixes existing multi-cursor support. That PR just needs a better PR and for that larger changes are likely needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements E-hard Call for participation: Experience needed to fix: Hard / a lot
Projects
None yet
Development

No branches or pull requests

7 participants