How I Started Using Vim

5 minute read

I won’t talk on how to use Vim in this post, there are plenty of posts on the internet already talk about it, so I’m here talk about how I started using Vim when I was a developer who unable to type faster than 20wpm within ten fingers.

While learning to use Vim, I also learn to interact with the computer more efficiently. Years ago, I was using VSCode as the primary editor for Javascript and Golang. Someone used to think using a hardcore editor will make them faster or more efficient and then they learn Vim or Emacs with that hope then most of them give up after a few trials. If you were in this case, no worry, I’m here with you. I tried Vim two times before officially adopt it. Before that, I realized the main problem is not the editor, it is the way I interact with the computer was inefficient. I felt unconfident when someone was sitting nearby to pair with me cause I was afraid of the typo, slow typing, keep switching between mouse and keyboard too much. So I decided to learn how to interact with my computer efficiently first.

Touch typing is required.

I don’t know why touch typing is not the required subject at schools, I graduated from a Computer Science school, but I only focus on Computer Science related knowledge. After four working years, I still typing with 4 - 6 fingers within looking at the keyboard frequently. I took some research and found this website keybr then spent 30 minutes to 1 hour a day to practice. Everything was very hard at first, I was like a kid touching the keyboard for the first time, the hardest part is typing without looking at the keyboard. But the result makes me smile and have a good night every day. I’m fluent the touch typing now. I have increased the speed from 20wpm to 50wmp after 12 hours of training.

All Time Statistics Speed progress

I know there are many people already very good at typing, but I don’t count this here, compare to myself last year I’m significantly better, it makes me smile and have a good night too. A bit more about keybr.com, they have the algorithm to generate the next sentence makes it look like the real world sentence. Other websites may let you practice jjjjjj, kkkkkkk but you know it is not real world situation then it does not help you much.

Typing fast is less critical than typing accuracy.

As a Software Engineer, I spend more time to type the number, dot, comma, bracket, shift, control, cmd than the a-z keys. When I reached 50wpm, I realized I never need that speed while coding. I got the peak speed up to 80wpm, and I think it fast enough. I started to practice capital letters and punctuation letters, the typing speed decreased to ~40wpm, but I think it is enough to start using Vim.

Now it is adventure time

I tried many Vim applications like the default one of MacOS, MacVim, NeoVim, Vimr… I decided to go with NeoVim because the repo is very active with many developers contribute to, NeoVim can run smoothly on my iTerms2, I hate to switch context so that coding and testing in the same window are fantastic. Moreover, NeoVim now supports the virtual text, the plugin coc.vim were implementing virtual text to show the tooltip, it helps to read the function explanation easier with less interaction.

NeoVim with the virtual text

If you also start from scratch, here is my two cents:

  • Start with an empty .vimrc file, don’t copy from anyone.
  • Try to do almost everything in the original Vim’s way before installing any plugins.
  • Vim already optimizes the hotkey, try to not remap if it is not necessary. You will see the benefit of it if you often switching the computer, ssh to servers, the same muscle memory on any computer is awesome.
  • Don’t try this at home, yeah, many people try this at home only, and they gave up cause the next working day still require productive, so they need the previous editor for the faster speed and never reach the efficient level to genuinely using it. No pain no gain, you need to try Vim at both home and work, the productivity may decrease, and your boss will notice, but after that, both of you will smile because you are more productive. My dotfiles repo for reference: my dot file

Moreover, think in the Vim way

On this blog post Why Programmers Should Automate More you will see the expensive cost of the repeated tasks. Example these micro-tasks below take a few seconds and repeat 50 times a day:

  • Select a word
  • Jump to the start/end of a line
  • Select/Delete/Copy the code inside of the brackets {}, [], (), "", ''
  • Repeat the last edit action

Source: xkdc

Look at the chart above, how much is it going to take after a year of coding? Example 4 tasks above take a total of 5 seconds and repeat 50 times/day it is going to take a single day a year. Some repeated task takes more time than you think like select the exact code inside a pair of the bracket. Also, Vim with the philosophy which doesn’t let your hand leave the keyboard too often are here to help, the hotkey right there at your ten fingers, no need to move too far from the home row to use. You can type gg to go to the top of the document, G to bottom, 0 to the start of a line, $ to the end of a line and much more, no need to touch the mouse to scroll.

Vim at work

The most significant benefit of fluent Vim is that I can focus on the code without the struggle of moving the finger too far to the arrow keys or mouse to navigate around the code. Cause programming is a matter of thinking, not just typing, I don’t need to type very fast, only need the accuracy and efficiency.

Updated:

Comments