Sunday, May 20, 2007

Making Scite the default editor in GNOME (Ubuntu)

For too long I was fighting with gedit, the default text editor in Ubuntu. While it is not too bad, Scite is far more powerful, and much better.

To install Scite, you can type the following in Terminal:

sudo aptitude install scite

I had the option of changing the editor associated with each of the file types in Nautilus (which is what I did on my desktop), but I was sure there must be a better way. I found it...

sudo aptitude install scite
cd ~/.local/share/applications
echo -e "[Default Applications]\ntext/plain=scite.desktop" >defaults.list
killall nautilus

Works a treat. Also, here is my Scite settings file:


Tip: A per-folder settings file can be created. For example, I have created a '' file in the gloox src folder, so Scite will automatically use the correct indentation for gloox, and insert spaces when I use the tab key.

Update: I found later that this only tells scite to open plain text files. If you are dealing with code (as I am) add the following lines too:


If you want to add other file types, find the MIME type by right-clicking on a file and selecting 'Properties', the MIME type you need to know is listed there.


Sebastian said...

Awesome! Thanks a bunch!

Anonymous said...

Why doesn't using the following ("official") approach work for scite?

sudo update-alternatives --config gnome-text-editor

I don't find scite listed (it is installed and I use it).

(oh, btw, I can't do the captcha in FF3 b4. may not be able to post this...)

Matthew said...

Hi, seems your comment got through... :)

I'm not sure why it doesn't work, but now you mention it, it should probably be filed as a bug against the scite package on

I may look at doing just that this weekend, if nobody else has already.

(it asked me to enter the captcha even though I'm logged in!!)

stratcat said...

I too had been fighting with gedit's history/auto-complete in its search/replace dialog. Editing GCode for CNC machines, I often need the search/replace for replacing numbers with variable names. Gedit would always remember what I'd searched and replaced and would put the previous values in the text boxes for me. If I didn't watch very carefully, an un-wanted word could be put into one of the boxes. This could wreak havoc with a CNC machine (as well as my eyes, etc.) from a wrong GCode being placed in the file.
ScITE is now my default editor in Linux and as soon as I reboot into XP, it'll be there, too.

Thanks again,

Damien said...

Hi Matthew,

This should work for you:

sudo update-alternatives --install Scite gnome-text-editor /usr/bin/scite 1

sudo update-alternatives --config gnome-text-editor



Anonymous said...

This still doesn't make scite the default editor in the right-click context menu (tried with Ubuntu Hardy).

How to get rid of f**king gedit?

Anonymous said...

Hi all,

Thanks for all the tips!

Anon 21:41, after some struggle, this is what ended up working for me:

$ sudo update-alternatives --install Scite gnome-text-editor /usr/bin/scite 1

$ sudo update-alternatives --config gnome-text-editor

# here, I noticed a symlink was gone - but most likely because I was messing with the system previously
$ ls -la /usr/bin/gnome-text-editor
ls: cannot access /usr/bin/gnome-text-editor: No such file or directory

sudo ln -s /etc/alternatives/gnome-text-editor /usr/bin/gnome-text-editor

# test from command line (with existing test.txt file in the calling folder)

/usr/bin/gnome-text-editor test.txt

# all fine here, yet right-click and "open with Text Editor" in Nautilus still fails

# edit:
$ nano ~/.local/share/applications/mimeapps.list

# and you can notice that for text/plain, gedit.desktop is first in the list, and scite.desktop is last; simply make scite.desktop first:

# text/plain=scite.desktop;;userapp-gedit-S5E6VU.desktop;wine-extension-txt.desktop;geany.desktop;gedit.desktop;

After this, the default "Open with Text Editor" in Nautilus changed to "Open with Scite text editor", and files now open :)