1 min read

Scheme + Vi

For those of us who use Scheme and do not wish to use the Emacs editor, there are a few things that I do to make my editing experience better. Please note that I do not use the Vim editor, but nvi(1). Those of you using Vim will find Lisp features such as Syntax Highlighting and a Lisp editing mode with some interesting automatic indentation. On the other hand, some of us don't fancy Vim that much. This quick cheat sheet is for them.

Editing Commands to Know

This beauty lets me see if I have mismatched Parentheses.
} and {
Lets me jump over sets of Scheme definitions
< and >
Handles indentation and shifting. See >> and <<.

Some Settings to Make Life Easier

In order to make indentation work nicely, I like to

set sw=2

Which let's me work nicely with normal Scheme indentation. I also

set autoindent

So that I am not hitting the space bar quite as often as I have to. If you like to see the start of an expression that you have just closed with ) or ], you can use

set sm

which will flash the opening ( or [ (respectively) briefly for your convenience.

Some Shortcuts

When using something like autoindent and >>, you will be inserting tabs where you may not want them. While tabs are nice to work with when you can control the tabstopping and such, they are not so nice when sending the code to other people. To fix this, I set up an function key map to make it easy to sanatize my code for public consumption:

map #6 1,$s/	/        /g