Modes in Vim
You open Vim — and cannot understand why the cursor does not move when you hammer the arrows. Because Vim is not an editor. It is a machine with a gear shifter, and until you learn to shift modes, you will be standing in the middle of the road with the hood up.
Most editors are one big typewriter: you tap a key and get a character. Predictable, like a button in an elevator. Vim is built differently. It has several modes, and in each one the keys mean different things. This is not a whim but a brilliant economy: the same d in one mode is a command, in another it is just a letter. Two hundred grams of silicon replace half your keyboard for you.
Let us go through these states of consciousness one by one, so you stop poking at it like a blind kitten.
The main Vim modes
Normal Mode
This is the starting point. Vim launches and freezes here, like a processor on the reset vector. You are not typing — you are commanding. Movement, deletion, copying. The text tidies itself up if you know the opcodes.
Basic commands:
h,j,k,l— left, down, up, right. Yes, those same arrows, only under your hand. In a week you will forget the real ones exist somewhere and will reach forhjkleven in a browser.dd— wipe out the current line entirely. A guillotine without sentiment.yy— copy the line into the buffer.p— paste what you copied after the cursor.u— undo the last change. Undo is the only place where hope still lives.Ctrl-R— bring back what was undone. By the way, Vim's undo history is long, like a village memory.
Insert Mode
Here you finally become an ordinary human and just type text. Not for long. Because the longer you sit in Insert, the less of a hacker remains in you.
Entering insert mode:
i— insert before the cursor.I— at the beginning of the line.a— after the cursor.A— at the end of the line.o— a new line below, and straight into insert.O— a new line above.
Returning to normal mode:
Esc— back. The key you will press a million times. Calloused, like the knobs of an old oscilloscope.C-[— the same thing, if your pinky is tired of reaching.C-o— run one command and return to insert without leaving it. A strange but useful trick.
Видео «insert-mode» не найдено (урок не готов или slug неверный).
Visual Mode
Unlike with a mouse, here selection is not scribbling but a precise mathematical capture of a memory region. You set the boundaries and declare what to do with them. Three subtypes: character-wise, line-wise, and block-wise.
Entering visual mode:
v— ordinary visual (character-wise).V— line-wise. The most honest: lines in Vim are sacred.Ctrl-V— block-wise. This is where the magic starts: you edit a column of characters at once, as if cutting an even rectangle out of a sheet. Perfect for tables, alignment, comments.
Видео «visual-lines» не найдено (урок не готов или slug неверный).
Attention! Select mode (--Select--) — a relic from the world of ordinary editors. Here you can start typing and the selection simply disappears, like an overwritten byte. A lifebuoy for those who have not yet rebuilt their brain.
It is invoked with Ctrl-g.
Basic commands:
d— delete the selection.y— copy the selection.>— shift the selection right (by one tab at a time).<— shift it left.
Command Mode
This is a conversation with the editor directly, without intermediaries. Saving, quitting, searching, replacing — all here. The colon is like the C> prompt on an old monitor: waiting for a command.
Entering command mode:
:— enter a command./— search forward.?— search backward.
Basic commands:
:w— save the file. The most frequent set of characters in the world.:q— quit Vim.:wq— save and quit. A classic that people call "save-me-I'm-stuck".:e filename— open a file.:bd— close the current buffer.:split— split the window horizontally.:vsplit— split vertically. Two buffers side by side, like two processes on one core.
Видео «splits» не найдено (урок не готов или slug неверный).
Replace Mode
Here a new character is not inserted but sits exactly in the old one's place — byte for byte, with no address shift. In essence, direct memory editing. Useful when the data structure is sacred and you are not allowed to botch it with a list.
Entering replace mode:
R— replace mode.
Returning to normal mode:
Esc— back to ordinary life.
Conclusion
The trick is not that Vim is complicated, but that it is honest. It does not hide its design behind icons and pop-up menus — it dumps several modes on you and says: figure it out if you are a programmer and not a user. And when you stop resisting and start thinking like an editor, the same thing happens that always happens with hardware: you stop fighting it and start playing on it.
Offshoots of hjkl, grown into the subconscious. dd, flying faster than a mouse can twitch. This is no longer a habit — it is a reflex, like a sommelier who can tell a wine cellar from an apartment building by smell.
Master the modes — and Vim will stop being a mystery. And then one day you will catch yourself looking for : in someone else's notepad. And that will mean the silicon has accepted you.