⬆️ ⬇️

Koans Vim

Master Woo Koo and developer under Wing Dy

No difference

Master Woo Koo and Markup Minion

Master Ve Koo and Master Yu Nix

No best tool

The Dream of Master Po U Pe

Best editor

Desperation of a slow learner

Vimscript comprehension

Dedication vim







Master Woo Koo and developer under Wing Dy



Master Ve Koo talked with some of his students learning the path of Vim. After his story about the 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 the second column of a text table across all rows containing the string 'tcp'?

')

Master Ve Koo said nothing, turned to the blackboard and wrote:



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


A whisper of approval passed among the seated.



“But I am engaged in the development of Win Dy ...”, the student began to speak confusedly.

Muste Ve Koo turned back to the board, erased the team and wrote:



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


“Wait! But it’s too difficult for such a simple task, ”cried the student.

Master Ve Koo again turned to the blackboard, erased the team and wrote:



 Microsoft Excel 


And the student, amazed, brightened.





No difference



One day a monk came to Master Ve Koo and asked: “How will my code be different when I comprehend Vim?”

Master Ve Koo replied: “Before Vim: to declare, define, process, print. After Vim: declare, define, process, print »





Master Woo Koo and Markup Minion



Markup Handler came to Master Ve Koo, wanting to show his plugin for Vim.



“Look, master,” he said, “I’ve almost completed macros for Vim that broadcast the markup in HTML. My functions are gracefully moving into each other, my parser is the perfection of efficiency, and the result is almost flawless. I will have the courage to say that I have comprehended Vimscript, and my work proves that Vim is a modern editor for enlightened developers! Did I do everything right ?! ”



Master Ve Koo read the sender code for a few minutes without saying a word. He then opened the markup document and typed:



 :%!markdown 


HTML instantly filled the buffer. The sender wept.





Master Ve Koo and Master Yu Nix



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



Master Ve Koo 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 Koo 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 Koo nodded.



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





No best tool



One night there was a strong storm and the house of Master Ve Koo was destroyed. The next morning, he began to build it again, taking out his old instrument. His new student volunteered to help him. The work went on, and the student decided to tell Master Wu Koo about his latest achievements.



“Master, I created a great script for Vim that collects all sorts of useful information about the document. He counts words, sentences, paragraphs, and also reports what kind of document this is, using syntax highlighting rules. I use it all the time when pipelining. He is beautiful and I am very proud of him. Truly, Vim is the best thing! ”



Master Ve Koo did not answer. Thinking that he unwittingly angry his teacher, the student fell silent and continued to work.



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



“Could you give me a hammer, teacher?”



Master Ve Koo filed a newbie hacksaw.



Suddenly, the student brightened.





The Dream of Master Po U Pe



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





Best editor



Master Ne Il and Master Vui Yat were famous for their knowledge of gaining the path of Vim, and traveling the country preaching.



One day, one of the students asked: “Master Ne Il speaks smoothly and evenly, his speech is rhythmic, and the emphasis is correct. And Master Vui Yat is full of enthusiasm, he then stops, then continues, his speech is quick and energetic, his soul overwhelms his stories. What is the best way to comprehend Vim? ”



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



Suddenly, several students brightened.





Desperation of a slow learner



Master Ve Koo was finishing his lunch when a student broke into his room and fell on his knees at the feet of the Master. Tears streamed down the student's face and he was in utter despair. Master Ve Koo put the pot and asked: "What upset you so much, 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 use of Vim! ”



"Why did you decide that?"



“I am your worst student. When I struggled with writing a simple macro, my comrades easily wrote recursive macros. When I tried to recall a regular expression for spaces, my fellow practitioners wrote tests of gigantic complexity in Vimscript. I’m getting too slow, I’m afraid that nothing will come of me - I’m disgraced.



Master Ve Koo stood up. “Come with me to the window,” he said.



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



“What do you see?” Asked Master Ve Koo. The student has been watching for a while:



“This young man uses Microsoft Excel to create a table. He puts the numbers in his hands in each cell. He doesn't even know how to use formulas. He makes capital letters by pressing Caps Lock, and then presses it again when everything is ready. He does everything so slowly! I do not understand how he can be so pleased? "



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



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





Vimscript comprehension



One student asked Master Ve Koo, “When will I realize that I have achieved perfection in Vimscript?”



Master Ve Koo replied: "If you never use it."





Dedication vim



The young student sought a meeting with Master Ve Koo to read his last work to him - a poem glorifying Vim. With eyes full of tears from 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 a while. After the tenth verse, he raised his hand: “Please, that's enough. Your poem is terrible. ”



The student is very angry.



“Master Ve Koo, undoubtedly, you are 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 in Vim,” said the Master. “But your size is not clear, your rhymes are weak, your metaphors are in disarray. You wrote a very bad poem using a very good tool. You are not a poet, and Vim will not make them for you, many of my students are not programmers and Vim will not help them in any way. ”



“Vim is eternally beautiful,” the poet protested, “He is worth making 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 vi nature, nano has vi nature, even notepad has vi nature. You yourself narrow your vision and do not develop independent, which means you could not grasp the true value of the subject of your poem. You must go. Come back when you comprehend Emacs. ”



The poet left, deeply ashamed. He never returned.

Source: https://habr.com/ru/post/176187/



All Articles