vi macros and tricks
In using the unix visual editor, vi, over the years, I've developed
a number of handy macros ("mappings") and other tricks.
One of them, in particular, makes an enormous range of tasks much
easier.
I first describe this, showing as examples how I use it
for sending e-mail and latexing files from within vi.
I then note a few others that involve no surprises, but
that I use constantly: one for moving text around within
a file, one local cursor-movement, and one for switching between files.
I also give three tricks (not based on a mapping): one for
checking for unmatched parentheses and brackets, one for
comparing the contents of the buffer with the file itself,
and one for making global commands search for patterns
relative to patterns relative to patterns.
csh aliases using the enscript command
to get small print (paper- and space-saving),
and modified format
If you download the above
file and source it in csh, you will have available
four variants of the standard "lpr" command for printing plain text.
Three of these print material in smaller-print multi-column format.
I added the fourth after a change in our department's setup
in 2007 changed
the appearance of the output of "lpr" (giving larger point-size
and no left margin); it restores the earlier behavior.
For details, see comments within the file.
a sed script that plays
"towers of Hanoi"
I wrote this in 1984 and put it on a newsgroup, and it has been
copied in a few places (12 Google results
as of this writing), but sometimes with lines broken in the process
of transmission, giving versions that
don't work.
How to use it is described in comment-lines within the file.
I have been told that some versions of sed do not allow comments;
if you use such a version, delete these lines
before running the script, but refer to the commented
version for instructions and explanations.