Articles from June 2008

 
 

CVS Shortcuts in Vim

Vim is an incredibly flexible text editor. I continue to be surprised by the number of strange things it’s capable of doing. For example, there is a crude Tetris clone available for Vim.

A bit more useful, though, is the cvsmenu script for Vim. This is a fairly polished plug-in that will allow you to do all of the basic CVS tasks from inside your text editor. The supported CVS commands are: add, diff, commit, update, status, shortstatus, localstatus, and revertchanges.

Since the plug-in is poorly documented, I thought that I would take this opportunity to explain how to use it.

Installation

In Ubuntu, this is pretty simple.

% sudo aptitude install vim-scripts

% vim-addons install cvsmenu

This will install the package and enable the plugin for your user.

Usage

I will assume that you already have a versioned source tree checked out on your system. Start by opening a file in this tree. You can open a diff view by typing “,cd”. Note: that’s comma, C, D.

The local revision is shown on the right, the remote revision is on the left. This is a bit backwards from the Eclipse and Netbeans way of doing things. Typing CTRL+W+W will move your cursor between the two revisions. I haven’t found an easy way to move a change to the right, but I would be interested in reader comments.

Here is an index of the commands. They may be documentation somewhere but I was only able to find them by looking at the plug-in source code.

  • ,ca – Add
  • ,cd – Diff
  • ,ci – Commit
  • ,cu – Update
  • ,cs – Status
  • ,ch – Short Status
  • ,cc – Local Status
  • ,cv – Revert Local Changes. The odd thing about this is that it only updates the file on disk. It doesn’t actually revert the changes in the open editor.

Modern IDEs do ease the pain of performing mundane versioning tasks such as merging. But, this is a nice alternative to those heavy-weight tools.


Mmm, I am really impressed with NOVO coffee. Very good! Maybe it's just because I've been drinking the Folgers coffee at the office.

Just saved $290 by changing the damn radiator myself

Doh, I ran out of propane halfway through a brew session. That added an extra hour to an already long brew day.

Follow me on Twitter