Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Find and replace only in open tabs #241

Open
ghost opened this issue Jun 21, 2014 · 97 comments
Open

Find and replace only in open tabs #241

ghost opened this issue Jun 21, 2014 · 97 comments

Comments

@ghost
Copy link

ghost commented Jun 21, 2014

How to Find and replace only in open tabs?

@izuzak
Copy link
Contributor

izuzak commented Jun 23, 2014

Not possible at the moment, I believe, but sounds like a neat idea for an enhancement.

@ghost
Copy link
Author

ghost commented Jun 23, 2014

@izuzak
thanks.

@brentonstrine
Copy link

This would be really helpful, and is a make-or-break feature for a serious code editor.

Sometimes you want to do a search/replace on a set of files that can't be identified only by directory or file extension. Right now my workaround is to move all the files I want to modify into a directory, then do the search/replace in that directory, then move them back to their original locations. Obviously this is not a good solution!

@slowpoison
Copy link

@izuzak any update on this? Does the API not allow this?

@vitorhsb
Copy link

This would be a great enhancement.
Sublime Text has built-in Open files search via '' and/or '' file/directory pattern.

@ercmcd
Copy link

ercmcd commented Dec 28, 2015

Any information on what it would take to start working on this as an enhancement to the existing find feature?

@tati
Copy link

tati commented Dec 30, 2015

👍 this would be super helpful

@jamesalley
Copy link

Yes please. I'm missing this feature.

@skoshy
Copy link

skoshy commented Jan 12, 2016

Looks like this package for Atom incorporates Finding in Open Files, but it's tailored for TODO items. Maybe the code might be useful? https://github.com/mrodalgaard/atom-todo-show

@ocssor
Copy link

ocssor commented Feb 4, 2016

Any update on this? Would be extremely useful.

@hjess
Copy link

hjess commented Feb 17, 2016

+1 (+1 +1 +1 ) This is one of my most-used features on Sublime, and most-missed in my switchover to Atom.

@brentonstrine
Copy link

@hjess this single feature (find&replace across multiple files--be it open tabs or whatnot) has been responsible for me switching from Atom to Sublime. I've been waiting since 2014 and haven't seen any action to prioritize this or even respond to comments asking for updates. Seems indicative of a larger problem with the software development if a hugely important feature that's regularly commented on gets completely ignored for years.

@winstliu
Copy link
Contributor

@brentonstrine There have been no updates on this, so we haven't provided any.

In addition, "hugely important" is very subjective here - you may use it often, but I haven't ever had the need for this feature yet.

As always though, PRs are always welcome. Sorry I can't comment more on what's needed to implement this, but I don't have much experience with the find-and-replace code (@benogle might know more).

@brentonstrine
Copy link

It would be interesting to do a poll of current users asking what missing features they think are most important. I'd bet find/replace across multiple files would be near the top. Maybe I'm wrong.

@nskaggs
Copy link

nskaggs commented Feb 17, 2016

I hate to chime in and provide anecdotals, but Find/Replace is a bit lacking overall in atom. I expected to be able to find/replace in my current file, and all open tabs. Find/replace across project is cool and interesting too, but not something I expected to be provided.

The other oddity was the lack of a Find All; that is to say a buffer containing inline previews of every match. I see there's already #568 and #569 for that, so it's noted as well.

@lee-dohm
Copy link
Contributor

@brentonstrine The most common feedback we get from people is that Atom's performance is what they would like to see fixed the most. Because of this feedback performance has been a huge priority for the team.

@echantigny
Copy link

I'm adding my voice to ask for this feature. I'm in need of it right now and is really missing. I need to update a term in a certain batch of files, but not all of them. Being able to do it in all opened files would be greatly appreciated since it is a feature in most, if not all, other code software I've used.

I think it's the only one missing. Search in Project and Directory/Folder are already present.

@almadsen
Copy link

Not just to keep the "thread" alive, I'm also one for have been using this before the switch from sublime and it's sourly missed.

And guess I don't have to explain why, just agree with above writers.

@jijojv
Copy link

jijojv commented May 15, 2016

bummer this is such a critical feature that i need to switch from sublime.

@jefferyyuan
Copy link

Please implement this - it's a simple task that can benefit a lot of people.
So why not just implement it?

@winstliu
Copy link
Contributor

Please implement this - it's a simple task that can benefit a lot of people.
So why not just implement it?

No one from the Atom team has had time to yet. But that's where the community comes in! If this is indeed a "simple task" to implement, please feel free to do so and send a PR! I'll be labeling this issue as help-wanted.

@menocomp
Copy link

that would be really nice if this option is added.

@ghost
Copy link

ghost commented May 28, 2016

Should we do this like ST3 where the filter is in with the file pattern? e.g. *.js, <open files>

Or does anyone have a better suggestion? If the above is acceptable, does anyone have an icon suggestion? :)

@ghost
Copy link

ghost commented May 29, 2016

Mock, thoughts? I'll take this if we can agree on a direction :)

image

@echantigny
Copy link

So, if I understand this correctly, pushing the "Open files" button would activate the search through all open files. Is it a "toggle" button?

If it is, that sounds great to me!

@MgtMadness25
Copy link

Reeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

@jbverma
Copy link

jbverma commented Jun 13, 2020

This is really a nice feature I would like to have in Atom

@rubo77
Copy link

rubo77 commented Jun 13, 2020

@trevdor what about your branch at #967
? Is it already usable?

Hey @mjohnson159, as far as my attempt at this feature, I've made no progress since posting the PR.
I'd still like to take it to completion if I can find time, just don't know when that will be. I definitely don't mind if someone else wants to take a crack at it, starting from my branch or not. I'm happy to collaborate with anyone making an effort.

@trevdor
Copy link

trevdor commented Jun 13, 2020

@rubo77 It's been a while, but yeah, it was working as I'd expect this feature to work.
The notes in the PR have a few more details: #967
Branch https://github.com/trevdor/find-and-replace/tree/openFilesFindPane

@rubo77
Copy link

rubo77 commented Jun 14, 2020

So ist just can't be merged, since you can't program the right tests?

@trevdor
Copy link

trevdor commented Jun 14, 2020

That's right, @rubo77 -- Since the feature works in practice, I suspect most of the tests would pass if I could set them up correctly.

I suspect it has something to do with needing to open multiple tabs in the test setup, but I didn't get that figured out and I had trouble finding any examples of such tests around the Atom ecosystem.

@denis-kosovich
Copy link

It would be really great to see this feature 🙏 🙏 🙏

@Sharpshooter-Dublin
Copy link

Six years later: any word on this feature being added?

@easterncoder
Copy link

I just found myself needing to do this today. I do hope it gets added. One of the things I miss from using the "other" editor.

@cseraphine
Copy link

cseraphine commented Apr 19, 2021

Year 7 and going strong...... I'd really like to migrate away from JEdit to Atom since the former is almost dead, but I far too often find myself doing things like renaming a variable that absolutely demand this functionality.

@MykhailoMe
Copy link

For example if you have couple of newly created tabs (Cmd+N), not saved yet, it is not possible to search within them at all. Only by clicking tab by tab... Thank you for Atom!

@benvalkin
Copy link

Plz add, it's 2022 now (nearly 8 years since the issue was created)

@TheBrokenEngineer
Copy link

This would be so bloody useful, cannot believe it has not been added.

Does anyone mind if I have a go at adding this in?

@trevdor
Copy link

trevdor commented Feb 3, 2022

@TheBrokenEngineer That would be fantastic, imo.
Feel free to use any of my work over at #967, if you think it useful.

@TheBrokenEngineer
Copy link

@trevdor That was going to be my starting point. I noticed that there were a couple of tests that were breaking so I'll have a look why first.

My plan was to do a little refactoring first so we didn't wind up with duplicate code which is an absolute mess in terms of maintenance which is why I was asking if anyone had a problem with my doing the change.

@max1mvs
Copy link

max1mvs commented Feb 4, 2022

Uhhh, this would be nice—+1 from me. I often find myself loading up many files scattered around and making changes there.

@TheBrokenEngineer
Copy link

@max1mvs Seems to be a lot of interest for this feature.

What I am thinking is taking the good work that @trevdor has done and using that as the starting point.

As far as the UI is concerned I am thinking of adding a check box to the find/replace section of the screen on the bottom of the editor. Check it and the replace is done across all tabs. If you click the individual find/replace and the criteria for the replacement is not on the current tab but a different tab then that tab is shown. If however you click replace all then the tabs/text position does not change.

Note, that this only does the replacement on open tabs and does NOT save the tab buffers.

Your thoughts? Does this sound like the optimal solution?

@max1mvs
Copy link

max1mvs commented Feb 6, 2022

I'm afraid I cannot check what @trevdor did, but your efforts will be truly appreciated by all, no matter what!

I think your suggestion sounds good. If we should be very strict concerning the UI already established in Atom, this should either be something being typed in the File/Directory pattern or a separate Search/replace function, but I guess this will require quite some work. So a checkbox will be pretty good IMO.

And as long as the functionality of searching/replacing mimics what is already present in terms of projects, all should be perfect.

Regarding saving the tab buffers, I would also think this would be the best approach. So all in all thumbs up from me! 😄⭐️

I think in Sublime Text, you select something like "Where: " Then a dropdown with different selections, amongst them to choose project filters, open folders, etc. Could be something to consider in the future for Atom.

Thinking of it: Perhaps placing the checkbox to the right of the File/Directory pattern input? Below the buttons?

@rubo77
Copy link

rubo77 commented Feb 6, 2022

Another possible solution could be to add the checkbox to the the find and replace in the whole project search.

  • "Only search/replace in open tabs"

@cseraphine
Copy link

Nearly every editor other than this one has some functionality like that, and it typically takes the form of an option in the the interface you get when you hit control/command-F. I personally wouldn't conflate it with the project search, since that already seems like a solved problem.

@TheBrokenEngineer
Copy link

TheBrokenEngineer commented Feb 6, 2022

@rubo77 The whole project search/replace is just that for the whole project. The find and replace are only for the buffers so I think leaving the option there is better??

@max1mvs I really would like to keep the change localized to the buffers/tabs at this stage. The menus themselves seem a little weird to me, the find option and the replace option for tabs brings up the same window at the bottom and the project find has no replace but brings up a find replace window. Very confusing and probably needs sorting out but I think that is probably above my pay grade as they say.

There is another way we could do this, we could add an additional button to the top right option buttons that are there now. If selected then we could change the tip text in the edit boxes from "Find in current buffer" to "Find in all buffers" and similarly we change the replace box from "Replace in current buffer" to "Replace in all buffers".

This would fit into the current layout nicely, the down side is that you need to know it is there as it is not that obvious. A good icon however would go some way to addressing this issue however.

@max1mvs
Copy link

max1mvs commented Feb 7, 2022

There is another way we could do this, we could add an additional button to the top right option buttons that are there now. If selected then we could change the tip text in the edit boxes from "Find in current buffer" to "Find in all buffers" and similarly we change the replace box from "Replace in current buffer" to "Replace in all buffers".

@TheBrokenEngineer Something like this (Photoshop)?

tabs_icon

This is btw. how Sublime Text does it:

Screenshot 2022-02-07 at 08 00 21

@TheBrokenEngineer
Copy link

TheBrokenEngineer commented Feb 7, 2022

@max1mvs This is similar to "Find/Find in project" where we want to only find/replace in the open tabs. Agreed we could do this for both the find in project and the find in open buffers however this is more a UI redesign that is probably not something that would make the Atom maintainers that happy.

Limiting the change to just what we need is probably a better way to go at this stage. If we want to do something a little more extensive then we could do it in a different change. I was thinking something more like just another button on the existing UI that could be toggled on.

replaceButtonExample

Note on the above image, the arrow is not pointing to the new button, it is indicating where the new button should go. As for what the icon should look like, that is something I am could do with some help on, I am not good at iconography, I prefer to stick with code.

It does mean that the scope of the change is small (in so far as impact to the existing UI/usability) and solves the problem we are having.

Does this make more sense?

@max1mvs
Copy link

max1mvs commented Feb 7, 2022

@TheBrokenEngineer Sure, sure. I agree. If you look at my photoshopped image, I suggested an icon there. It's from the Streamline collection:

tabs_icon

Another one, perhaps more 'tab'-like, is from the "The Icon Of"-collection. Here they both are:

tabs

add-tab

I can create it in any format you like.

@rubo77
Copy link

rubo77 commented Feb 9, 2022

Maybe this?

Screenshot_20220209-155425_Firefox Nightly

@max1mvs
Copy link

max1mvs commented Feb 9, 2022

That could go for "Documents". I prefer a more "elegant" design for the icon, though. So if we are saying "Open files" rather than "All open tabs", this direction would work. If we go down that path, I can find a suitable icon.

@TheBrokenEngineer
Copy link

Seems like the icon choice is well under consideration. Of the 3 suggested so far my choice would be the first one with perhaps an extra tab bit at the top so it looks less like a folder icon one would see in windows explorer or finder.

I will be taking a branch over the weekend and starting in on the changes. I hope to have something is a working state in a week or so after that at which time I will need an icon of some type.

@max1mvs
Copy link

max1mvs commented Feb 10, 2022

I can surely give the first icon a shot. I want to make sure we are aligned in the "Tabs"-direction, i.e. not the "Documents"-approach. So the wording could go something like:

Finding with options: [Option A], [Option B], All open tabs

Or even:

Finding with options: [Option A], [Option B], All tabs

As opposed to:

Finding with options: [Option A], [Option B], All open documents

Correct? Because then I will give the tabs icon an adjustment and bring it here.

@ghost
Copy link

ghost commented Mar 26, 2022

Any news on progress?

When doing a Find & Replace would it be possible to stop Atom from automatically saving changed open files/tabs? I think it is useful to be able to see which files have been changed

@kumar007git
Copy link

kumar007git commented May 13, 2022

I requested this feature to search open tabs/files long time back but it has not been implemented even after this many years. To me it appears to be straightforward especially since find and replace functionality exists to find in project so, why not use that same functionality to search and replace open files. Search and replace in open tabs/files I think is super critical and fundamental. Hopefully, someone can implement it in next version.
Thanks for all the great work and a great editor.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.