Still Working with Ruby
A blog about Ruby updates, tools, editors tweaks, new gems, and random snippets. I also explore edgy parts of Ruby over at Idiosyncratic Ruby.

gedit external tools: Ruby helpers, git integration and more

With the easy-to-use (and pre-installed) command line utility zenity, it is pretty simple to create useful external tools for gedit!

To use them, just check if the “External Tools” plugin is activated and copy&paste the tools you want into the Tools → Manage External Tools… menu. Alternatively, you can download all files, copy them ~/.gnome2/gedit/tools and they are automatically recognised by the plugin. Make sure to adjust the shortcuts if you choose the second approach.

As I said, zenity is a wonderful easy tool, so don’t hesitate to edit the scripts, for example, if the width of a zenity popup does not suit your screen settings.

Update: Since the code lives on github, I replaced the snippets with screenshots.

Feel free to fork and add new ones ;). There will be another article with more tools in about a month. If I think one tool is pretty useful, I will feature it in the article.

Ruby helpers

[ruby] check syntax

Let’s begin with a simple syntax checker. Hit the shortcut and a little popup will tell you the truth.

[ruby] load into irb

Often you want to run code and further interact with the results. You can do it by requiring the ruby file in an irb session. This tool does this for you.

[ruby] run rake task

This shows a selection dialog with all available rake tasks in the current file’s directory. It runs the selected task in the bottom pane.

[ruby] run capistrano task

Same again, for capistrano.

Simple git integration

Here are some tools for common git actions. They do not aim to cover everything, replacing git command line action. They just try to simplify often done workflow tasks.

[git] status

Hit the shortcut to get the git status of the current file’s git repository.

[git] diff

See what has changed in the current file.

[git] add/commit

This displays a menu with common add/commit tasks. For more complex purposes, you need to do it manually. The number column allows fast shortcuts.

General utilities

Some more tool snippets I find useful.

[selection] crypto hash

Select some text and replace it with a hash value. You can also edit the selected menu entry to choose a different key length for SHA2 or to append salt to the string.

[create] save tabs as tgz

A relaxed way to create a flat .tgz archiv: open all documents which should go in there and start this tool.

[create] export to syntax highlighted html

Get code into a nice html format using coderay ;)

[internet] download url (wget)

Quick access to the internet ;)

Creative Commons License

LucaB | June 07, 2010

really nice, thank you a lot
the text-editor of choice is probably a matter of taste, habit and casuality
ubuntu is the best platform for ruby and web development (server and client side), and gedit works very well
I spend most of time with them and I'm happy with the results
I suggest to every ruby/rails and in general web-coder, to give them a try

Dimas Cyriaco | July 06, 2010

That was very helpfull. Thank you.

J_Starnes | January 05, 2012

A few changes to which I had a few problems with on ubuntu studio 10.10
on line 20
commit () {
on line 25
res=`git commit ${1}-m "\`zenity --entry --title='git commit' --text='message:' --width=500\`"` && zenity --info --title="git commit $1" --text="$res"
and on line 88
commit -a
note the trailing space on line 88. I don't know if the change on line 20 helped, but the changes on lines 25 and 88 defintly did. Also thank you for using zenity. I had given up looking for a utility to handle similar tasks.