Introducing a new Gedit Plugin: Find in Files
Posted by Vince Wadhwani on May 06, 2008
Regular readers know that I've been using Gedit to do most of the text editing now that I've put away my mac in favor of linux. Leaving Textmate was really hard but luckily there are a few great plugins that help smooth the transition. One of the things that was still missing was an easy way to search for code within my project. There is a Find in Documents plugin but it only searches in documents that you already have open. I decided to modify that plugin to create a new one called Find in Files. Read on for the link and to learn a bit more.
So what does this plugin do? Well, if you're using the filebrowser in your sidepane, it will search for an expression within all files beneath that path. So if you've got a rails project for instance, you can look within it to find a particular code snippet.
There are plenty of limitations though.. for one it doesn't do well with special characters. So if you're looking for "foo" better to search foo rather than <%= foo %>. It also doesn't do well searching multiple directories down.. I haven't spent a lot of time looking into that to find out why but maybe I will at some point. I am not a python programmer so unfortunately this is more of a hack than it is a program. Much of the credit should go to Mike Doty (the author of Find in Documents) and Mads Buus Jensen (the author of the SnapOpen plugin).
Ok, enough babbling, get the plugin here. Hopefully if you're having TextMate withdrawal after moving to linux this, along with the previous examples, will help you on your way to recovery. Happy coding!
Thanks for the plugin! It was this single feature alone that forced me to look elsewhere for my Ubuntu TextMate equivalent.
With that being said, I cannot seem to get it to work. I added the plugin and activated it via my gEdit Preferences, but I’m still not sure how to search in multiple child files.
Also, in your search for a Ruby editor, did you ever try Geany? http://geany.uvena.de/
It is a lightweight editor similar to Gedit / TextMate that comes with some pretty robust features out of the box like: ruby syntax highlighting, code folding, find in files (including regex searches), snippets (though nothing as robust as TextMate), ability to jump directly to “tag definitions” with a right click, class and method browser, 3rd party plugins, among other stuff.
It does NOT have autocomplete for quotes, braces, etc, which seems like a big oversight. It also does not have “Snap-Open” feature which I enjoy in TextMate, but it definitely has potential. I am very surprised that I am apparently the only Rubyist that uses the tool.
With all that being said, please let me know what I am missing with your Find In Files plugin.
Thanks!
Jim
Hi Jim, Sorry to hear that it’s not working for you.. it’s a big concern for me and I’d like to figure it out. Can you email me off the blog (my email is listed on urbanpuddle.com/pages/about). I’d like to know:
I’m sure we can get this thing sorted!
vince
Hi,
I modified your plugin a little bit an put it online: http://weblogs.brandnews.at/pm/stories/6205/
Maybe we could work a little bit more on it because it is really cool.
Check out the changes
Philipp
Hi Philipp,
You don’t need any permission from me but you should contact the original authors like I did to make sure it is ok to redistribute the code. I can’t imagine they will have an issue with it but it’s always good practice (their code is copyrighted..)
-Vince
vince