VI macros

VI is a texteditor. I use it for nearly all my text editing, as it is the only editor that I can rely on being available on all of the various machines I use. I learned a lot from pages like Vi Lovers Home Page, so perhaps others may learn from mine.

(I know that vim is better, but I actually prefer the single level undo/redo of vi, and I don't feel like depending on any extended facilities. I did also try out Elvis 2.1, and, while I really like its HTML and binary editing modes, it is getting too bulky for the smaller machines of mine)

For plain text editing, I have a set of mappings from Alt-key combinations to the national characters that I need, so I can stick with the US keyboard layout. (will probably only work in an xterm window)

For HTML editing, the national characters are mapped to the HTML-entity form between & and ;.
By embedding control characters in abbreviations, the start and ending tags can be generated simultaneously. (I tend to forget the closing quote '"', if I enter everything by hand)

.exrc for basic editing. Is always sourced.
html.exrc for use with HTML files.
vrml.exrc for use with VRML files.
The embedded escape and return characters in these files are likely to make a confusing display in the browser, so you may want to download them and read with vi instead.


With a tags file, similar to what ctags(1) produces, VI is capable of navigating in almost the same way as the browser. The names has to be sorted and unique within the scope of the tags file, however wide that is. (the entire tree could be navigated from one tags file)

Navigation with tags is done either by the :ta anchor command to jump to the definition of anchor from any cursor position or, by placing the cursor on a word identical to a tag, and hitting Ctrl-] to jump to the definition of that tag.

The following scripts can be used in sequence to accumulate tags for both VRML and HTML files.
( htags *.html ; htags */*.html ; ...; vrtags *.wrl ) | sort -d >tags
"vi/index.html" 90 lines, 3337 characters
Casper Maarbjerg,