# By Jove! It's a Lightweight Alternative to Vim by Seth Kenlon Some people like `vim` as a text editor, and other people like `emacs`. It's the way of the UNIX world. I'm an Emacs user, through and through. Sure, I spent a few obligatory years in my early days of UNIX using vim, but once I learned Emacs properly, there was just no going back. The thing about vi(m) is that it's on nearly every UNIX box because it's been around for ever, and it's pretty small. It's the obvious choice for a default editor that people can use in a pinch. Without taking into account deliberate optimizations and carefully selected configuration options, the "natural" difference in size between Vim and Emacs is roughly 1 to 7 (I maintain an Emacs module for the live Linux distribution [Slax](http://slax.org), where Emacs is 37mb to vim's 5mb. Similarly, on my NetBSD box, Emacs is 14mb and Vim is around 2mb). To be fair, GNU Nano is also small and is a pretty fair and, lately, a popular choice as the default text editor. The problem with both Nano and Vim, though, is that neither of them are Emacs. And the problem with Emacs is that it's really, really big. ## What is Emacs, Anyway? Emacs started as a set of shortcuts (or "macros") for an existing text editor called TECO. The idea is pretty straight-forward: there were ways of doing things in TECO in 6 steps that were easier if scripted and turned into 1 step. Eventually, people saw that the macros were so sensible that the macros themselves were gathered up and bundled together as a stand-alone, interactive editor. To most people, "emacs" suggests two different principles: 1. A text editor with a specific style of functionality (keyboard commands centered around **ctrl** and **alt** combinations, and a general over-all "feel" and style. This is the "manual or automatic?" part of Emacs. 2. A robust LISP interpreter that is endlessly extensible and hackable. This isn't the stuff most people think about when trying Emacs for the first time, it's the stuff under the hood. Most of the "bloat" of Emacs can be found in the place where these two sides of Emacs conjoin. Emacs itself (the text editing part) isn't very heavy. Add in all the cool tricks it can do (view PDFs, load in additional menus, use a GUI frontend, and so on) and the application becomes a little heftier. Add to that a complex config file, and things can get even more complex. ## Jonathan's Own Version of Emacs Jonathan Payne wrote his own version of an emacs editor and called it `jove`. Today, it's something of a niche application that doesn't get talked about much, but it's a surprisingly small and effective emacs "clone". When you're in `jove`, you hardly realise that you're *not* using emacs. Jove is so much like GNU Emacs, in fact, that its inbuilt tutorial, `teachjove`, is emacs-tutorial with only slight modifications. This means you get the most commonly used benefits of GNU Emacs, but with a tiny footprint and a trivial list of dependencies: `libtinfo` for `ncurses`-style elements, and `libc`. How small is it? The `jove` executable is roughly 150K. Jove ships with Slackware by default, so I don't even bother installing vim. Since so many applications seem to want to default to vim, I go so far as to alias `vi` to `jove`. [Fedora](https://apps.fedoraproject.org/packages/jove) and [Debian](https://packages.debian.org/search?keywords=jove) both provide jove packages. If you're on a distribution that doesn't provide a jove package, you might be able to rebuild a package for your distribution from a source package. For example, RHEL and CentOS don't have jove packages, but Fedora does. As long as you have the RPM development toolchain installed: # yum grouplist -v # yum groupinstall fedora-packager Download the source RPM for jove (it should have `src.rpm` in its file name), and then rebuild the SRPM: $ rpmbuild --rebuild jove-4.16.0.73-10.fc24.src.rpm Find the rebuilt RPM in your user's `~/rpmbuild/RPMs/` directory, in the appropriate architecture. Install it as usual. For example: $ sudo yum install rpmbuild/RPMS/`uname -m`/jove-4.16.0.73-10.el7.centos.x86_64.rpm If all else fails, jove is maintained at the [University of Toronto(ftp://ftp.cs.toronto.edu/pub/moraes/jove). ## Exploring Jove The part of the GNU Emacs experience that Jove leaves out is LISP. For hardcore users of Emacs, that makes Jove a non-contender as an emacs [sic.] (the plural of 'emacs' is 'emacsen'), but as a replacement for vim, the absence of LISP simply means you get a lightweight non-extensible editor with the same look-and-feel as GNU Emacs. The best way to find the differences between Emacs and Jove is to use Jove. You'll run into the differences, eventually, but there are a few tricks that can help you adapt. ### env settings You *can* remove the vim package, if you really want to, but on some distributions it's more work than it's worth. For instance, on a RHEL server, both cvs and sudo "require" vim. The executables don't *actually* require vim, of course, but their RPM packages have been told that they do, so that's what yum or dnf will report. It's easier and safer to just set a proper `EDITOR` environment variable. To do that: $ echo "EDITOR=/usr/bin/jove" >> ~/.bash_profile $ sudo !$ $ source ~/.bash_profile $ sudo !$ Most applications respect the `EDITOR` environment variable (even `visudo`, which, given the name, you might not expect). I've seen a few oddities that ignore it and stubbornly load `vim` anyway, but in my experience those are rare. If you absolutely must, you can symlink jove to vi, as long as you keep the actual vi executable around for emergencies; since vi is installed to `/bin`, it's the one text editor you have in the event of a system rescue when `/bin` is the only mounted partition (unless you manually install something else to `/bin`). A safe option: $ sudo mv /bin/vi /bin/vi.bin $ sudo ln /usr/bin/jove -s /bin/vi You should only do that if you know what you're doing, and understand how it will affect a rescue environment. ### teachjove If you're not a Emacs or Jove user already, you should first launch `teachjove` for a step-by-step introduction into how Jove works. Be careful; if you're currently a happy vim user, this may change your world view. If you're a Nano user, this gives you a glimpse at what you're missing out on. ![teachjove and learn emacs for free](images/teachjove.png) ### .joverc Jove ships with several .jove.rc.* files with all the usual defaults an Emacs user might expect. $ cat /path/to/jove/jove.rc.xterm > ~/.joverc This serves as both a safe starting place for getting used to jove as well as an example of the customizations possible. The most common change to make, surely, is the behaviour of the forward-delete key, which for historical reasons is set to act as a backspace: # DEL key bind-to-key delete-next-character ^[[3~ # Backspace key bind-to-key delete-previous-character ^? ### apropos As with GNU Emacs, the command `M-x apropos foo` (or `M-x apr foo` for short) performs a search within all possible commands for the term `foo`. If you run into something in jove that isn't like what you're used to with GNU Emacs, `apropos` a keyword to find the jovial replacement. ![M-x apropos](images/apr.png) Usually there are two reasons for a function to be "missing" in jove. Either it doesn't exist (there's no `org-mode`, and no amount of `apropos org-mode` is going to change that), or it's just got a different invocation because you're not using LISP any more. For instance, in GNU Emacs the `global-linum-mode` function toggles line numbers along the left border of each buffer. There's no such function in jove, but `apropos number` reveals the `number-lines-in-window`, which does exactly the same thing. If you run into a feature you think is missing, use `M-x apropos` and adapt. If your feature really is missing, just remind yourself that at least it's not vim. ## Emacs vs. Vim vs. Jove You might argue that jove is unnecessary, since emacs can be invoked in different ways so as to avoid your init file or to act lightweight. Or you may argue that vim doesn't need replacing if the `EDITOR` environment variable is managed correctly (and respected by all applications, which it is *not*). All of these are valid opinions, and in the end, jove is just another text editor. It's a small utility that makes editing text moderately easier than `ed`. If you're in the market for a quick, painless vim replacement, though, and you love the user style of Emacs and BASH, then Jove might be the backup Emacs for you. Try it today!