A programmer’s editor is a text editor with features fine tuned for writing code. In this article we will explore the top 10 essential features of a programmer’s editor and how each one saves you time and energy.

* Color coding
* Syntax expansion
* Code navigation features
* List-members and function parameter information
* Comment and function documentation extraction
* Syntax-driven auto-indentation
* Macro recording and playback
* Code snippets and other shortcuts
* Integrated project build support
* Multiple file and window support

Color Coding
Color coding is a language specific feature which allows the editor to display comments, keywords, strings, numbers, and other lexical elements using specific foreground and background colors as well as potentially using bold or italic fonts.

Argument
“I don’t need my editor to look like Walt Disney lost his lunch.” — How do you find your car in a parking lot? Do you look at every car until you find your 1998 Camry with velvet blue interior, or do you look for a red sedan with a “My border collie is smarter than your honor student” bumper sticker. Color stands out; it helps you find things. You have a color monitor, why waste the potential?

Benefits
Color coding helps you distinguish comments from code. If that were all it did, that would be a great win, but it can do so much more. Color coding also helps you see immediately when you have mistyped a keyword, or if you have accidentally used a keyword as an identifier, or failed to terminate a string. This saves you many compile and edit cycles and lets you focus on what’s important.

Investment
There is very little investment to this feature; if anything, you may find yourself un-training your eyes because you do not have to read as much syntax to see comments vs. strings vs. code.

Syntax Expansion
This feature completes statements for you so you only have to type the leading keyword such as “if” or “while” and the editor will insert the rest of the code for that statement in accordance with your brace style and indentation preferences.

Argument
“I’ve been coding for years; I type these statements without even thinking.” — This is true for many seasoned programmers, but the real question is why?

Benefits
For novice programmers, syntax expansion can save them time trying to remember how a particular statement is written. This is especially true for statement heavy languages such as COBOL. For all programmers, syntax expansion helps enforce coding consistency; it will always use your brace style and your indention preferences.

Investment
In fact, the investment to start using syntax expansion is just a matter of un-training your fingers to type the whole statement. Very quickly, you will get used to just typing “while” and then being ready to put in the loop condition.

Syntax driven auto-indentation
Auto-indentation will position your cursor at the expected indentation level when you split or open a new line so that you can start typing code immediately. A good implementation of auto-indentation will respect your tab preferences and either insert real tabs, spaces, or position the cursor on a virtual column without inserting unnecessary space. A very good implementation will handle more than just simple block scopes: it will also handle continuation indents, parameter lists, initialization lists, and splitting comments.

Argument
“I am very particular about indentation; I don’t trust the editor to do it for me.” — This is the sort of feature that must be configured to match your preferences. Once you configure it correctly, the editor will do the right thing more than 90% of the time. If it doesn’t, you are probably using the wrong editor, or in the worst case, can turn the feature off.

Benefits
Auto-indentation will save you time for every line of code you write. Furthermore, it will improve the consistency of your code.

Investment
This feature requires no time to learn, but you may have to un-train your fingers to not lean on the space key every time after you hit enter.

Code navigation
A good implementation of code navigation turns your code into a hypertext. For any symbol in your code, you can jump to it’s declaration or definition in one keystroke. You can jump back to where you were in another keystroke.

Argument
“I don’t need this; I’ve memorized where everything is.” — That’s very impressive; let me know how that works out when you inherit a half-million lines of code you have never seen before.

Benefits
A really good code navigation system makes file boundaries irrelevant, which make it possible for you to focus on the code, not what files the code is stored in. A good implementation does not just use the symbol’s name, but finds the symbol’s declaration or definition using the same language specific scoping rules that your compiler uses. A better implementation can also find all references to a symbol. An awesome implementation recognizes that when you navigate to a symbol and then pop back, it can close the file in order not to pollute your working set of open files.

Investment
In terms of keyboard shortcuts, you need to learn three things: (a) the key to jump to the symbol under the cursor, (b) the key to see all references to the symbol under the cursor, and (c) the key to jump back. If you have not been using code navigation, you are probably finding symbols by manually opening files and poking around, or using grep or another multi-file search to find symbols. In terms of work habits, you may have to train yourself that there is an easier way to do things and use it.

List members and function parameter information
List members (referred to as Intellisense™ by Microsoft) will display a list of class members in the class when you type a member access operator such as “.” or “->” in C++. You can then pick one of the items from the list and the editor will insert it, or you can continue typing the name of the symbol and the list will be filtered down to include only symbols that match what you have typed.

Function parameter information is typically activated when you type the open parenthesis for a function call and will display the prototype for the function being called and highlight the current argument.

Argument
“Those things will just get in my way.” — A well designed implementation of list members and function parameter information will not get in your way. List members is typically displayed below the current line, left aligned to the cursor position. Function parameter information is typically displayed below the current line, aligned with the function name. The windows typically have minimal borders and are shrunk down to the minimal size to display the required information. A good implementation works hard to stay out of your way when coding.

Benefits
If you do not have list members, you will need to be very good at remembering the names of the members of the classes and structures that you use. Suppose you need to convert a STL string to a character pointer. You may remember that it is done using the “c_str()” method. You may have an STL reference manual on your desk and can spend five minutes looking it up. If you have list members, you type “.” and then scan through the list and see that “c_str()” returns “const char*” and remember that is the conversion function.

Likewise, function parameter information brings vital information to you when you need it. Suppose you need to call the standard C library function strncpy(), but you can not remember the order of the arguments. You could look it up in your C book, check MSDN or the man page. That’s fine if you have five minutes to burn. If you have parameter information, the prototype is displayed for you: “char* strncpy(char *, const char *, size_t)”, and you can see immediately that the first argument is the destination (by virtue of being char*), and the second argument is the source string, and the third argument is the max number of chars to copy.

Investment
Typically, these features are invoked automatically when you type open parenthesis or member access operators. You will also want to learn two keyboard shortcuts: one to bring up list members manually and one to bring up function help manually. This will be extremely valuable to you when you are editing established code.

Comment and documentation extraction
Comment and documentation extraction pulls documentation comments from your source code and displays them in conjunction with list members and function parameter information. Really good implementations of this feature will format JavaDoc and XMLdoc comments for you, and highlight function parameter documentation when displaying function parameter information.

Argument
“What will I do with all these Java reference manuals?” — Build a giant pyramid in your cubical and declare yourself a Java deity.

Benefits
If your editor does not have this feature then when you need to see the documentation for a function, you either need to look it up in a reference manual, or jump to that function, read it, remember it, and then jump back to where you were working. Having this feature is like having a really good research assistant who brings exactly what you need directly to you exactly when you need it.

Another nice side-effect of having this feature is that it genuinely encourages you and your whole team to write better documentation comments in your code because you will be seeing them and using them on a regular basis.

Investment
This feature is typically completely automated.

Macro recording and playback
This facility allows you to record a sequence of keystrokes and/or editor commands and then play them back later.

Argument
“You’re hurting my head!” — No, your head will be fine, and your fingers will also appreciate the break once you master this feature.

Benefits
Sometimes you need to make a bunch of very similar changes to code. Macro recording allows you to do it once and repeat the macro instead of tediously doing the same thing over and over again. More powerful editors allow you not only to record macros, but to name them and save them for later. Some even more powerful editors allows you to record not just one, but a suite of macros that you can repeat with a single keystroke.

Investment
There are, at a minimum, two keyboard shortcuts you need to learn: one to toggle macro recording on and off, and one to repeat the last recorded macro.

Code snippets and other shortcuts
This feature allows you to define chunks of text that can be expanded using a keyboard shortcut.

Argument
“I just copy and paste when I need to create idiomatic code.” — The problem with this technique is that, first, it is slow and tedious. Second, it requires you to remember where you can find an example to copy. Third, when you copy and paste chunks of code, you might be copying and pasting chunks of code with errors in it.

Benefits
This feature helps you build a library of snippets of idiomatic code that you can expand at the touch of a key. To add further power, most editors support parameterized code snippets so you can plug in different variable names, constant values, etc.

In addition, some editors also let you define global shortcuts and use them nearly anywhere in the editor, including the open file dialog. Why type “/usr/include/sys/” or fiddle around with the mouse to navigate to that directory if you could just have an alias named “sys”, expand it, and continue from there?

Investment
You need to learn how to create and customize a snippet in your editor, and you need to learn one keyboard shortcut for expanding snippets.

Integrated project build support
This feature allows you to invoke a compile or a project build from your editor, and correlate the compilation errors with source code.

Argument
“We have a custom build system and we can not change it.” — In most cases, you do not have to change your build environment; you just have to be able to tell your editor to use your existing build command to build the project.

Benefits
The first benefit is that you will not have to leave your editor to start a build. You can associate the project build with a keyboard shortcut, such as Control-M (for make). You no longer have to remember the build commands for different, disparate projects. Last, and definitely not least, you can navigate directly to the compilation errors with a single keystroke instead of manually locating the offending file, opening it, jumping to the line number, and then repeating that process for every error.

Investment
You will need to learn the project system of your new editor; how to create a project, how to specify your build command. You will also need to learn the keyboard shortcut for navigating to the next build error.

Multiple file and window support
This is really two facilities. One is the ability to open more than one file at a time in your editor and rapidly switch between them. The other is to be able to open multiple windows so that you can look at different files or different parts of the same file at the same time.

In particular, I address this issue for the programmers out there who are still using text mode vi on Unix or notepad on Windows. Noting those exceptions, almost all other modern editors have these capabilities to varying extents. Some support multiple files and windows, but force you to use the mouse to switch buffers or switch windows. Some editors have a tabbed view for quickly seeing what files you have open and modified. Some editors have support for buffer management, so if you navigate to a file and then pop back (see Code navigation, above) the file is automatically closed, keeping your working set of files small and tidy.

Argument
“Too much clutter” — Some people like to keep things simple, so viewing just one file at a time is great for them, they don’t need side-by-side windows all the time. But, for those times when you absolutely need it, this is a feature that is well worth having available.

Benefits
Modern projects are large and encompass many source files, sometimes tens of thousands. You can seldom get a complete understanding of a system looking at just one file at a time. Being able to switch between files with a single keyboard shortcut is more efficient than starting a new editor to view another file. If you have unsaved changes to a file and need to look at another file, what do you do if your editor does not support multiple files?

Investment
You need to learn a few keyboard shortcuts: (a) to open a file; (b) to cycle through your open files; (c) to split windows horizontally and vertically; (d) to cycle through your open windows; and (e) minimizing and maximizing windows. The first two will get you up and running so that you can maintain a working set of open files. The last three will help you move to the next level.

Conclusion
It’s natural to resist change. Learning a new editor requires an investment of time and a change of work habits. You will seldom regain your investment in the timeframe of your first project with a new editor. But the time you will save in the long run will quickly eclipse the small amount of time you invest. Perhaps you feel that you are extremely proficient with your current editor, maybe even working at power programmer level. This may trick you into thinking that you are already working at peak productivity and will not benefit from a better programmer’s editor. The truth is exactly the opposite, you will benefit even more. Your tools are your foundation. Think of this analogy. No matter how proficient you are at riding a bicycle; you can go further faster on a motorcycle.

The features outlined in this article are things that I have grown to view as essential for writing code proficiently. It can be hard to appreciate exactly how much they help you until you seriously set down to work with these tools in your hands. After which, I can assure you that you will ask yourself how you ever managed to work without them.