There are a lot of times I’ve had multiple documents open and realized I needed to change the same thing in each of them. Sometimes it’s been a word or name I spelled incorrectly, while other times it’s something else, such as a link or email address. Regardless, while the default text editor in Ubuntu is gedit, it doesn’t have the ability to search and replace in multiple documents at once. Other text editors do, but not gedit.
So I was thrilled to see that there is a plugin available for gedit that adds this exact feature. I can now delete any other text editors I had installed solely for that reason, and start using gedit for all my text editing needs.
The Advanced Find/Replace plugin for gedit isn’t a part of the Ubuntu repositories (the Linux distribution I use), so it needs to be downloaded and installed manually. This process is really simple. There’s no compiling necessary; just download, expand and move the plugin files to the correct spot.
The current version of the plugin is 0.3, so more features are planned, but even so, it’s quite nice already. To download it, simply go to the website (hosted by Google Code at the link following the article). You’ll then need to expand the compressed file and move the files to their correct spot. There is an installer included with the plugin, which does exactly this. To expand the archive, simply right-click it and choose the “Expand Here” option. After it has expanded, enter the new folder. You’ll see a folder named advancedfind, the advancedfind.gedit-plugin and the install.sh installer script. Double-click the installer script to open it in the Terminal and the installation will take place.
Note: you may need to do this last part from the Terminal directly. Nautilus (the GNOME file manager) lets you choose how to treat executable text files (text files that can be launched as programs), and the install.sh script is one of those. If you have the option to launch them turned off, you’ll need to enter a Terminal and launch it from there, by typing the following, once you have changed directories:
If you want, the entire process can be done from the Terminal, without visiting the website or even opening your web browser. To download it, type the following command:
To expand the file, type the following:
tar -xvf advanced_find-0.3.0.tar.gz
Now, to change into the folder created when the archive was expanded:
Now, to install the plugin:
Obviously, if the plugin is updated, the version will change, and so will the file names, so if someone reads this in six months (or even a few days, depending on how often the plugin is updated), you may need to go to the website anyway.
And that’s it! The plugin is installed. To activate it, you’ll need to open gedit, go to the preferences and then the Plugins tab and check the checkbox to activate the Advanced Find/Replace plugin. Once you’ve done so, you’ll have two new options: the first is the Advanced Find/Replace menu entry, which brings up the advanced interface, and the second is the bottom pane, which will show you on exactly which line each instance of find/replace was found.
Using the Advanced Find/Replace plugin is simple. Bring up the interface, enter what you want to search for and what you want to replace it with, then other options such as whether you want to search just the current document, all opened documents, or all documents in the directory you select. You can simply find and replace, or find all and replace all.
At the moment, there’s only one change I’d like to see, and I don’t know whether this is a change for the plugin, or a gedit change that would need to be made. The Advanced Find/Replace plugin makes obsolete both the built-in find function and the built-in replace function. It would be nice if there was an option to get rid of them. As it is, with the Advanced Find/Replace plugin installed and active, you have an option for Find, one for Replace, and then the Advanced Find/Replace option, all in the same menu. The Find and Replace options don’t include anything you can’t do with the plugin, so I’d like to be able to get rid of them entirely (with the option to put them back, obviously, should I ever remove or deactivate the plugin!). Otherwise, this is fantastic. It’s a feature that’s been missing (and wanted, at least by me, and apparently others), and I’m glad to see it finally available.