Last updated: April 12, 2026
Vim Commands Cheatsheet
Quick Answer
Vim has two main modes: Normal (for navigation/commands) and Insert (for typing). Press i to enter Insert mode, Esc to return to Normal mode. :w saves, :q quits, :wq saves and quits. This cheatsheet covers 25 essential commands.
Mode Switching
| Command | Description |
|---|---|
| i | Enter Insert mode before cursor |
| a | Enter Insert mode after cursor |
| o | Open new line below and enter Insert mode |
| O | Open new line above and enter Insert mode |
| Esc | Return to Normal mode from any mode |
| v | Enter Visual mode (character selection) |
| V | Enter Visual Line mode (line selection) |
Navigation
| Command | Description |
|---|---|
| h, j, k, l | Move left, down, up, right |
| w | Move forward one word |
| b | Move backward one word |
| gg | Go to first line of file |
| G | Go to last line of file |
| 0 / $ | Move to start / end of line |
Editing
| Command | Description |
|---|---|
| dd | Delete (cut) current line |
| yy | Yank (copy) current line |
| p | Paste after cursor |
| P | Paste before cursor |
| x | Delete character under cursor |
| u | Undo last change |
| Ctrl+r | Redo (undo the undo) |
Search
| Command | Description |
|---|---|
| /<pattern> | Search forward for pattern /function searches for "function" |
| n / N | Go to next / previous search match |
| :%s/old/new/g | Replace all occurrences in the file :%s/foo/bar/g replaces all "foo" with "bar" |
File Operations
| Command | Description |
|---|---|
| :w | Save (write) the file |
| :q / :q! | Quit / force quit without saving |
Frequently Asked Questions
More Cheatsheets
Git Commands Cheatsheet
This cheatsheet covers the 40 most essential Git commands grouped by workflow: setup, staging, branc...
Docker Commands Cheatsheet
This cheatsheet covers 35 essential Docker commands for managing containers, images, volumes, and ne...
Linux Commands Cheatsheet
This cheatsheet covers 40 essential Linux/Unix commands for daily development: file navigation, text...
HTTP Status Codes Cheatsheet
HTTP status codes are 3-digit numbers returned by servers. 1xx = informational, 2xx = success, 3xx =...