October 6, 2010

Intro to jEdit: A Programmer's Text Editor


Looking for a powerful, cross-platform, text editor? Look no farther than jEdit, a Java-based text editor specifically aimed at programmers but suitable for all types of users.

Why choose jEdit? If you're like me and already have a favorite text editor, (Vim, of course) you might not see any reason to switch. Every once in a while, though, I like to test drive another editor and see how it stacks up. If you haven't chosen a text editor to call your own just yet, jEdit has some strong advantages.

Naming isn't one of them — Java plus edit gives you jEdit. Well, OK, it's descriptive but dull. It'd be great if developers could use a little imagination instead of just sticking the first letter of the programming language to the front of the program. But, since it's written in Java, it's truly multiplatform. Run it on Linux, Windows, Mac OS X, Solaris, OpenIndiana, FreeBSD — whatever. As long as your OS has Java, it should run just fine. This is especially nice for Linux users who want to use the same text editor at home and work, where Windows may be mandated. See the jEdit compatibility page for details on the supported Java versions.

jEdit also has a plugin architecture with a rich selection of add-ons and macros that you can use to add functionality, without having to throw in the entire kitchen sink all at once.

Speaking of the kitchen sink... while jEdit isn't Emacs, it is very full-featured. It supports all sorts of handy features that advanced users will want in a text editor. From syntax highlighting (which is pretty standard) to line folding, split windows, macros, markers, and so on.

Finally, jEdit is a great choice because it's been around a long while and has an established community. It's been around for a long time and is likely to continue development for a long time. It's GPL'ed so anyone can participate, modify it, and so on.

Ready, Set, Go!

Ready to try jEdit? You should be able to find packages for any major Linux distro. On Linux Mint 9 or Ubuntu 10.04 just grab the jedit package, and you should be good to go. I haven't checked, but it should be available for Fedora, openSUSE, and other distros.

If it's not packaged for your favorite distro, or if you need an installer for other operating systems, then look at the download page. There's a Java-based installer, packages for Windows, Mac OS X, a generic Debian package, a Slackware package, and (of course) source code. Also user guides are available as PDFs, and instructions are available for FreeBSD, Gentoo, and others.

Once you have jEdit installed, fire it up. You should see a link to jEdit under the Programming menu in Linux Mint with GNOME, and similar in other desktops. Of course, you can just type jedit in a terminal or run dialog as well.

You'll notice that jEdit has a few more menus than you might expect. For example, check out the Markers menu. This allows you to set bookmarks in a file and move between them. You can use this in longer files, so if you're working on two sections of a program, script, or document, it's easy to switch quickly back and forth.

One, mild, criticism of jEdit is that things aren't always where you'd expect. Want to set preferences for jEdit? You'd expect a menu item under Edit called Preferences, right? Nope. Go to Utilities and select Global Options. For instance, if you want to modify your context menu — which is very handy, go to Context Menu and then you can add or remove functions, or just move them around. Not only can you add functions from the standard commands in jEdit, you can also add commands from plugins. Just click on the plus icon and then use the Command or macro selector to choose from built-in commands or various macros and plugins.

You can also set up the look and feel of jedit using the Options dialog, and so forth. Be sure to use the Quick copy using middle mouse button under the Mouse options. Especially if you're unfortunate enough not to be using jEdit on Linux.

On the left-hand side you'll notice a strip that's called the Gutter. Here you can have line numbers and other indicators for features like markers and folds. Those preferences are under the Gutter tab.

I'm a big fan of abbreviations, and use them quite a lot in Vim. jEdit makes it super-easy to set abbreviations through the options menu. Just go to the Abbreviations tab and set the abbreviation and its expanded text using the plus icon. Or remove an abbreviation if it's a hassle for you. I set the "Space bar expands abbrevs" option, but it's not set by default.

There are downsides to jEdit not being a native application. For example, on GNOME I can mount a directory on a remote computer through gvfs / Nautilus. Native apps that use the Nautilus file open dialog will be able to pull files from that remote mount, but jEdit doesn't see them. However, for a Java app, jEdit is remarkably speedy and works very well. It is a good idea to only load plugins that you actually use, since they can slow jEdit down when too many plugins are enabled.

There are entirely too many features to get into all of them in a short feature, but I strongly recommend installing and trying jEdit for a day or two to see if it sticks.

Getting Plugins

If there's something that jEdit doesn't do out of the box, check out the selection of plugins. You can download and install plugins manually, but there's a much easier way to go about it.

Go to the Plugins menu and select Plugin Manager. You'll see three tabs here, Manage, Update, and Install. Pretty straightforward, yes? Go to install and search the list of plugins. It's sortable by name and category, so if you're not sure of what the name would be, search categories. It's also sortable by release date, so you can browse the latest plugins.

You'll find tons of plugins that add all sorts of interesting functionality. Work with databases? Check out the SQL plugin, which allows you to send queries to a database server using JDBC. Want to read mail in your editor? The JMail plugin can do that for you — not very well, frankly, but it can handle some basic mail. You'll also find mouse gesture plugins, tools for specific programming languages, and so on.

In short, jEdit is a really interesting editor. If you haven't settled on a specific editor, it's definitely worth taking a look at. Most of its features have shortcuts, so users who prefer a keyboard-driven editor will find jEdit very usable. Users who have mouse-heavy work habits will also be comfortable with jEdit. Give it a shot, and see if it works for you!

Click Here!