Koans Vim

Published on April 10, 2013

Koans Vim

Original author: Tom Ryder
  • Transfer
Master Ve Ku and the developer for Vin Dy
No difference
Master Ve Ku Ku and the servant of the Markup
Master Ve Ku and Master Yu Nix
There is no better tool
Master Po Po Pe's dream The
best editor
Despair of a slow student
Comprehension Vimscript
Devotion Vim



Master Ve Ku and developer under Vin Dy


Master Ve Ku talked with some of his students studying the Vim path. After his account of the plural nature of Vim, he asked if anyone had any questions. The young student raised his hand:

“Master, what does it mean to be able to filter out the second column of the text table for all rows containing the string 'tcp'?

Master Ve Ku said nothing, turned to the board and wrote:

:%!awk '/tcp/ {print $2}'

A whisper of approval passed among those seated.

“But I'm developing for Vin Dy ...”, the student began to speak inconsistently.
Masthe Ve Ku turned back to the board, erased the command and wrote:

:v/tcp/d
:g/tcp/s/\S\+\s\+\(\S\+\)\s.*/\1/

“Wait! But this is too difficult for such a simple task, ”cried the student.
Master Ve Ku turned back to the board, erased the command and wrote:

Microsoft Excel

And the student, struck, brightened.


No difference


Once a monk came to Master Ve Ku and asked: “How will my code differ when I comprehend Vim?”
Master Ve Ku replied: “Before Vim: declare, define, process, print. After Vim: declare, define, process, print »


Master Ve Ku and the Servant of Markup


Markup Servant came to Master Ve Ku, wanting to show his plugin for Vim.

“Look, master,” he said, “I have almost completed the macros for Vim that translate Markup into HTML. My functions gracefully blend into each other, my parser is perfection of efficiency, and the result is almost perfect. I will have the courage to say that I comprehended Vimscript, and my work proves that Vim is a modern editor for enlightened developers! Have I done everything right ?! ”

Master Ve Ku read the servant’s code for several minutes without saying a word. Then he opened the markup document and typed:

:%!markdown

HTML instantly populated the buffer. The attendant burst into tears.


Master Ve Ku and Master Yu Nix


Old master Yu Nix came to master Ve Ku. “I'm worried, Ve Ku. You teach the Vim ways. But only vi is sacred, and vim is not; its code is clumsy, its functions overwhelm memory; its binaries are huge; his behavior is unpredictable. This is not a Unix way. I think you force your students to follow the wrong path. What can be done? ”

Master Ve Ku nodded. “You're right,” he said, “Vim is wrong. Let's fix it. Let's start? ”

Old Master Yu Nix agreed, launched the shell and printed:

$ vi vim.c

And he began to write code. Master Ve Ku watched him for a while, and then asked: “What implementation of vi do you use? Nvi? Vim? Elvis?

“I don’t know,” said Master Yu Nix, “There is no difference.”

Master Ve Ku nodded.

Master Yu Nix froze for a moment, and then left without saving.


No best tool


One night a severe storm occurred and the house of Master Ve Ku was destroyed. The next morning, he began to erect it again, taking out his old instrument. His new student volunteered to help him. Work argued, and the student decided to tell Master Ve Ku about his latest achievements.

“Master, I created a wonderful script for Vim that collects all kinds of useful information about the document. It counts words, sentences, paragraphs, and also reports what kind of document it is using syntax highlighting rules. I use it constantly for conveyor processing. He is beautiful and I am very proud of him. Verily, Vim is the best thing! ”

Master Ve Ku said nothing. Thinking that he involuntarily angered his teacher, the student became quiet and continued to work.

The student put two wooden blocks on top of each other and set a nail to hammer it into a tree, but he caught on, noticing that he did not reach the hammer.

“Could you give me the hammer, teacher?”

Master Ve Ku handed the hacker a beginner.

Suddenly, the student became enlightened.


Dream Masters Po Wu Pe


Master Po Woo Pa once dreamed that he used Emacs. When he woke up, he exclaimed: “I don’t know - I’m Tim Pope, who thinks he is using Emacs or an Emacs user who thinks he is Tim Pope!”


Best editor


Master Ne Il and Master Wui Yat were famous for their knowledge of finding the Vim path, and traveled around the country preaching.

Once, one of the students asked: “Master Ne Il speaks smoothly and evenly, his speech is rhythmic, and the stress is correct. And Master Wui Yat is full of enthusiasm, he stops, continues, his speech is fast and energetic, his soul overwhelms his stories. What is the best way to understand Vim? ”

Master Ne Il and Master Wui Yat answered simultaneously:“ Which editor is better: vi or ex? ”

Suddenly, several students became enlightened.


The despair of a slow student


Master Ve Ku finished his lunch when a student burst into his room and fell to his knees at the Master’s feet. Tears flowed down the student's face and he was in complete despair. Master Ve Ku put down the pot and asked: “What made you so upset, oh young student?”

“Teacher,” he said, “I give up. I will never comprehend the skills of Vim! I will never be able to comprehend the paths of great ancestors! I never realize the harsh simplicity and divine emptiness of the perfect application of Vim! "

" Why did you decide that? "

“I am your worst student. When I struggled with writing the simplest macro, my companions easily wrote recursive macros. When I tried to recall the regex for spaces, my fellow practitioners wrote tests of gigantic complexity in Vimscript. Everything is working out too slowly for me, I'm afraid that nothing will work out for me - I am disgraced.

Master Ve Ku got up. “Come with me to the window,” he said.

The student got up from the floor, followed Master Ve Ku to the window and looked at the neighboring house that was across the street. Through the window they saw together a young man in a suit and tie working on a document.

“What do you see?” Asked Master Ve Ku. The student watched for a while:

“This young man uses Microsoft Excel to create a table. He puts numbers with his hands in each cell. He doesn't even know how to use formulas. He capitalizes by pressing Caps Lock, and then presses it again when everything is ready. He’s doing it so slowly! I don’t understand how he can be so pleased? ”

“ Looking at this young man, what are you not satisfied with? ”, Master Ve Ku returned to the conversation.

And the student immediately reached enlightenment. His name was Ku A and later he became one of the great Masters.


Understanding Vimscript


One of the students asked Master Ve Ku, “When will I understand that I have reached perfection in Vimscript?”

Master Ve Ku said: “If you will never use it.”


Vim Dedication


The young student sought a meeting with Master Ve Ku to read his latest work to him - a poem glorifying Vim. With eyes full of tears of excitement, he read his heartfelt words, pouring out his soul and reverence in honor of his text editor.

The master sat and listened to the poet for some time. After the tenth verse, he raised his hand: “Please stop. Your poem is terrible. "

The student was very angry.

“Master Ve Ku, you are undoubtedly the best of all people who could appreciate this poem, because you know all the great beauty of the editor. How can you be so rude and dismissive? I even wrote this poem in Vim! ”

“You wrote it on Vim,” the Master said. “But your size is fuzzy, your rhymes are weak, your metaphors are in a mess. You wrote a very bad poem using a very good tool. You are not a poet, and Vim will not make you them, many of my students are not programmers and Vim will not help them in any way. ”

“Vim is eternally beautiful,” the poet protested, “It’s worth it to compose verses about him.”

“Vim is not permanent. Nvi is not permanent. Vi itself is not constant, only the nature of vi is constant. Emacs has nature vi, nano has nature vi, even in notepad has nature vi. You yourself narrow your vision and do not develop independent, which means that you could not grasp the true value of the subject of your poem. You have to leave. You will be back when you comprehend Emacs. ”

The poet left, deeply ashamed. He never returned.