+295
Lokið

Search & replace across projects/directories

Jordi Boggiano 14 ár síðan updated by Jon Skinner 12 ár síðan 32
It should be possible to perform search & replace operations across all files (just like the search in files dialog works) - if possible with a preview mode, but it's not mandatory.. That's why we have version control after all :)

Answer

Answer
Lokið
This was added in 2139
+11
Big fan of this suggestion. The lack of this functionality is one of only two reasons I still switch to another editor anymore (the other being a print option). Of course, not having my currently open files or project present in the other editor complicates the matter.
-42

There are plenty of tools to do this. Regexxer (http://regexxer.sourceforge.net/) is an excelent one. Plus, this is not something you do often. And when you do it, you usually take some time to do it, to avoid messing up your entire project.

So really, is it than a problem to open a third party app once in a while for a 5 minute job ? I don't think so. This feature is hard to implement and can wait.

+8
Well, one common use case that is helped by having an integrated solution is to do replaces across all currently open files, or all files in an open Sublime project, or some subset thereof. With an integrated multi-file S&R solution, this is easy to perform. With a third party tool, I have to re-select all the specific folders/files I want to run on, which can be tedious and sometimes error-prone.


As for this being "not something you do often", this is a function I need on a daily basis. Simple stuff like renaming a class or function in all of a project's files is a frequent task for me. With regard to the possibility of hosing your project with a bad multi S&R, I think just a "Preview" toggle would solve this nicely; just print a list of the replacements that would be performed in a new buffer.


Lastly, I disagree that this feature is particularly hard to implement. Sublime already has full S&R+regex functionality in place, so it is probably not a huge chunk of work to have this apply across multiple files.  In fact, your assertion that this is hard to implement made me realize that this could probably be done by just writing a Sublime package (though the UI would probably have to be kinda gimped). So, I'm going to take a crack at writing just such a package.


Thanks for the link to Regexxer. There are certainly some benefits to the dedicated third-party tool approach, such as using a GUI that is crafted around a singular core goal ("do one thing, do it well"). Sublime will never (and shouldn't) have such a detailed GUI for multi S&R; we just need the basic functionality.

+13
Would love to be able to do this. Seems like basic functionality.

Thanks for a great software.
+2
I maintain a number of legacy static html sites, and have to find/replace across a few hundred html files more often than I would like to. It would be nice to be able to do this from within Sublime just like I used to be able to from BBedit or Textmate.
+7
Definitely this needs to be a required feature.  Every decent text editor has this functionality as standard, and frankly it seems like a glaring omission from what is a very excellent and full featured editor.
+4

 Agreed rhuk. This needs to be implemented ASAP.

+4

I've been trying text editors for so long and finally found Sublime Text thanks to top ruby developer Luis Lavena suggestion. 

You guys have done such a great job and the editor worth paying for.

So far the only one missing functionality as for me is this one!(replace in files)

please please put it on your TODO list!! thanks.

+2
I concur with Joel, this would be a great feature which i am also desperately missing right now. I may not need it on a daily basis, but at least weekly. A preview function would be awesome, but i'd assume that would be far much more effort than without.
+2
+1 from my side. i use global find/replace all the time in textmate, and was rather surprised to find it is not supported in sublime. i think it is an essential feature.
+3
+1 - really one of the few things that are missing.
+2
+1 - This editor is amazing, but I was surprised that after my "Find in Files" result set came back that I couldn't do anything with it!
+4
I'm still awaiting this feature before I make the switch. Not having this is likely preventing a lot of users from making the switch.
+3
+1 surprised at the lack of this. Showstopper for me in an otherwise great editor. 
+4
+1. Please, please, add this feature, it's really critical, I just can't work on my projects without this, so I had to switch back to another editor.
+2
+1! +1!
It's really significant feature.
Very cool suggestion like notepad++ have
This is the only thing keeping me with textmate at this point.  Hope you can get this in...
The suggestion that using a 3rd party application is reasonable is simply in itself NOT reasonable.  This bit of functionality and those like it should be given more developmental focus in order to quickly improve this product's maturity level.
+2
This feature is now in there in the dev build! YaY!
+2
This would be a great feature! I use this in RubyMine for Rails projects, but when I have to work on legacy apps, I really miss this feature.

**update**
I just discovered that it is possible to search across directories using CTRL+Shift+F. will 
This feature is built in in the last bits,
+1
Is this the CTRL+Shift+F command, or is there something I am missing?
+1
Yes, have a look to this screenshot: http://screencast.com/t/zqDhXYvZU ... is in the build 2139 
Well singleline sucks!
The functionality of dreamviwer is very wellcome! Find&Replace from Dream and find/replace in opened. The main improvement of F&R is to make MULTILINE dialogs!
-1
Already there: resize the panel, use ctrl+enter for newline
+1
Do some research before getting upset Luke! Drag&drop f&r bar up - you will see multi-line. Press ctrl+enter for new line. At least that is how it is working for windows.
+9
I love how the search result is displayed when I do a cmd-shift-F
What I´d like to do now, is to edit the text directly from the preview.
Just like The Global Replace plugin for vim. 

Answer
Lokið
This was added in 2139
+3
Agreed Martin.  BBEdit has implemented that feature wonderfully (really, its the best multi-file search tool I've seen), with editing of the results, the ability to remove files from search results, regular expressions, search by file type, and more.  I am so close to moving full time to ST2 but this feature seems to keep me going back to BBEdit.  Or does anyone have a suggestion for a standalone tool that does this?
+4
I would love to edit the find results in place, but failing that at least give me an option to open all files so that I can do a find and replace across all open files afterwards.

+1

The search functionality really needs to improve before I make the move to Sublime. It's great in every other way but this is a deal breaker.


I've been using the Sidebar Enhancement plugin, but it's really a downer having to use the mouse every time I wanna search through files in a folder. This functionality should be native to the software and easily accessible through keyboard shortcuts like everything else.