My Journey into Vim — Week 1: Learning the Basics


Introduction
As a developer who wants to get closer to Linux and the terminal, I decided to gradually shift from VS Code to Vim. Of course, I'm not making this switch overnight. Instead, I try to edit as many files as possible directly in the terminal, while still using my regular IDE for more complex tasks to avoid unnecessary frustration.
I also decided not to overwhelm myself by trying to learn everything at once. Vim has an enormous number of commands, shortcuts, and concepts, which can easily become overwhelming. To make the process more manageable, I’m learning Vim in small chunks — one core skill per week. This week, I focused on basic movement and essential editing commands.
Movement Basics — hjkl
The heart of Vim navigation lies in four keys: h, j, k, l.
h
moves the cursor left by one character.l
moves the cursor right by one character.j
moves the cursor down by one line.k
moves the cursor up by one line.
The goal is to master these movements to the point where they become muscle memory. Efficient navigation is the foundation of speed in Vim.
Moving by Words — w, b, e
While line-by-line movement is helpful, moving one character at a time is often too slow. That's where word-based navigation comes in.
w
jumps to the beginning of the next word.b
jumps to the beginning of the previous word.e
moves to the end of the current (or next) word.
These commands dramatically speed up horizontal navigation, especially in longer lines of code.
Deleting and Pasting — d and p
In Vim, deleting lines and text works a bit differently than in typical editors. For example, dd
deletes the entire current line — but it actually cuts it, meaning the text is saved to a register and can be pasted elsewhere using p
.
This cut-and-paste style editing feels more like a powerful text manipulation workflow, rather than just deleting content.
Combining Commands — Multipliers
To work faster, Vim allows combining commands with numbers to repeat them. For example:
10j
moves down 10 lines.5w
jumps forward by 5 words.d3w
deletes 3 words from the cursor's position.
This flexible system works with most movement commands, making bulk edits incredibly efficient.
Visual Mode — Selecting Text Like a Pro
Vim’s visual mode (triggered by v
) is your friend when you want to manually select text. Once in visual mode, you can move around and select content, then:
Press
y
to copy (yank).Press
d
to cut (delete).Press
p
to paste.
There’s also visual block mode, accessed with Ctrl+v
, which allows you to select rectangular blocks of text — useful for editing columns, aligning code, or commenting multiple lines at once.
Once a selection is made, you can apply most normal commands to the selected text, such as changing case, replacing content, or formatting.
Insert Mode — Entering Text
Vim is modal, meaning you need to explicitly enter insert mode to type like you would in a regular text editor. There are two primary ways to enter insert mode:
i
inserts text before the current cursor position.a
inserts text after the current cursor position.
This subtle difference — before vs after — might seem trivial at first, but it significantly impacts your flow when making edits. Knowing when to use i
versus a
helps avoid unnecessary cursor movements.
Escape — Returning to Normal Mode
The Esc key plays a crucial role in Vim. It returns you to normal mode, the "command center" where you can navigate, delete, copy, paste, and trigger all sorts of advanced commands.
Pressing Esc
:
Exits insert mode.
Cancels an incomplete command.
Resets visual selections.
Learning to "escape" quickly is vital to staying efficient in Vim.
Weekly Goal — Building Muscle Memory
My aim for this first week is to make these commands second nature. I want to reach the point where I use them instinctively, without thinking. To achieve this, I:
Edit as many files as possible using Vim.
Play Vim practice games (there are quite a few fun ones out there).
Once I feel confident with this core set, I’ll move on to more advanced commands and techniques in the following weeks.
What was your first week with Vim like? If you have tips or essential commands you think I should learn next, let me know in the comments!
Subscribe to my newsletter
Read articles from Przemysław Kozłowski directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
