Written 2025-12-22
I often find myself recommending Vim to my peers at Oregon State University. I have created this document as a reference to direct people to in order to help them discover and gain proficiency with Vim.
I have been actively using Vim for the past 4 years now. I use Vim pretty much any time I write text: coding, drafting emails, writing web pages for this blog, etc. Vim is an extremely powerful and feature-packed text editor developed to maximize efficiency of editing files. There is a notoriously steep learning curve, but for those of us that edit lots of text, the reward is immense. If you are a computer scientist or electrical engineer, you will edit plain text for the rest of your career, so it is worth learning a tool to edit plain text fast!
Many people I have spoken with haven't put much thought into the editor they use. Some pick the default editor provided to them, others choose an IDE with an intuitive interface. This allows for a comfortable editing experience, but sacrifices the ability to rapidly make complex changes. Manipulation is where Vim shines. These changes are often repetitive: rename all occurrences of a variable, indent each line a block of code, append a semicolon to several lines, etc. Where other editors only support changing text in one place at a time, Vim is designed around making multiple changes at the same time. And when only single changes need to be made, Vim's motions allow for lightning-fast movement throughout your files.
vim from your distribution's package manager
or compile from source.
For Mac or Windows, see Vim's official
download page.
So, how can you start learning this powerful tool?
Packaged alongside Vim, there's an
incredible resource: VimTutor.
To access the VimTutor on Linux, simply run vimtutor in your
terminal.
Mac and Windows should have similar functionality.
This teaches the basics of the editor, covering the fundamentals first so
that you can get up and running moving as fast as possible.
The estimated time to complete the tutorial is 30 minutes, but it may well
take longer.
There's a lot of information, so don't worry about getting everything right
away.
For now, focus on taking away the basics of file editing the Vim way.
Knowing the basics is great, but the only way to learn them is consistent
repetition.
My recommendation is to
switch your production work to Vim as soon as possible;
don't wait for some magic time when you feel comfortable with Vim and
ready, it won't happen.
Note that it will be very slow to start -- and this is fine.
By using Vim consistently, you'll develop muscle memory for the basics, and
an intuition for how it works.
You'll find things you know are possible but that you forget -- look these
up as they come arise in VimTutor, online, or in Vim's outstanding
help pages
(also available with :help).
Odds are, if you need to do something tedious while manipulating text,
someone else has too, and it is likely already solved by a feature within
Vim.
My recommended learning method is cyclic:
Improve at a pace you can handle without overwhelming yourself. Learn features gradually and as needed.
Here are a handful of mistakes I've either committed myself or have frequently watched others commit.
This one's a little tricky, and some might say overkill. We've all been using arrow keys and the mouse since first using a computer, but causes lots of unnecessary hand movement. Using HJKL for movement prevents this by keeping both your hands on the home row at all times, and makes editing a lot faster. This may seem pedantic, but it feels very nice once you get comfortable with it. This is a case where you simply need to trust the Vim developers. I too was reluctant to adopt HJKL for movement, but I'm very glad I did.
At first, it may appear that these commands were chosen at random. After all,
who ever heard of using l for right? But actually, there is a very good
reason for these choices: Moving the cursor is the most common thing you do in
an editor, and these keys are on the home row of your right hand. In other
words, these commands are placed where you can type them the fastest
(especially when you type with ten fingers).
Excerpt from Vim's help manual
:help hjkl
insert modeI see this one a lot with beginners. They learned how add text with insert mode, and from there treat it like a standard editor: moving around with arrow keys, using the backspace key to delete text, etc. This is fine, but it takes away all advantages of using Vim. Insert mode should be used exclusively for when you are actively typing new text. The rest of the time should be in normal mode -- it is called normal after all. Learning how to utilize the power of normal mode is one of the first big hurdles to achieving proficiency with Vim.
Here are some of my favorite tricks I like to use to speed up my workflow. I haven't included examples, but many can be found online.
:help :substitute
This is a big one.
I find that I often need to make the same change to many items scattered
around my file.
A simple command of the form :%s/<find>/<replace>/g
matches all instances of <find> and changes them to
<replace>.
What differentiates Vim's search and replace from others is that it uses
powerful pattern-matching with
regular expressions.
:help visual-block
Another super simple technique with many uses.
Visual block mode allows you to select text in a rectangle.
Sections of similar lines can be deleted simultaneously with d.
By pressing I or A, text can be added in bulk to
multiple lines at the same time.
.) command
:help single-repeat
The dot command is so simple, yet one of the most versatile commands Vim has to offer. Pressing the dot key in normal mode repeats the previously executed command. There are many uses to this, and it discussed at length in chapter 1 of Practical Vim.
:help windows
By default, Vim only shows one file on the screen at a time. Using windows, Vim can display multiple files at once.
<C-W> s (ctrl-w followed by s) splits the screen
horizontally.
<C-W> v splits the screen vertically.<C-W> c closes the active window.<C-W> followed by h, j, k, or l moves between
windows.
:help diff
Diff mode shows two files side-by-side and highlights the differences
between them.
Diff mode can be entered on the command line by launching Vim with
vim -d file1 file2, or inside Vim by running
vert diffsplit file2.
This allows for easy comparison of multiple related files and cherry-picking
specific parts of each file to keep and which to change.
For example, when creating this page, I ended up with two similar but
different HTML <head> sections.
Using diff mode, I was able to easily identify that I forgot to specify
charset="utf-8" and I was missing a <nav>
element for my GitHub.
With both files open and the differences highlighted, I was able to quickly
copy over the missing lines.
Many programmers often overlook Vim when selecting their editor. However, it is an extremely powerful tool for those of us that consistently edit plain text files. It has a steep learning curve, to be sure, but the benefit is immense. Vim is only as hard as you need it to be. Identify what you want to learn, then learn it gradually, just a few keybinds at a time. Get comfortable with those, then learn a few more. You'll be flying around files in no time.
Email me at first initial last name AT tutanota dot DE.