Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Textmate on the Mac can be bound to the txmt protocol, meaning that development frameworks (such as the Play Framework) can be configured to use this to display error messages. If a stacktrace appears, each line of the stacktrace is a URL of the format (I'm guessing):


(where 123 is the line number).

Clicking this opens the file in Textmate.

Is this possible with Gedit, Geany or another programmer's text editor?

share|improve this question
up vote 4 down vote accepted

it's possible to easily create new protocol handlers in Gnome, all you have to do is add some keys in gconf.

In a terminal, type:

gconftool-2 -s /desktop/gnome/url-handlers/foo/command '/path/to/app %s' --type String
gconftool-2 -s /desktop/gnome/url-handlers/foo/enabled --type Boolean true

Replace foo on both lines with the protocol you want to register and /path/to/app with the path to the application you want to run. (from : )

share|improve this answer
concerning the line number part, it depends on the editor. I know you can open a file on a particular line number with vim but I don't know if gedit or geany support that feature. – Mathieu Comandon Nov 30 '10 at 13:06

The accepted answer does not work on 11.04.

Here's my solution for gedit on 11.04:

TLDR; version:

  1. Create /usr/share/applications/foo-uri.desktop:

    [Desktop Entry]
    Comment=Open foo links in Gedit
    Exec=open_gedit %u
  2. Run sudo update-desktop-database

  3. open_gedit script inside location that is in $PATH

    LINE=$(echo $FILE | grep -o "\&line=[0-9]\+")
    LINE=$(echo $LINE | grep -o "[0-9]\+")
    FILE=$(echo $FILE | grep -o "\(.\+\)\&")
    FILE=$(echo $FILE | cut -d'&' -f1)
    gedit +$LINE $FILE
  4. Call as foo:///path/to/file&line=299

share|improve this answer
Great Solution! but to make it work for me i've edited 3rd line to be FILE=${FILE/txmt\:\/\/open\?url\=file\:\/\//} – MhdSyrwan Dec 11 '14 at 16:01

My best shot using Python (probably misses some edge cases):

gconftool-2 -s /desktop/gnome/url-handlers/geany/command ' python -c "import urlparse;import sys;import pipes;url=\"http\"+sys.argv[1][5:];import os; up=urlparse.urlparse(url);os.system(\"geany \"+(pipes.quote(\"/\"+up.netloc+up.path)+\" --socket-file /tmp/geany --line \" + pipes.quote(up.query)))" %s' --type String
gconftool-2 -s /desktop/gnome/url-handlers/geany/enabled --type Boolean true

Will start opening geany://home/www/index.php?239 as /home/www/index.php at line 239 using /tmp/geany as socket (to avoid opening many instances of geany)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.