SamWhited|blog

Looking Ahead — a portrait of the Appalachian Trail

The Dharma of Vi

After the dharma of Unix was made word in, the Tao of Programming, The Unix Power Classic, Rootless Root, and other such works, another manuscript was discovered. Lost for years, it was at last found in the vaults of the great museum of Delhi, and brought to light by one who had long practiced The Way. This document was different than the rest in that it dealt with the ways of Unix only insofar as they applied to the tools by the Patriarchs Joy and Moolenaar: Vi and Vim.

I have here attempted to translate this great work as best I can — being but a novice in The Way myself.


Master Vi and the Home Row

A novice came to Master Vi and asked to observe the master as he worked. As he watched, the novice learned much, but after a time he became uneasy. At last, he ventured: “Master, forgive my ignorance, but is it not the Vi way to use as concise an expression as possible to achieve the desired result?”

Master Vi nodded.

“Then Master,” the youth continued, “why have I seen you strike j thrice when you could have simply typed 3j and saved yourself a keystroke? Though it is but one key, did you yourself not say, ‘one drop of water is nothing, but many drops make up an ocean?’”

Master Vi replied: “The fisherman may find more fish in a distant sea, but unless he is starving he will choose not to undertake the journey and will remain near home.”

At that moment, the novice was enlightened.

Master Vi discourses on .vimrc

Once, as Master Vi gave public instruction, a rash Vim neophyte came before him and bowed three times. After he rose, he thanked Master Vi for showing him The Way, and bragged that by pairing the dharma of Vim with the teachings Gruber he was now able to create blog posts faster and more accurately than ever before; faster even, he thought, than Master Vi himself.

Master Vi nodded and said, “it is so, and yet, you are still a novice in the ways of Vim.”

The neophyte grew angry at these words, and said, “by your own tongue I am greater than you, and yet still you do not call me master?”

Master Vi nodded at one of his pupils who stood nearby watching this exchange, and the pupil stepped forward: “If you are truly greater than my master as you claim, then surely you would demonstrate your skill to a lowly novice?”

The neophyte agreed, and immediately began to write a Markdown document with great rapidity and skill using a plethora of customizations he had made to his .vimrc to make common tasks quicker. The neophyte, upon finishing, said, “surely I am faster even than the master?”

The novice nodded, and then began work on his own document. He was indeed slower than the neophyte, not possessing any of the neophytes customizations. The neophyte scoffed, but the novice said, “now, let us try again, but this time using the teachings of the Patriarchs Knuth and Lamport so that our documents will be both beautiful and portable.”

So they set to work again, this time writing a beautiful TeX document. Not having any of his customizations, which empowered him only when writing Markdown, the neophyte was much slower than the novice, and he struggled with the Vim Way.

“Again”, said the novice.

This time they wrote HTML, then they programmed in C, then in Lisp, then in Delphi. Again and again the novice was quicker. Finally, the neophyte exclaimed, “This is foolish, if I had only customized my Vim config for each markup or programming language we are using things would be different!”

At last, Master Vi spoke:

“With patience the man who knows how to use a snare may catch himself a hare, or a hog, or a grouse for dinner, even though the snare was not made for all these things. The man who shapes the snare to better catch only the rabbits foot will starve if no rabbit wanders by.”

On hearing this, the neophyte was enlightened.

Master Vi and the Emacs Enthusiast

One night, Master Vi sat down to table with a Stallmanite. The Stallmanite boasted loudly about how the wisdom of TECO had been imparted on him through the teachings of Steele, and the ramblings of Stallman. This dharma gave him great flexibility, customization, and power; he posited that he needed only one tool for any task.

Master Vi said, “Does a man not use his feet for walking, and his hands for throwing the spear? Only children and fools walk upon their hands.”

The Stallmanite conceded this point, but said also: “He who has a trident may spear a hog or a fish, but he who has only a spear will miss the fish”.

Master Vi replied, “He who wields the spear well may know that the fish is not where it appears to be, and use the lightness of the spear to skewer even a bird in flight.”

The Stallmanite replied: “And yet, the spear may shiver, and break, while the trident remain whole.”

“He who does not bend the spear to a task for which it was not designed will find that it does not splinter.”

“Aha!” Said the Stallmanite, “so you concede that there are tasks for which The Way of Vim have not prepared you?”

Master Vi nodded.

“The Way of Emacs has prepared me for all contingencies. Surely it is the greater way?”

Master Vi bowed his head, and for a long while remained still. Finally, after a great silence he said: “A carpenter stands in front of an incomplete wardrobe holding a folding knife with many attachments and tools. In his workshop are hammers, saws, and other jigs. Does he finish the wardrobe with only the knife so that he does not have to leave the house?”

Finally, the Stallmanite was enlightened.