Vim Keyboard Shortcuts
Vim is a genuinely different paradigm from every other tool on this list — rather than a handful of shortcuts layered on top of normal typing, the entire editor is built around modes, where the same keys mean completely different things depending on whether you're in Normal, Insert, or Visual mode. This makes a flat list of 'shortcuts' slightly misleading without understanding mode context first, so the entries below are grouped by the mode they apply in along with what mode you need to be in to use them. Vim's bindings are identical across Windows, Mac, and Linux since the editor's core keymap isn't OS-dependent the way GUI application shortcuts are — there's no Ctrl/Cmd modifier swap here because Vim's commands are built from plain letter keys in Normal mode rather than modifier combinations.
Normal Mode Movement
| Action | Windows | Mac | Description |
|---|---|---|---|
| Enter Insert mode | i | i | Leaves Normal mode behind and enters Insert mode exactly at the cursor, the one mode where keystrokes become literal typed characters instead of commands — the closely related 'a' key does the same thing but inserts just after the cursor rather than before it. |
| Return to Normal mode | Esc | Esc | Exits Insert or Visual mode back to Normal mode, the default mode where movement and command keys take on their special meanings rather than typing literal characters. |
| Move cursor (left/down/up/right) | h / j / k / l | h / j / k / l | The classic Vim movement keys, designed to keep your hands on the home row rather than reaching for arrow keys — h and l move left/right, j and k move down/up. |
| Jump forward/backward by word | w / b | w / b | The w key hops the cursor to the beginning of the next word and b hops it back to the start of the previous one, a pair of complementary jumps that cover ground far quicker than walking the cursor one character at a time. |
| Go to line start / end | 0 / $ | 0 / $ | Jumps the cursor to the very first column of the current line with 0, or the last character with $, the Vim equivalent of Home/End. |
| Search forward for a pattern | /pattern then Enter | /pattern then Enter | Searches forward through the buffer for the typed pattern from Normal mode, with n jumping to the next match and N jumping to the previous one once a search has been run. |
Editing Commands
| Action | Windows | Mac | Description |
|---|---|---|---|
| Delete current line | dd | dd | Wipes out the current line entirely while saving it to the unnamed register first, functioning as a cut rather than a permanent delete since a follow-up p immediately restores it just below wherever the cursor now sits. |
| Copy (yank) current line | yy | yy | Copies the current line into the unnamed register without deleting it, Vim's term for what most editors call copy, ready to be pasted elsewhere with p. |
| Paste after cursor | p | p | Pastes the contents of the unnamed register after the current cursor position or line, depending on whether the yanked content was characterwise or linewise. |
| Undo | u | u | Reverts the last change made in Normal mode, with Vim maintaining a deep, branching undo tree rather than a simple linear history in more advanced configurations. |
| Save and quit | :wq then Enter | :wq then Enter | A Command-line mode instruction (triggered by typing : from Normal mode) that writes the current buffer to disk and closes the editor, among the first commands most new Vim users are taught specifically because quitting Vim otherwise famously confuses newcomers. |
| Find and replace across the buffer | :%s/old/new/g then Enter | :%s/old/new/g then Enter | Runs a substitute command across every line in the buffer, replacing every occurrence of the first pattern with the second, a Command-line mode instruction rather than a Normal-mode key combination. |
Visual Mode
| Action | Windows | Mac | Description |
|---|---|---|---|
| Enter Visual mode (character selection) | v | v | Switches into Visual mode, letting you extend a character-wise selection using the normal movement keys before applying an operation like delete or yank to the selected range. |
| Enter Visual Line mode | Shift+V | Shift+V | Switches into Visual Line mode, selecting whole lines at a time as you move the cursor rather than individual characters, useful for operations affecting entire lines like indenting or deleting a block. |
Frequently Asked Questions
Why does typing in Vim sometimes just trigger commands instead of inserting text?
Vim starts in Normal mode by default, where keys are interpreted as commands rather than literal text input — pressing 'i' first to enter Insert mode is required before typed characters actually appear as text in the document, and forgetting that mode-switch step is the number one reason first-time Vim users end up with garbled text or an editor that seems to be ignoring their keyboard entirely.
Is it true Vim shortcuts are the same on every operating system?
Yes, essentially — because Vim's command set is built from plain key presses interpreted by the editor's own modal logic rather than OS-level modifier combinations, the same hjkl, dd, yy, and colon-commands work identically whether you're on Linux, Mac Terminal, or a Windows port like gVim, with no Ctrl/Cmd substitution needed for these core bindings.
How do I actually exit Vim if :wq doesn't seem to work?
If there are unsaved changes you don't want to keep, :q! forces quitting without saving; if :wq fails because the file is read-only or you lack write permission, :w !sudo tee % (in Unix-like systems) is a common workaround to save with elevated permissions before quitting normally — but the core lesson is that Esc to return to Normal mode before typing any colon-command is essential, since colon-commands typed while still in Insert mode just get inserted as literal text instead of executing.
Can I undo multiple changes at once, and how far back does undo history go?
Pressing u repeatedly steps back through Vim's full undo tree one change at a time, and prefixing it with a number (5u, for instance) undoes that many changes in one press. Undo history persists for the entire editing session by default and, with the undofile option enabled in your config, even survives closing and reopening the same file, which is a genuinely useful safety net most new users don't discover until well after they could have used it.
Is there a way to record and replay a sequence of edits automatically?
Macros handle exactly this — pressing q followed by a register letter (qa, for example) starts recording every keystroke until you press q again to stop, and @a replays that recorded sequence once, while 10@a replays it ten times in a row. This is enormously useful for repetitive line-by-line edits across a file, like reformatting fifty lines the same way, since recording the transformation once and replaying it is dramatically faster than manually repeating the same edit by hand fifty separate times.
How do I search for text and jump between matches without leaving the keyboard?
Typing a forward slash followed by the search term and pressing Enter searches forward from the cursor; pressing n afterward jumps to the next match and N jumps to the previous one, letting you cycle through every occurrence of a pattern in a file without ever touching the mouse or a separate find dialog.