Choosing your text editor

Any programmer worth his or her salt will tell you that the text editor is one of the most important things in a code-writer’s toolkit. There are tons of text editors out there, come are simply clones of each other, while some are really unique. Windows Notepad is about the bare minimum that you can get, but if you really want to be an efficient programmer, you’ll probably want something that lets you do more than simply enter text. Most programmer like text editors that allow for mundane tasks to be automated, while otherwise staying out of their way. However, all programmers have their own likes and dislikes as well as varying ideas of the perfect text editor. But how does one find their own suitable text editor?

The first step is to figure out what exactly you are using your text editor for. If you mainly code in just one or two languages you might prefer to have an editor that has inbuilt features for working with those languages. In that case it’s best to see what others like you are using and try out the choices. However, most programmers don’t spend their whole lives coding in one or two languages and as new languages come onto the scene, you probably don’t want to have to switch to a new editor every few years. This is where extensible text editors come in to the picture. Extensible text editors have a small core that deals with routine text editing tasks and also gives you a way to add plugins or extensions which are language or task specific. If you need to switch to a new language, all you have to do is find corresponding extensions (or write your own, if you don’t like what is available).

The most extensible text editor of them all is probably Emacs. Unlike most other software which allows extension via API or some sort of simple configuration scripting, Emacs packs a full-fledged LISP interpreter for a custom dialect of the language. This allows almost limitless configuration. Not only can you write simple scripts to clean up your code, you can embed full-fledged programs, like file managers and FTP clients. In fact, many people have claimed that Emacs is not a text editor at all, it is operating system squeezed into a text-editor’s skin. While Emacs may be God’s greatest gift to anyone who loves making customizations, it is not without it’s problems. Firstly, Emacs depends on lengthy key combinations involving pressing the Shift, Ctrl and Alt keys one after the other along with a few letters in a wide variety of combinations. These key combinations can be quite hard to remember unless you make it a point to memorize them and because of all the unnatural finger movement that have to do, there is quite a high risk of Repetitive Stress Injury. Definitely not fun. And to top it off, it looks like something out of the stone age. For all these reasons (and some more) a lot of people like Vi and its clones.

Vi is a text editor that has been around since the earliest days of UNIX operating systems some thirty years ago. Vi does not pack a full code interpreter, and is not as easily extensible as Emacs (though the newer Vim editor includes a nice little scripting which might be of interest if you have some free time). But that is not the only difference. While Emacs uses long key combinations to let you access a host of text editing functions, Vi requires to switch modes to manipulate the text. In the insert mode, you can type in text, use the arrow keys to move around and use delete and backspace to erase mistakes. But if you need to do something like copy/paste or find/replace, you have to enter the command mode by pressing the escape key. In this mode, you can’t type in text, but you execute commands to manipulate the text. These commands are short (generally just a few characters) and according to Vi lovers over the world, far easier to remember than Emacs’ key combos. Most people who use Vi probably use a clone called Vim, which has both command line and graphical modes, and the graphical mode actually looks pretty decent.

But are either of these really for you? Both of them have substantially learning curves and you will have to spend a good few hours learning your way around if you want the maximum benefits. Both allow extremely fast and efficient text manipulation and a good deal of customization. But a lot of people simply don’t want to spend time learning commands and simply want to get on with it. So what do they do? Why they write their own of course. There are loads of text editors out there because their creators got tired of unwieldy key combos or switching modes all the time. Most of these will not be actively developed for more than a few months, but there are some that are quite good.

Both Vim and Emacs are cross-platform running perfectly on Windows, Linux, BSD and Macintosh. One other cross platform editor that I like and have used quite often is jEdit. It’s written in Java and runs anywhere with a Java Runtime installed. It’s not as powerful as the above but there is an active community of plugin developers and a number of very good plugins (as well as an internal plugin manager that is very useful). Actual development on the editor stalled for a while after the original creator left, but it has recently restarted. The only problem is that it can be rather slow to start up, especially on older machines.

If cross-platform isn’t a necessity, then I have some recommendations for you. For Windows, Notepad++ is one of the best free and lightweight editors that I’ve used. It’s based around the excellent Scintilla editing components but throws in a number of useful extras and sports a nice clean UI. For Mac users, TextMate will probably fulfill all your needs. I haven’t had the opportunity to use it myself, but I’ve heard that it can be as powerful as Vim or Emacs. It’s not free, but if coding is your full time job, it will probably be a wise investment. Linux users have a wide galore of editors to choose from. You can use the editors that come with the two major desktop environments, Gedit and Kedit. If you are a full KDE user, Kate is a more powerful alternative. One of the newer editors that is getting some publicity is called Scribes. It’s a compact editor with a few killer features like a very good auto-complete system and good template support. But there’s a catch: it’s very dependent on GNOME libraries and if you don’t use Gnome that means a large extra download, but more importantly, unlike all the other editors that I’ve talked about, it has a single document interface, i.e. opening a new file doesn’t open a new buffer or a new tab, it opens a new window and if you’re handling multiple files, you’re handling multiple windows, which may not be the easiest of things.

Ultimately it is up to you to find your perfect editor. I recommend trying a few out before you find your match. And if nothing appeals, you could try your hand at spinning your own. With the various tools available today, it is actually quite easy to create a simple text editor (although it is quite a challenge to create an editor that is not simple).

Advertisements

Published by

Shrutarshi Basu

Programmer, writer and engineer, currently working out of Cornell University in Ithaca, New York.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s