Jano's Vim Macro Page

[vi power] How to run a macro ? Load it with the :so macroname.vim command. From there all depends on the implementation of the macro. Simple entertaining macro's will often use the g (go) key to start things. With some macro's I have explained how they should be used. Macro's in the Documents & Languages section use a list of commands and abbreviations, you should examine the macro to find out how they work. If you have a nice macro for me to include on this page, please mail it to me. As of 6 November 1997 all the macros and syntax files will have the extension .vim. To save you time and work I have placed this whole page in one archive.

December 9, 1999Visual Patch
July 27, 1999Improved version of ruler
June 15, 1999New version of Englisch Speaking
May 5, 1999Grep Directory
March 25, 1999Folding

Toys & Entertainment
Arithmetic Game arith.vim Test your math skills with the one and only Vim Math Game. This macro uses a subfunction which is stored in arith2.vim. Be sure both are in the current directory, or change the location in the first file. It needs Vim 5 or later. This one is contributed by Nick Harvey.
Bouncing Ball ball.vim Very fun to watch this bouncing ball, please look at the fourth example. At first this looks just like the maze-solver. Too bad Vim hasn't got a fast input for two players or we could make a very nice squash game. Example environments : example1.bal, example2.bal, example3.bal & example4.bal
Conway's Game of Life life1.vim This macro really shows the power of Vi. It let's you enter a (rather small) initial life-pattern, and then plays Conway's Game of Life. Get some coffee first, because it has not got the blazing speed of XLife.
Maze Solver maze.vim Another powerful macro, which let you solve those annoying mazes. Here's a sample maze to try out and a program that produces easy to edit mazes.
Meta meta.vim Ever heard of a program that has as output its own source? Well this macros has its own source as output, just start a new file and hit g. This one is brought to you by Nick Harvey.
Polyglot Meta polyglot.vim Even more difficult then the Meta macro, this one not only prints itself, but it can be compiled with any gnu c-compiler. A Selfprint Vim macro that is a c-source is a crazy idea, but the when it is compiled, the program again prints itself. If this isn't mind-boggling. Another one brought to you by Nick Harvey.
Stereograms stereo.vim Send to me by Matthew Flint, this macro makes text stereograms from a pattern and a block of random characters. It's best to try the sample first. There's even a manual included.
Tic-Tac-Toe ttt.vim Bored ? Do a ctrl-w,n load in ttt and have a go against Vi. It's fun to play until you figure out how to win.
Tower of Hanoi hanoi.vim As far as I know this macro has been distributed with Vim since version 3.0. It's small and quite fast, fun to watch at, but absolutely useless.
Turing Machine tm.vim The ultimate macro, this gives you the power to do it all. My search has been long and has brought my phonebill to include astronomical figures. But I have prevailed. It even uses a beautiful notation too. Here is the readme and three examples abc.tm abc2.tm and updown.tm to get you on the way.
Universal Register Machine urm.vim This macro comes in handy for those small programming jobs ;) No seriously it shows that vim is able to compute all that is computable, within the capacity of your memory of course. Don't forget the readme and urm.example.

Documents & Languages
C c.vim Has a bunch of abbreviations for numerous statements. But more important it includes a very nice bracket trick. when entering an opening bracket, this macro automagically inserts the closing one for you. Never again the stupid phrase : '}' expected.
EngSpchk 1.08 engspchk.vim.gz This is a syntax file that, ones loaded, paints wrongly spelled english words in the error colour. It also deals with a temporary and persistent user dictionary. This one is not included in the archive as it is very big (400Kb zipped). It is maintained by Charles E. Campbell, Jr on this page.
Html menu html.vim To use this one be sure you have Vim version 5.0m, because it uses the menu commands to give you a large collection of ready to insert html commands. I favour this one over the following two because I no longer have to remember all the shortcuts. Don't forget the un-html.vim so you can cleanly remove the html menu when you don't need it.
Html 1 html1.vim Real people don't use special tools, they have Vi and for every job there is a macro. Well this macro is in fact a large collection of abbreviations, but looking at the html-syntax this could come in handy.
Html 2 html2.vim Not only a very good macro, but it's quite a handy html manual as well. All commands are listed in alphabetic order. even the html version for every command is included. I like this one better then the previous one.
LaTeX latex.vim A very long list of abreviations that replace those long and often used LaTeX commands. Added bonus are some handy block macro's and a couple of lines that invoke programs such as dvips and ghostview.
Modula 2 modula2.vim Another bunch of abreviations, this time for programming in Modula-2.
Morse Code morse.vim For those who still have a need for morse code, this macro turns your keyboard into an instant morse-code-generator.
Shell Scripts shell.vim With this macro and a version of Vim compiled with X11 interface enabled you can write scripts for you're shell without having too look up every option in the manual files. Please note with shell I mean the basic Unix shell and not the Csh or Tcsh shell.

Executer executer.vim When editing enter @! after an command and this macro will run the command and include the output from it on the very same line.
File Manager browser.vim By far my favourite. It's a full featured file-browser with builtin file-manager. It pops up in a separate window if you do _ls. Even features file-tagging and user-confirmation. I have this one loaded standard in my vimrc.
Grep Directory grepu.vim Scans the current directory for the word under the cursor or for a word you have entered. It then presents you with a list of occurences from which you can immediately jump to the file and line. You need array.vim as well. Windows users should use this version and make sure they have Grep.exe installed: grepw.vim. Contributed by Jos van Riswick.
Folding fold.vim Very interesting macro making it possible to fold multiple parts of a text. These are stored in a file in a special directory. You can unfold, refold and clear folds at any time. Also uses coloring for the folds. Contributed by Jos van Riswick with a manual and key reference in the header.
Left Handed Mouse leftmous.vim Bought a lefthanded-mouse and discovered Vi does not support it? Fix this terrible bug with this handy macro.
Marker Ring markring.vim Small but helpful macro, which let's you define marks by pressing -. You can then jump between these marks by pressing =.
Numbered List numbered.vim Feel the need to create numbered lists ? Load this macro, place the cursor on the first item of your unsorted list. Now do a <number>@i. And presto a sorted list has been created.
Rot13 Encoding rot13.vim When a document is rot13-encoded it means that every letter is replaced with the letter 13 places further in the alphabet (wrapped around). To decode it you can use the same algorithm. When this macro is loaded typing gr will encode/decode the complete file.
Ruler ruler.vim Ever had the need for a ruler when editing text, I mean one better then just the column information Vim gives you. Press @r for an instant ruler.
Ruler 2 ruler2.vim A more intelligent ruler that checks the size of the window and makes a ruler of that width. Press @r for an instant ruler. Contributed by Mark Ping.
Vi-mail vi-mail.vim Load your mailbox directly into Vim and use some special keys to manipulate it, send replies, or even mail some new mail. The keys you need to memorise, there are six, are all in the first lines of the macro. Another macro made by Dave Brown.
Vish vish.vim Have your own shell within a window of Vim. Load this supermacro and do a :vish, as soon as you hit enter an additional window is opened with a prompt in it. Be careful with what you type in there because it is as powerful as a real shell. Authors are Nick Harvey and Matt Corks.
Visual Patch visual_patch.vim This fixes the irregular behavior whenever you try to do operations on a visual block selected with ctrl-v. Select a visual block and run the macro :B s/x/y/g to change all x's in y.'s. Taken from the Vim mailing list and posted by Stefan Roemer.
Wordlist wordlist.vim This is a list of abbreviations of often misspelled words, it originally belongs to MS Word 7, but it has been ripped and improved by the author Matt Corks. There are some strange additions at the end of the list which you probably want to remove.

Syntax highlighting
Modula 3 modula3.vim This file gives you the opportunity to highlight your Modula 3 code, but be sure to use Vim version 5.0g or higher or it will not work. The author of this file is Matt Corks, he also made the wordlist available.

Valid HTML 4.0! [Home]

Last modified on December 9th, 1999
Copyright © 1998 J.I. van Hemert