What's your favorite code editor?
This is a common question which still keeps popping up on community boards, mailing lists, comments, etc. Every
programmer who writes code in some programming language normally has an editor of choice. Being realistic, most of
the times it's not only one program but several, depending on the language and on the features needed at the
time.
Yes, great, but how do you choose your favorite editor?
By trying a lot of them of course: that's what I've been doing since I started programming. Lately
I've become fond of Vim (or better, gVim), although I have a few other
editors I may recommend, e.g.:
Recently, however, I came across my n^th^ “what's your favorite editor” thread and someone
mentioned Komodo Edit. I knew of it already,
actually, but I never had a chance to give it a proper try.
ActiveState is well known mainly for two things:
- Their effort in offering a lot of commercial, windows-based Perl libraries
- Their commercial IDE, Komodo IDE, which I personally tried quite a long time ago
The problems of Komodo IDE are foundamentally two:
- It costs money – this is not great in a world where Eclipse and Netbeans are free
- It is an IDE – which normally means ‘heavy as hell'.
It's a matter of taste and needs: some people feel more confortable with using an editor for certain tasks, while sometimes an IDE may be the best solution, despite its potential slowness and bulk.
Komodo Edit solves the above-mentioned problems because:
- It's free
- It's an editor
Actually I wouldn't call it an editor, because it offers quite a lot of features which are normally absent in editors — it's something in-between, which definitely deserves a try.
User interface ⇈
Komodo Edit's interface is one of the most clear I've ever come across. It is organized in four main areas plus the top menu and toolbar (which only has the buttons you REALLY need, unlike Notepad++'s 31-button-bar).
The central area is for editing, the left pane is for the Project browser, the right one is for the Toolbox and the bottom pane is for command output. Luckily enough, a set of handy little buttons is provided in the toolbar to show and hide each pane. I normally only use the Project Browser and the main editing area, leaving the Toolbox and Command Output panes hidden, but that's up to you really.
Komodo Edit allows symultaneous editing of multiple documents, which means that it has tabs like most of the best editors out there. Furthermore, it is possible to have Komodo re-open the files edited in the last editing session, saving you a lot of time. Granted, a lot of IDE do, but this is NOT an IDE, remember? It's an editor, or at least it is advertised as such.
In reality it has most of the power of a full-blown IDE though normally remaining
under the 60K memory usage (out of 2GB of total RAM) — which is not that bad,
considering what Eclipse and NetBeans need.
Out of all the extra features offered
by Komodo IDE, the only one I truly miss is the Code Browser. Other than that, it quickly
became my editor/IDE of choice (when gVim isn't looking, of course…)
Lets find out why…
Editing features ⇈
Komodo Edit comes with all the editing features of ever average editor, so “[…] Code commenting, auto-indent and outdent, block selection, incremental search, reflow paragraph, join lines, enter next character as raw literal, repeat next keystroke and clean line endings on “save”.", it uses Scintilla as main editing component, which makes it a close relative of Notepad++, Notepad2 and of course SciTE when it comes to understanding languages and syntax highlighting.
This is good, of course, as Scintilla is an excellent editing component, but – I have to say this – not
as good as Vim when it comes to syntax highlighting (nothing is as good as Vim though, so I can't really
complain!).
As you can see from the screenshot I included earlier on, it is possible to change the default black-on-white color
scheme to something more stimulating and energy-saving. This doesn't mean I have to manually re-set the color
of each element, it actually comes with a black-background scheme, which is handy.
Supported Languages & Syntax Highlighting
Komodo Edit supports quite a few programming languages, which means it can recognize the most common ones (C, C++,
Java, PHP, Python, Ruby, Perl) but it also smart enough to notice framework-specific
syntaxes like Smarty, Django or RHTML.
Like every scintilla-based editors, it sports a nice HTML multi-highlighter which allows
you to keep putting all the Javascript, CSS and server-side scripting into the same file,
GREAT! No, you probably wouldn't want to do that, but it's a good thing to
have.
Auto-completion
What makes this editor a really handy tool is its auto-completion capabilities. Why? well, because it supports:
- Ruby: require, class modules (on . and ::), class variables and methods, method calltips.
- Python
- Perl
- PHP
- XSLT
- XML
- Tcl
Why is this so special? Well, because if you want this you normally need an IDE, and if you
want it for Ruby AND Python AND Perl your choices are very
limited.
I played with the Ruby auto-completion features quite a bit, and I'm actually really impressed.
It can suggest what to write through calltips after a require
directive, after a . and a ::, and hitting
CTRL+SPACE (or just tab if you configure the right option) will auto-complete what you're writing, be it a
language keyword, a variable of any kind or a method. Additionally, it comes with “soft characters
support”, which means it will try to match ( [ { when possible, allowing you to write over the
completed character if you want to.
Syntax Checking, Vi/Emacs key bindings and code folding
The heading is almost self-explanatory here: Komodo Edit supports code folding (you can even chose the folding
chracters!) for all its supported languages, syntax checking (it can detect and display errors before running the
script, very useful in Ruby, and hard to find in other editors) and Vi/Emacs key bindings.
It also offers “vi emulation”, which is constantly improving through every release – so you
won't forget Vim's keys when I don't use it: very nice, and again, hard to find in other editors,
nevermind IDEs!
Projects and Tools ⇈
The Project Browser and Toolbox are two features which are normally presents in IDEs and which are normally not found in editors. Granted, some editors like PSPad do indeed have “projects”, but most of the others don't. A project in Komodo Edit is normally composed by:
- Some Live Folders including all the source files of the application you're developing
- An optional set of tools, commands, snippets and other goodies which may help you coding that particular application.
It is possible to create these tools by clicking the Add Item to current project button in the
Projects toolbar or by clicking the Add Item to Toolbox button just over the toolbox.
Either way, you can choose among the following:
File/Remote File
Add a file on your local machine or a remote file hosted on a server you configured via Edit > Preferences > Servers. Supported protocols are: FTP,FTPS, SFTP, SCP.
Folder
This will not link to a folder and import local files in Komodo, instead, it will create a container for other tools, not for local files.
Live Folder
On the contrary, a live folder links to an actual folder on your machines, and all files and directories inside it are automatically imported. Note that it is possible to choose to include or exclude certain files or directories from being imported by right-clicking the folder and editing its properties.
Command
This will create a shortcut to a command to execute. It is possible to specify its parameters, the directory where it will be run, whether its output will be displayed in the Command Output or in a newly-spawned console window, etc. etc.
Snippet
TextMate fans will love this. Komodo will let you create a code snippet for later use. Furthermore, it is possible to specify “tabstops” to automatically select certain words when tab is pressed (so you can effectively fill in only particular fields of the snippet).
Template
A simple but effective way to create code templates.
Url
A link which will open a given url.
Open… Shortcut
This will popup an Open File dialog in a direcxtory of your choice.
Macro
For those who require even more customization, it is also possible to record or code macros in Python or javascript, and then configure their key bindings and triggers.
Custom Menu/Custom toolbar
This was really impressive. Sure you can group all your tools in folders in your current project or you can create them in the toolbox to make them available all the time, but it would be cool if the editor itself could make those tools available by default in a toolbar or a menu. Well, that's possible: all you need to do is create a new custom menu or toolbar and populate it with your tools by drag and drop. Very, very nice!
This mini-framework to create custom tools can be used to create project templates in a blink. To show this concept, Komodo Edit comes with a Rails template with almost all the tools you need when coding a Ruby on Rails application:
- Create/delete database
- Generators
- Migrations
- Run server
- Example view snippets
Conclusion ⇈
Komodo Edit is an interesting editor which offers a lot of features which are normally only available in IDEs at a
smaller memory footprint. Granted, when I want to jot something down I still prefer to fire up gVim, but for a
serious coding session, Komodo is the right choice.
Its close attention to details and its ease of use make developing an even more pleasant experience, although
perhaps there's still room for improvement, if you're really fussy.
Sometimes when you start getting used of its advanced features, the lack of a code browser seems a real shame, but after all, ActiveState must sell their IDE to someone at some point!
Another thing which I would have liked is the ability to create new syntax highlighting schemes, which Notepad++ and VIM both offer. Whydoes it bothers me so much? Well, because I'd like a Textile syntax highlighting scheme for writing blogs and articles. VIM and Intype seem to be the only ones which offer it out-of-the-box, but there's no trace of it in Komodo Edit.
Actually it is possible to create new syntax highlighting schemes and extend Komodo Edit via XUL extensions, exactly like Firefox. After a closer look, the Django syntax was added in this way.
Unfortunately there aren't that many extensions available for Komodo Edit, yet, but the Activestate Community seems very active, so you never know. Additionally, the recently-started OpenKomodo is a new project created by ActiveState to “[…] create an open source platform for building developer environments. ActiveState has open-sourced elements of Komodo Edit, a free multi-language editor for dynamic languages based on Komodo IDE, to create the Open Komodo code base”. A new competitor for Eclipse and Netbeans will be available soon?