Ever since watching Dustin Diaz’s first screencast, I was incredibly jealous of TextMate (specifically the keyboard triggered snippets). I was on a mission to find an alternative that wasn’t limited to Mac OS X as it was clear there wouldn’t be a Linux version of TextMate. There are quite a few suggestions on the TextMate site itself, but I found nothing that mimicked the Snippets functionality of TextMate properly. E TextEditor came out for Windows, making me even more jealous. Now there was an application for Windows that performed similarly to TextMate, and I had nothing to work with. The author of E indicated that there would eventually be a Linux version, but not until the Windows version was final. After a continued search, I finally came upon SciTE Snippets.
SciTE – My New Favorite Editor
SciTE is (freely) available for both Linux and Windows, but this article will dedicate itself to the Linux install process as it is the only environment in which I’ve set it up. Furthermore, the details of the installation process will be specific to Ubuntu 6.10, as it is my distribution of choice, but the install process itself should be similar on just about any version of Linux.
SciTE is easily available to install by executing the following in a terminal:
sudo apt-get install scite
After you enter your password, SciTE will be automatically installed and setup. You can also install SciTE using Synaptic Package Manager, but I prefer the command line. SciTE can be run by entering
scite in the command line, or using the menu: Applications > Programming > SciTE Text Editor.
By default, SciTE doesn’t include the snippet functionality offered by TextMate, but incorporating all of the hard work by Mitchell, SciTE Snippets are easy to implement.
Implementing SciTE Snippets
I spent some time trying to grasp how to actually install the snippets plugin Mitchell developed. Following his documentation proved to be quite useful and I had SciTE Snippets up and running after a bit of trial and error. It involved a process that some people new to Linux may find intimidating, so I’ve decided I would try to use the SciTE binaries offered on the site. Not only do you get working Snippets, you’re provided with a new look and feel for SciTE itself. A large library of Snippets are included to work with and add upon and I found it to be a great starting point for using Snippets in SciTE.
The binaries Mitchell offers are stored on Google Code and available for Windows as well as Linux. Download the latest Linux Binaries (
scite-tools_linux_bin_r3.tgz at the time of this writing) as well as the Source Code (
scite-tools_src_r3.zip at the time of this writing) which will come in useful later.
- Extract scite-tools_linux_bin_r3.tgz
tar xzvf scite-tools_linux_bin_r3.tgz
- Copy the new SciTE binary over your installed version
cd scite-tools_linux_bin_r3 sudo mv /usr/bin/scite /usr/bin/scite.bak sudo cp SciTE /usr/bin/scite
The binary has now been copied to your existing installation, it’s an updated version compared to the one offered in the Ubuntu repositories. You’ll notice that if you run SciTE, not much has changed; we’ll still need to copy over Mitchell’s configuration files as well as his included snippets.
- Extract scite-tools_src_r3.zip:
- Implement configuration and Snippets:
cd scite-tools_src_r3/ sudo cp -R * /usr/share/scite/
Just to be clear, not only have you copied over the configuration and included Snippets, you’ve also copied the source. If you feel the need to remove the extra files, feel free to do so. Now that the configuration files have been copied, you can run SciTE again, and you’ll see it’s received quite a makeover:
SciTE Snippets are now at your disposal using the CTRL+i keyboard combination after typing your trigger.
Customizing SciTE Snippets
While Mitchell includes many of his personal Snippets, I have a certain way of writing markup, style, and code. Each developer will want to make adjustments to existing snippets — as well as add some — in order to streamline his process even further and take full advantage of their presence. Managing your Snippets is actually quite easy if you follow the conventions established by Mitchell. Your snippets are stored in /usr/share/scite/scripts/ and organized according to language.
Creating Snippets is well documented on Mitchell’s site, and he even offers a Ruby Snippet Generation Script which can come in quite handy. Personally, I found the example Snippets offered in /usr/share/scite/scripts/html/snippets.lua to be most helpful in understanding Snippets and how they worked. I simply manage the snippets I wish to use in that file and it’s worked out well so far.
Mitchell has provided a really great tool for many people, free of charge. He has provided screencasts which show his Snippets in action, including a demonstration of how to use scopes, a very powerful feature he’s included.
Customizing the SciTE interface
When using SciTE for the first time, I was surprised not to find a Preferences dialog. Like anybody, I have preferences as to the type used in my editor, so I was looking to make that simple change. Instead of a Preferences dialog, you’ll need to edit a configuration file. While I’d much prefer to have a GUI dialog, having to edit a configuration file really isn’t that big of a deal to me, but I know many people would look at the application as inferior for that very reason.
Regardless, the configuration file can be edited by selecting Options > Open Global Options File within SciTE. The associated file holds all of the preferences you’ll want to tinker with to get SciTE to look just how you want it. If you’re using Mitchell’s configuration, you’ll notice he took the time to reorganize this file, making it very easy to manage.
SciTE (especially with Snippets) is my new favorite tool
I’ve found that creating Snippets can be a lengthy process, but one that offers great benefit. Using Snippets allows you to work at a much faster pace without getting ahead of yourself and losing focus. It takes away much of the tedious aspects that come with writing markup. The speed benefits alone made switching from Bluefish/Quanta worth it. I have a feeling that many editors will incorporate such a feature in their upcoming releases.
It goes without saying that SciTE has all of the features you would expect in an editor: line numbering, code folding, syntax highlighting, etc. I’m very pleased to make the switch to SciTE, and I definitely recommend it to anybody who isn’t willing to fork over the cash for a copy of E. I’ve only been working with SciTE a short time so far, so if anybody has any tips or tricks they’re willing to offer, it would be great to post them as a comment.
You can do this with the perfect text-editor «vim» as well 🙂 Oh, maybe not the scope. I don’t use that.
But vim is not for everyone, so very good that you made this tutorial. It is good that there exists other usable text editing programs for Linux 🙂 I’m glad you found one you could love. (And not make you feel jealous of OS X-people)
@Odin/Velmont: I had also read that something like Snippets were possible using vim, but as you had mentioned, I just can’t get the hang of vim and prefer to use something like SciTE. I haven’t messed around with the scope much yet, but it looks to be quite a powerful feature in certain circumstances. So far, it’s working out great.
For people using Linux/GNOME, the latest versions (releases, too) have similar support out of the box. Even the syntax of the snippets is very similar to that of TextMate.
@Veracon: I wasn’t aware that Snippets were integrated into the release… that’s great news! Thanks for sharing.
Hey, this is a very handy tool. Thanks for the tip
Thanks for this post. However, after looking around, I think gEdit incorporates these features already, maybe even directly from the ScITE project. Since you’re using Ubuntu Edgy, I thought you’d like to know. Just check out the ‘Plugins’ option in the gEdit preferences. I’m still stoked about the ability to alter the indents of several lines at once!
Great post though. I too am in the process of mastering the art of being a designer on Linux.
@Dan: I hope you find it useful.
@Simanek: Wow, I had no idea. I know I’ve looked at gedit plugins before, but I don’t remember seeing this. Was it recently added? I just gave it a quick try and it seems to work very well. The only issue I run into with gedit is that sometimes syntax highlighting is a bit flaky. Thanks for the tip!
[…] Via Monday By Noon. […]
I have to agree with Jon – in my quest for a suitable and easy to use editor, I didn’t quite like gedit (although I am not excluding it entirely).
For web development, my choice was set on Quanta Plus and Aptana IDE under Linux. On Windows, Notepad2 and occasionally Dreamweaver
Great post, Jon. I’m absolutely in love or “intoxicated” as you once said to me, by using Linux; and using it for web design and development has been a dream come true. Once you feel comfortable with Linux there’s really no reason to be jealous of the Mac-guys anymore.
Oh, and I forgot to mention that I agree with you, SciTE with snippets is completely awesome. Thanks for the tut on how to include snippets, btw. I was having a hard time implementing it on my own.
[…] is my text editor of choice thanks to a great writeup by Jon on how to include snippets functionality to the already robust app. If you need a powerful text […]
@dan: I was using Quanta for some time as well, but I prefer Gnome over KDE and although Quanta is a fantastic editor, it still irked me a bit.
@Ben G.: The comments here have shown that there are indeed other apps that work with snippets, but I’m going to stick with SciTE, I really like it.
[…] – editor ( de curând am sesizat că i-am ignorat puţin putere mulţumindu-mă doar cu modificări ale coloritului ) am profitat de […]
[…] it chewed up all my memory and slowed things to a crawl. So SciTE with some additional plugins (and information on getting them going) powers the development at McKinney […]
Might also want to check out scribes.
Seems like a great editor – only it doesn’t support multiple open files which really sucks.
Also, e-text-editor works (somewhat) through Wine.
(using ubuntu fesity)
Okay, just getting back to you here. I’m just getting around to really start taking advantage of the snippets mechanism. The added ‘tags’ that can be placed into the snippets to include dynamic information as well as tab markers within the snippet (the img tag is a good one for this). It’s great to see a major interface convention that has nothing to do with graphic presentation and everything to do with text-based simplicity.
[…] was before the days of the Gedit implementation of snippets so I did my best to replicate TextMate in SciTE. It was awesome. Incorporating snippets changed the way I worked by orders of magnitude, and the […]