By Jove! It's a lightweight alternative to Vim

441 readers like this.
open source button on keyboard

Opensource.com

Some people like Vim as a text editor, and other people like Emacs. Having such different opinions are 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 no going back. The thing about Vi(m) is that it's on nearly every UNIX box because it's been around forever, 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 (for several years, I maintained an Emacs module for the live Linux distribution Slax, where Emacs is 37MB to Vim's 5MB. Similarly, on my NetBSD box, a minimal build of Emacs is 14MB and Vim is around 2MB).

To be fair, GNU Nano is also small and is a pretty fair and, lately, popular choice as the default text editor. The problem with both Nano and Vim, though, is that neither of them are Emacs. The problem with Emacs is that it's really, really big.

Delving into Emacs

Emacs started as a set of macros for an existing text editor called TECO. The idea was pretty straightforward: TECO occasionally had features that required six steps that were easier if scripted and turned into a single step. Eventually, people saw that the macros were so sensible that they gathered up them up and bundled them together as a standalone, 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 overall "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 what most people think about when trying Emacs for the first time—it's the stuff under the hood.

Most of the weight of an Emacs binary is 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 PDF and docx files, load in additional menus, use a GUI front end, and so on) and the application becomes heftier. Add to that a complex config file, and things get even more convoluted.

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 realize that you're not using Emacs. In fact, Jove is so much like GNU Emacs that its inbuilt tutorial, teachjove, is the 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. Because so many applications seem to want to default to Vim, I go so far as to alias Vi to Jove.

Fedora and Debian 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 dnf install ~/rpmbuild/RPMs/jove-4.16.0.73-10-el7.rpm

If all else fails, the source code for Jove is maintained at the University of Toronto.

Exploring Jove

The part of the GNU Emacs experience that Jove leaves out is Lisp. For hardcore users of Emacs, this makes Jove a noncontender as an Emacs, but as a replacement for Vim, the absence of Lisp simply means you get a lightweight nonextensible 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 doing so is 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 use:

$ 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. Because Vi is installed to /bin, it's the one text editor you'll 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 is:

$ sudo mv /bin/vi /bin/vi.bin 
$ sudo ln /usr/bin/jove -s /bin/vi 

You should only do this 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. 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.

teachjove and learn Emacs for freehttps://opensource.com/sites/default/files/jove_teachjove_700p.jpg" title="teachjove and learn Emacs for free" typeof="foaf:Image" width="700" height="358">

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 behavior 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 aproposhttps://opensource.com/sites/default/files/jove_apr_700p.jpg" title="M-x apropos" typeof="foaf:Image" width="700" height="358"> 

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. Jove has no such function, 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 and you love the user style of Emacs and Bash, then Jove might be the backup Emacs for you.

Seth Kenlon
Seth Kenlon is a UNIX geek, free culture advocate, independent multimedia artist, and D&D nerd. He has worked in the film and computing industry, often at the same time.

14 Comments

where you use `source $file` try `. $file` it does the same but is portable to other shells as well as bash ;)

Interesting. I also `source` in both tcsh and bash. What shells does it not work in? The Internet claims ksh, fish, and zsh also `source`.

In reply to by Lewis Cowles (not verified)

Probably some minimalist/old/very POSIX-complaint shells?

On my slack box at least, ash and csh don't recognize source as a command.

In reply to by sethkenlon

For many years I use a little know emacs clone call microemacs. I used it as my editor of choice all through my dos programming days. I then moved to jove when I could not get microemacs to install on my new version of linux. I then tried jove. But I missed my old microemacs. I have tried jasspa version of microemacs but it broke my macros and workflows. I now have moved on to nano as my primary editor but I still miss microemacs.

Never having used microemacs, I cannot share your pain. I guess I'll avoid microemacs if I ever encounter it though; it sounds highly addictive!

In reply to by patrick wilder (not verified)

I use micro Emacs also but I use it on xubuntu and primarily Fedora. I had to install the ncurses-devel package to get it to compile but now it works fine.

In reply to by patrick wilder (not verified)

I have used jove and microemacs, but so far my favorite small emacs is Jed. It is smallish about 1 megs between the editor binary and supporting libraries, but the best is that it allows for scripting using S-Lang. So, for those that still want a small editor with scripting capabilities, Jed is a very good choice.

I think jed also ships with Slackware by default, so I'll check it out. As far as I'm concerned, the more emacsen I have, the less I have to drop into nano or...that other one... so I'm happy to have more choice.

Thanks!

In reply to by Papo Anaya

About programs not respecting $EDITOR: Have you tried setting VISUAL?
I find it works with some programs that ignore EDITOR.

Cheers!

I feel like I've tried setting VISUAL, as well, but I can't cite the data confidently, so I must not try it consistently when EDITOR fails. I'll try it, next time such a situation comes up (still won't use vim, though!). Thanks!

In reply to by Ricardo J. Barberis (not verified)

I don't like vi because it's a nuisance to have to keep switching modes.

I don't like emacs because it insists on reformatting my code in ways I don't like. Avoiding this would require either putting a comment at the top of each file to force text mode, or learning elisp, hunting down the configuration files, and reprogramming emacs to do what I want. It isn't worth the bother.

So I mostly use gedit, which doesn't have modes and just does what I tell it to. I only use emacs on rare occasions when I have to do search and replace operations that span multiple lines or require fancy regular expressions.

With a title like that I would expect an article about Vim, not Emacs. I think a more accurate title would reflect that it's a lightweight alternative to Emacs. Either way, it's still going to tie your fingers in knots compared to Vim. Vim users would most certainly not remove Vim in favor of an Emacs clone, no matter how small it is. :-P

I see what you mean, but it's useful to me as an alternative to vim. I use Emacs, as well; but for quick config edits, I often fallback on Jove. Familiar bindings, and no mucking about with Vim, which I find less friendly to the Dvorak keyboard layout, which I use.

In reply to by Idaho Joe (not verified)

It is great to see Jove is still alive and well. I remember sitting next to Jonathan in the computer lab back in high school when first created it and asking him about it. That was a looong time ago. :-)

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.