why vim
# hmm
Programmers are writers, it could be argued that we think more than we write. But at the end of the day, writing is how something becomes real. Writing at the speed of thought is ideal to get ideas out of our heads quickly, even when we’re just writing to chat, or to tweet.
If you agree with the statement above, we can talk about vim. What does it solve?
When we write on a computer, we glue our eyes to where the cursor is. It shows where the activity is. Normally, you control where it goes by typing something new, it follows the end of the new text. Or use the mouse to point and click where you want it to go. Wouldn’t it be great if you looked at where you want the cursor to go and then, it’s just there? I haven’t found anything that does that yet, but vim is close, you’re limited to how fast you can type.
Using the mouse feels like the normal thing to do. However, you want to avoid it if you’re optimizing for writing speed. Think about what the physical actions done to get to the mouse. Assuming you have proper finger placement, you have to move your hand away from the keyboard to the mouse or trackpad, then go back to your keyboard orienting your fingers back to their proper position. This takes time, if you try it now you might think it’s dumb to even consider this. This small amount of time adds up to a lot. When programming, you constantly move your cursor all around a file. Vim saves you from this by not relying on the mouse, you keep your hands on the keyboard.
# modes
How can it do this? How can you navigate just by using the keyboard? Vim has modes,
they reflect the modes you get into when writing. When you are thinking, reading, and
navigating, you are in Normal
mode. Actually writing, Insert
mode. Selecting text,
copy and paste, Visual
mode. And if you want to do something outside of the text file,
like saving/creating new files, Command
mode. You can get into these different modes
by pressing a key or a combination of keys.
Different modes give different meaning/function to your keys. This exact same
thing happens when you press the modifier keys: Shift
, Ctrl/Cmd
, and Alt
. On
Shift
mode, your keys output capital letters. On Normal
mode your keys control
the cursor and move around the file.
It’s better described in a demo, so watch this guy use vim.
If this hasn’t convinced you to try vim it’s okay, it took me a while to try it out too. If reaching for the mouse makes you hesitate and think about vim, I’m happy.
# install
You don’t have to install Vim the editor to try it out. Your vsc*de
should have a
plugin that implements vim motions. If you start being comfortable with the vim
motions, you can install the editor so you can do more with your sweet new muscle
memory. You can now say “I use vim btw”.
This is not a vim tutorial, it’s just an introduction and reasoning of why I use vim. I type
slow, I only started trying increase my typing speed around two years ago . My
average speed now is around 60 wpm on
monkeytype. When I used vsc*de
, I felt
very slow since I also kept moving my hand away from the keyboard to reach the
mouse. You might be faster than I am at typing, great! I envy you and I will keep
practicing. If you’re still using the mouse to code, you have room to be faster than
you are now!
Note that Vim is just a text editor, it doesn’t have autocomplete and a file tree out of
the box. You have to set it up and install some plugins to make it feel like vsc*de
.
Here’s some links to get you started on your vim journey:
- neovim - new/better descendant of vim
- theprimeagen - the fastest, smoothest vim user
- neovim ide setup - neovim maintainer’s guide
- nvim config distributions, if you don’t want to set it up yourself.
Or if all these are too intimidating, try helix. It has a lot of things built-in, so you don’t have to touch any config files, but do be aware that it has different key bindings than vim. They’re similar enough imo.