+8
Completed

Open file using file manager in existing Sublime Text 2 window

Josiahmazing 14 years ago updated by Jon Skinner 12 years ago 11
I've setup Sublime Text 2 to be my default text editor. As a result, each time I open a text file in my file manager (Nautilus on Ubuntu) a new Sublime Text 2 process is launched.

While sometimes this might be desirable, often it isn't. For example: If I have many files open in my current ST2 session / project and then open a file related to this project in Nautilus. In this situation a new ST2 process is created, which seems to clone the existing ST2 process's session, and then create a new tab for the opened file. Instead, what I'd prefer in these cases, is the ability to have the file I opened in the file manager appear as a new tab in an existing (if any) Sublime Text 2 process.

Is there any way to do this currently? Perhaps a command line argument, or some other option to configure?

If not, please add this feature. Thanks!
It will open up in an existing window if your version of Ubuntu is new enough. If you run it from the command line, it'll print a message to stderr if your version of GTK isn't recent enough for the single instance functionality.
Thanks Jon for your very speedy response!

When I run ST2 from the command line I get the error message you mentioned: "libgio version is less than 2.26, single instance support disabled"

I've spent the past hour trying to find a way to update this library to a version >= 2.26 using Ubuntu 10.04 -- but being a bit new to Linux I haven't had any luck so far... Is there an easy solution to updating this library? It seems that its connected to the latest release of Gnome, however Ubuntu doesn't seem to have adopted it yet for 10.04.
+1
Yeah, libgio is part of gtk, and hence part of gnome. You'd have to upgrade to a newer version of gnome, and I don't know if that's something you can do in ubuntu without moving to a new version of ubuntu or not - I'd guess not. If you did upgrade to a newer version of ubuntu, I'm not which version comes with libgio >= 2.26.
Thanks Jon, this resolves my issue! Please fell welcome to consider the parent request closed.
+1
Any workaround for people with older versions they can't easily upgrade? (The standard Goobuntu setup is libgio 2.22 I think...)
There are no workarounds that I'm aware of, unfortunately
+1
You can open new file using "open" function of ST2, or just drag'n'drop new file to existing instance of ST2.
+4
Consider using the trick described here: http://www.tumblr.com/tagged/libgio
+5
Thank you, Mr Waz.  Only one change to be made to the author's solution:  

...LD_LIBRARY_PATH=/opt/lib/glib2.26/lib... <-- :D

+1

Is there a mirror or copy of the suggested "trick" from Mr. Waz? Link seems to not work.