The Deity of Editors - Vim

Erhua Li / 2023-08-08


Today is the beginning of autumn. Ha ha (my little cat) was particularly intimate with me tonight, licking my face and neck. As my sleep was somewhat shallow, I got up and wrote this piece on the dining table downstairs (2023-08-08 02:15:00).

On August 6th, I posted my first WeChat Moment of the year, commemorating the passing of Vim’s creator, Bram Moolenaar. Vim is not just an editor for me, but a philosophy and a workflow.

There are only three types of programmers in the world: those who use Vim, those who use Emacs, and those who use something else. I belong to the first group.

I am completely unable to write code without the Vim mode. The philosophy of Vim has been deeply integrated into my workflow. The text I am writing now is actually in Vim mode within VS Code.

To make it more comfortable to use, I have remapped the Caps Lock key near the letter “A” to function as an Esc key when pressed alone, and as a Ctrl key when pressed together with other keys, using Karabiner.

Now, the Caps Lock key is the most worn key on my keyboard because Esc and Ctrl are important auxiliary keys in the Vim workflow.

Most modern IDEs support Vim mode. Vim is an essential plugin in my Jetbrains toolbox. The first feature I look for in note-taking tools is whether they support Vim. Previously, I introduced the note-taking tools I have used, from Quiver to the combination of Quiver and Obsidian which now serve as my main note-taking platforms. They were selected because of their excellent support for Vim.

I still remember the first time I encountered Vim. It was with my mentor at my first job, Linlin. I saw him coding in PyCharm as if he was dancing, swiftly deleting words, deleting entire lines, and even performing various quick and accurate replacements without having to select a paragraph and then manipulate its contents. I was fascinated by this.

“Practice makes perfect.” In the beginning, I forced myself not to switch back to normal mode and to write code only in Vim mode because I knew that I could only master it quickly by using it in specific environments.

At first, I found that the efficiency of writing code was greatly reduced. But I never once thought of switching back to normal mode, even during the process of debugging and preparing for deployment. So, from the beginning, I had to consult the documentation for every feature, and the speed of writing code became very slow. However, after about half a month, I became very proficient in the basic features. By then, I could already feel that the speed of writing and refactoring code had greatly improved, especially during the process of writing code and then refactoring it. Vim made everything so convenient and fast. Since then, Vim has become an indispensable tool for me in coding. Even now, I can only work quickly and efficiently on my own customized computer because it is only on computers where I have configured various keyboard mappings that I can fully unleash the power of Vim.

With a solid foundation in Vim operations, I can handle most scenarios. But I wanted to delve deeper into this tool. So, during the Chinese New Year holiday that year, I went through the book “Practical Vim,” which is the best Vim book I have ever read. I studied it chapter by chapter. Afterward, I found that my proficiency in Vim had greatly improved. Many of the Vim workflows and concepts introduced in the book still have a profound influence on me to this day. That’s why this book often holds the top spot on my iBook list. I frequently refer to it, as it continues to provide me with many solutions for text editing.

In the meantime, I also experimented with exclusively using Vim for project code processing and with Spacemacs (an Emacs distribution that incorporates Vim concepts – appealing to those who are undecided between Vim and Emacs). With the assistance of various plugins, I found that it had already caught up and even surpassed paid IDEs in many aspects. However, later on, I realized that IDEs have more advantages in terms of code review. So, I switched back to using Vim plugins within IDEs. Nevertheless, the exploration of different tools has brought me a lot of joy, reminiscent of the feeling of playing with many toys when I was a child.

Thanks to Bram Moolenaar for bringing us the deity of editors, Vim, which allows me to write code with more joy and abandon. R.I.P.

Written on 2023-08-08 03:11:00 536A.