dcsimg

Sweeten Your Vim with Cream

Frustrated by Vim? Confused about why some swear by it but you can't figure out how make simple edits? Cream can take the edge off Vim's learning curve.

It’s an eternal debate amongst Penguinistas: Emacs or Vim? Unfortunately, for most” normal” (i.e., non-geek) folks, this debate will never occur, since they will find Emacs or Vim way too complicated, strange, and, well… different. You’ve heard what these new users say when they meet Emacs or Vim:” Why doesn’t anything appear when I type? What’s up with these weird key combinations? I have to do what to save? Modes? What are modes? I hate this! Why can’t I just type and save like normal?!”

This is really too bad, since Vim has a tremendous amount of power, stability, and extensibility to offer users (Emacs… ahhh, not so much). But if users are scared or confused by the interface, they’ll never get to enjoy the good stuff that Vim has to offer. There has to be some way to ease users into Vim, some way to leverage the power of Vim while accommodating, or even overcoming, the steep learning curve. Fortunately, there is a solution: Cream.

In order to use Cream, you have to have Vim installed. In fact, the program called” Cream” is really a series of scripts that extend Vim, adding and changing key commands, providing new tools and features, and simplifying the way the program works overall.

It’s an added bonus that, because Cream is just Vim underneath, power users comfortable with Vim can still take advantage of their muscle memory and years of learning. And perhaps the nicest extra of all is that Cream is open source, free, and runs on Linux and Windows.

I’ll Take Some Cream, Please

Installing Cream couldn’t be easier. Users on Ubuntu and other Debian- derived distros can simply run sudo apt-get install cream, and a few moments later the program will be on their systems.

SUSE and other RPM- based distros can use YaST, YUM, or whatever system package manager the distro comes with to install Cream, as it is provided by virtually all major distros. If your distro doesn’t provide what you need, or if you’re running Windows, head over to the main Cream website where you can download a binary or source code.

Now that Cream is installed, start it up. If you’ve ever used Vim with a GUI before (most likely GTK+), you’ll notice that Cream looks on the surface just like Vim. However, once you start poking around the menus, or begin typing, you’ll immediately see that Cream has been carefully designed to make Vim more user-friendly and more like the text editors most people are used to.

Most obviously, the idea of modes is gone. If you’re used to pressing i or a to edit and Esc to enter commands, this may seem crazy… but then, Cream wasn’t created for you.

What else is different? Quite a bit, actually.

Common keyboard shortcuts. Cut is Ctrl-X, Copy is Ctrl-C, and Paste is Ctrl-V, just like almost every other editor out there. And that’s the point. Same thing for Ctrl-Z (Undo), Ctrl-Y (Redo), Ctrl-S (Save), and Ctrl-N (New).

Not everything is exactly the same as common text editors, however. Ctrl-F brings up a nice little Find window, but you use Ctrl-H for Replace, not Ctrl-R. Take a stroll through Cream’s menus, and you’ll find that you already know most of the key commands, since they come from the common user interface found in thousands of programs. As you can see in Figure 1, Vim with Cream sports a couple of new menus.



“Vim with Cream”

Format menu. A new menu- Format- contains within it a wealth of easy-to-use text-changing goodies. Want to quickly change the case of highlighted text to all-caps, lowercase, or headline? No problem. Need to delete any empty line in a file? How about toggle between wrapping and no wrapping? Got a hankering to convert tabs to spaces? It’s all there, easily accessible under Format.

Settings menu. Another new menu- Settings- also provides easy access to useful features. Within the Settings menu, users can toggle line numbers, word wrap, revealing invisibles, auto-indent, syntax highlighting, and much more. In addition, a sub-menu labeled Preferences makes it very easy to set the default font, enable a tabbed interface, allow middle-clicking to paste copied text, and, in a nod to Vim users who want to try out Cream while keeping their well-earned Vim knowledge in play, Expert Mode. Enable Expert Mode, and you suddenly have access to modes again, so you can run your favorite scripts and take advantage of all the commands you know and love.

Tools. Cream isn’t just about rearranging Vim to make it easier for novices to use; it’s also about adding new extensions that take the program in some surprising new directions as well. Most of these extensions can be found in the Tools menu.

Some items under tools are actually present in Vim, but made more visible in Cream, like spell check, macro recording and playback, folding, text completion, and diff. The last sub-menu under Tools, however, is Add-ons, and it is there that the more adventurous users should definitely venture.

Really, it has to be said: Add-ons contains some pretty cool tools. You can invert lines or strings. sort text and then uniq it (in other words, use the uniq command to sift out similar lines), or” encrypt” text using various methods, including h4xOr and Rot13. This may be acceptable for casual” encryption” – like hiding the Christmas gift list from the kids- but it’s not going to wash in any circumstance that requires real encryption.

A timestamp is available, and so is the ability to convert your text from ASCII to Hex, or vice-versa, or even to HTML (although the HTML it produces is nothing to write home about). You’ll discover many more. One quick way to get a good overview of the items in the Add-ons menu is to try the Add-ons Explore wizard.



The Add-Ons Explore Wizard

To get to this feature, go to Tools-> Add-ons Explore(Map/Unmap). You’ll see a dialog similar to Figure 2. Here you can get a description of the various add-ons, and even map the shortcut used to access the add-ons.

That’s just the beginning of Cream, and even those who are well-experienced with Vim may find something useful in the program. Install it, play with it, and maybe you’ll find out that it’s useful not just for text editor newbies, but for old hands as well.

Comments on "Sweeten Your Vim with Cream"

chriswong

FYI, Ctrl+H is Replace in Windows Notepad…

Reply
hhemken

You’re kidding, right?

If you like vim or emacs, then use them. They are notoriously powerful. If you like “conventional” GUI-based text editors, don’t waste your time with adaptations to vim or emacs. Use a starightforward, powerful, cross-platform, open-source editor like jedit (http://jedit.org/).

If you are the type of person that shuns vim or emacs, you are the type of person that will like jedit.

Reply
wpkzz666

I agree with hhemken. Let us note that vim:”emacs-mode” and emacs:”vim-mode”, altough they do exists, are jokes (big jokes by the way). But I find the idea of a vim:”windows-notepad-mode” really bad. But as a an experiment on this, or as an alternative to jedit, it may have some followers. But I hope it doesn’t get taken too seriously.

By the way, and to not to loose the humour here:
¡Larga vida a emacs!

Reply
spremolla

There is no thing I hate more than trying to edit something on a GUI editor and see my text full of “i” and “a” from my muscle memory as the author sad.
The main reason for using vi is the command mode, that can do some heavy magic on trained fingers. If that is not what you are after, the stick to kate or notepad.

I can’t let that las statement go by: VI FOR EVER !!!! ;-)

And don’t forget : Real programers code on hexa !!!!

LALO

Reply
bryanjrichard

And don’t forget : Real programers code on hexa !!!!

Clearly, you need an xkcd refresher. ;-)

Reply
sotirchenas

that is all fine, making the shortcuts uniform.

but what is the real reason that sysadmins learn vi? it exists in just about any *nix system. what is the point if one has to install cream on every solaris, AIX, linux box one can log in to, just to avoid remembering the yank command?

Reply
tonl

nedit at http://www.nedit.org/ is yet another GUI editor. Personally I wouldn’t use a frontend to vim or emacs.

Reply
maurosanchezd

I use a Windows desktop to manage my servers and I like edit my simple scripts with Notepad++ using a local drive mounted with Webdrive.

Reply
richzendy

Vim it’s ok for me, exactly like this

Reply
troglodyte

Does Microsoft Word and Notepad come with a Vim addon ;-)

I don’t see why anyone would use Vim with the cream addon. why not use pico instead. Or nano ?

Reply
markdean

OK, what sysadmin has X Windows running on their servers? If they are using Linux as their desktop, and we all are (with the exception of maurosanchezd), right? So I can see perhaps an occasional lapse in judgement in actually using the GUI, but seriously, when you need to edit a .conf file, don’t you do as I do, open a bash terminal and run your favorite console editor? I’m mean the thought never occurs to me to open a text file with the GUI editor or even navigate for files and directories with konqueror or nautilus…I must be a throw-back…hell, I still use mutt!:-)

But in all seriousness, and to add to sotirchenas’ comment, the real, real, reason why all *nix sysadmins *must* learn and stay at least current with the basics of vi, is that at some point, you’ll have to boot into a very minimal single user mode and you may only have vi. I’ve had that happen on several *nix systems over the years-and not every Unix has a nice full featured Knoppix CD to boot to…

And maurosanchezd:
I didn’t see a smiley face, so do you actually use a Windows desktop on purpose? To manage what, Windows? If so, I feel sorry for you…

Reply
kandagatla

I found Cream to be very un-user friendly to me.. Because I am a hardcore-vim user..
I felt like It’s just like notepad with possible options in regular vim.

rgrds
kandagatla

Reply
bilash.apece

i am agree with hhemken

Reply
duncan

where is all this stuff coming from? Too many windowz people are migrating to Linux.

Reply
blacklight01

Modes!! Holy crap I need modes!! Don\’t call it Vim if it doesn\’t distinguish command, insert, visual, visual line, visual block and select modes, if it is point-and-click oriented and if it has the same keybindings of Notepad! Call it Windows Notepad with an alternative GUI!

I don\’t think any true Vim user will ever consider the idea of using this stuff. And I don\’t even think any non-Vim user will use it, if not to feel cool and get his friends surprised when looking at a Vim GUI on his screen. The common user will keep on using gedit, kedit, Notepad++, or the editor he\’s been using for ages, since he has no reason to change. The power use will keep on using his heavily customized Vim with its powerful modes and years of learning and experience. So, what\’s the use of this stuff?

Reply

Xu Xiaoya you might care about this money, she said: Do not worry teachers, we must call a good single senior, this money will be reimbursed to Qiang got.

Reply

Thanks for the good writeup. It in fact used to be a leisure account it. Look advanced to more brought agreeable from you! However, how could we keep in touch?

Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>