Nice but Powerful Command Line Editors as Alternatives to Vi and Emacs

/pics/misc/ne-micro-kaa.jpg

Lots of Linux beginners face at one point or the other the problem that they have to change a small configuration inside the command line. There is no Notepad, IntelliJ, Eclipse, and not even Gedit or Kate available here.

And very often the default is vi (or it's iMproved version vim). Vi has an edit and a command mode - and starts in the latter. Therefore, most beginners will experience an extreme amount of anxiety when they cannot edit anything nor even exit the program.

On the Raspberry Pi, people usually suggest to use nano instead of vi - some people try Emacs, but also in emacs, the usage feels very unusual, if you are used to the rich GUI editor experience. I do not want to start a flame war here - I have used Emacs myself in my young years and abandoned it it after destroying my perfect configuration (Emacs makes you love the possibility to customize it for your unique specific needs) the second time during an upgrade. And no, at that there was no git yet to keep nicely track of your configuration changes (yes there were rc and cvs, but this is for another post).

I recently stumbled upon Spacemacs and tugged it away for taking a closer look later at it. It turns out to be a heavily configured version of Emacs adding a lot of Vim features to Emacs and lessening the customization effort and wish going along with Emacs. However, all Vim, Emacs, and Spacemacs have still an extremely steep learning curve and do not transfer to anything else in the editing world or back from it. They come though with lots of tempting features - especially interesting for developers, web designers, and bloggers. They also run basically in any type of command line. Even on Android under Termux they provide a powerful command-line editing and development environment on your phone. As I vowed to be more active on my techblog, I wanted a nice command-line-edit way to give me quick and powerful editing support in all the environments where I could potentially write. And yes, I actually often like to edit in the command line. My quick and always available editor is mcedit, which is part of Midnight Commander. Midnight Commander is a very powerful file manager for the command line and even if it is inspired by the Norton Commander dual panel interface from the DOS ages, my systems students still seem to appreciate it as a very easy to use exploration and file management tool today. It happens to come with a built in editor, which very well supports keyboard and even mouse and touch input and has syntax highlighting. Not much more, but very often that is all I need. It is part of nearly all Linux distributions (on Debian, Ubuntu, Mint it is just a sudo apt-get install mc; mc away) and for accessing the editor, you can then type mcedit at the command line.

However, Midnight Commander and respective mcedit as well as nano had a little too few features for making me happy in all my command line editing tasks. Therefore, I started to look for alternatives. Of course, I took another look at vim and emacs, but I am still not feeling comfortable to recommend these to everybody. That's why I was looking for something nicer and easier to learn. I was especially interested in syntax highlighting and extensibility and support of macros or external tools. I also wanted them to be still in development and having some kind of community support.

Three candidates stuck out: ne, the niceeditor, micro, and kaaedit.

/pics/misc/screenshot-ne.png

ne or nice edit is actually really easy to use. It is very easy to open up the menu (press F1 or alt-M) and look up powerful commands to edit. Most Linux distributions and also cygwin include it, so it might be as easy as sudo apt-get install ne to get it. It does not support mouse input like mcedit (and later micro), but of course this should not be the major focus of a command line editor. It does syntax highlighting and allows to create macros with an inbuilt recording function. It feels very natural to use, I wish I saw a way to add spell checking to it. Unfortunately, it does not support restructured text as highlighted text. Because of its availability I think this should definitely be a consideration for replacing nano.

/pics/misc/screenshot-micro.png

micro claims to be "a modern and intuitive terminal-based text editor". And, I can confirm this is spot on. It is not part of any major Linux distribution yet, but it comes as a relatively easy to install static binary (which you can also compile yourself). You basically can just copy it (as root) to /usr/local/bin and are ready to go. It supports syntax highlighting, normal editing commands, mouse input and selection, F1 brings you to a quick start screen for telling you that you can exit with ctrl-Q and access advanced commands with ctrl-E and a tab command extension. After using it for a couple of minutes, editing feels very natural and you forget that you are actually in a command line environment. It supports very nice color schemes and overall has a very clean and streamlined feel to it. You can write powerful plugins in the LUA programming language and there is support for compiling and running your programs. There seems to be easy support to add command completion, but I did not test this yet. I did though not find any on the fly spell check in here - maybe it can easily be implemented by a plugin. I will keep a close look for command completion and that as I have the feeling that it should come very soon - I would definitely consider switching every command line editing to micro, when spell checking would be available. Like ne, it also has only very limited syntax highlighting support for restructured text. Functionality wise it feels very similar to ne, but the supporting community seems to be bigger and the whole usage feels a bit more clean than ne.

/pics/misc/screenshot-kaaedit.png

The other really interesting text editor I found is kaaedit. It feels again very similar to ne and micro but seems to offer a little less in terms of functionality. It is however fully coded in Python and also extensible in Python. This might make it very accessible for a community to provide plugins. Because of these roots it supports of course syntax highlighting for restructured text. No mouse support or spell checking here either.

As a summary, micro made the best impression on me. I would definitely prefer ne to nano and vim (even if vim will have everything from spell checking to syntax highlighting of restructured text - but I still don't see how I would convince a significant amount of people to use it). kaaedit though is really tempting as I have the feel, I could make some changes myself to it and due its already present restructured text support.

This article got much longer than I expected - what can you write about text editors anyway? If you are still bearing with me until here, please feel free to leave your opinion or experience with any of the presented editors in the comments. Also let me know if I have overlooked another nice and easy to use option. Also pless express some encouragement if you want me to take a more in depth look at the gui options or if it would make sense to turn this into a Youtube video.

Here is again a list with all the links:


As I have worked at the same time for comparison with some small lightweight gui alternatives, I should mention at least the direct gui contenders (big advantage: most of them do on the fly spell checking). The honorable mentions for lightweight but still powerful GUI editors are:

  • geany: nearly a full IDE, great plugins, runs even in Windows and one of my favorite small cross platform editor.

  • gedit: small, fast, simple

  • kate: KDE's hidden gem for editing code

  • atom: a new upcoming contender, very extensible,also nearly full die, very active community

  • retext: no on the fly spell checking, but comes with fast preview for Markup languages (markdown and restructured text,which is the base for this blog)

Resources I visited and read for this investigation:

Comments