A macro written for the Unix text editor vi. The editor is so powerful that any general computing task can be performed (albeit slowly) by one of its macros; in fact, someone has coded a Turing machine as a vi macro, and I have written a macro which plays Conway's game of life. Slowly.

Those Everythingians who use vi for their writeups might find this macro useful for adding hardlinks:

:map v i[<control-v><escape>Ea]<control-v><escape><enter>
After typing the above from command mode (or doing something equivalent in your .exrc), hit v at the beginning of any word you want to hard-link to painlessly insert square brackets around it.
If you're new to vi or, more specifically, to vim and you're trying to learn how to create macros, it can be very frustrating trying to find a reference to macro programming in the documentation. Logically you might expect the command :help macros to work but in fact :help source is the key to it all.

This took me ages to find so I hope it helps somebody.

Log in or registerto write something here or to contact authors.