Adding a little Cream to (g)Vim

499

Author: Scott Nesbitt

Even though I’m a die-hard Emacs user, there are times when I have to use the vi editor — specifically gVim, the graphical face of the popular vi clone Vim. Since I use gVim so infrequently, I don’t readily remember many of the editor’s basic commands. Either I muddle through or reach for my well-thumbed copy of the vi Editor Pocket Reference. That was until I discovered Cream. With Cream, gVim becomes an easy-to-use editor — so easy, in fact, you might not believe that you’re using vi.

Cream is a set of scripts and add-ons that sit on top of gVim. Cream doesn’t change the appearance of gVim, but it does change the way it behaves. You no longer need to remember or use the traditional colon followed by one or more letters to execute a command — for example, :w to save a file. Instead, you can use keystroke combinations that are common to many Linux and Windows text editors, such as Ctrl-C to copy text or Alt-F to open the File menu. Cream’s developers bill it as “a modern configuration of the Vim text editor.”

Getting Cream is easy. You can download the sources, as well as packages for Debian, Gentoo, Ubuntu, and FreeBSD, from the Cream Web site. A Windows installer is also available. Ubuntu users can get Cream using the Synaptic Package Manager, while users of Linspire and Freespire can install it via the CNR Service. If you use Debian, just run apt-get install cream at the command line.

Cream’s gVim menus – click to enlarge

Getting to work

You start Cream by either clicking the icon that was added to your menu (Applications -> Accessories in Ubuntu), or by typing cream at the command line or in your application launcher. If you’ve used gVim before, you’ll notice that, post-Cream, the menus have changed. As one friend of mine put it, “Cream un-techified Vim.” Gone are menus like Syntax and Buffers, which have been replaced by more user-friendly menus with names like Format, Settings, and Insert. You don’t have to dig as deeply through Cream’s menus to find the command that you’re looking for; those commands are just a couple of clicks away.

Cream retains just about all of Vim’s features, and it has a few interesting ones of its own. Some of the more useful are a tabbed interface (only available if you’re using Vim 7.0 or newer), the ability to quickly wrap or justify text, and a spelling checker. While version 7.0 of Vim has an on-the-fly spelling checker, that feature is missing from older versions of the editor — like the one I use, version 6.4.6. You can also switch between using Cream keystrokes and commands and those used by vi or Vim. That way, you get the best of both worlds, if you’re so inclined.

One aspect of Cream that I found a bit frustrating was not being able to use the handful of Vim extensions that I’d installed. For example, when I open a LaTeX document in gVim, the LaTeX extension displays three additional menus that help me edit and compile files — but not if I have Cream installed. I wasn’t able to find a way to get around this problem.

Files via Cream – click to enlarge

Using add-ons and plugins

Add-ons are functions that add extra flexibility to Cream. Cream comes with 20 add-ons, some of which you may find useful and others you can do without. With the add-ons, you can strip ASCII text from a binary file, convert a text file to HTML, sort lines, and reformat an email address so that it’s not vulnerable to harvesting by spammers. There’s also a slide generator add-on that can create an HTML-based slide show using images in a directory that you specify, and a built-in typing tutor for users who wants to improve their typing speed.

Cream also comes with some useful plugin utilities. One is the File Tree, which acts a lot like the Emacs Speedbar extension. Using the File Tree, I quickly navigate around my file system and open files without using the Open File dialog box. While I don’t find it incredibly useful, I know a couple of Cream aficionados who can’t live without the Calendar plugin, which embeds a calendar within the editor.

If you’re a long-time user of Vim and/or gVim, Cream probably isn’t for you. You’re undoubtedly familiar with many of Vim’s commands, and don’t need the assistance of a CUA-enabled editor. On the other hand, if you use gVim infrequently or want to take advantage of the power of Vim without learning the editor’s commands, then Cream is definitely worth a look.