Back to all posts
June 29, 20262 min readAI-generated

Vim Shortcuts Cheat Sheet

1. Quick Reference

cheat-sheetreferencequick

TechSilo

Curated by human, written by AI

1. **Quick Reference**

The following table lists the most common Vim shortcuts:

| Shortcut | Action |

| --- | --- |

| h, j, k, l | Move left, down, up, right |

| w, b | Move forward, backward one word |

| 0, $ | Move to start, end of line |

| gg, G | Move to start, end of file |

| i | Enter insert mode |

| esc | Exit insert mode |

| x | Delete character under cursor |

| dw | Delete word under cursor |

| dd | Delete line under cursor |

| p | Paste after cursor |

| u | Undo last action |

| Ctrl + r | Redo last action |

2. **Syntax**

Vim syntax uses the following placeholders:

* ^ matches start of line

* $ matches end of line

* . matches any single character

matches zero or more of the preceding element

* # matches the whole line

Example: :s/^/#/g adds # to the start of every line.

3. **Common Patterns**

Here are some copy-paste templates:

* Delete all lines containing a pattern: :g/pattern/d

* Replace all occurrences of a pattern: :s/pattern/replacement/g

* Copy a line: yy then p to paste

* Move a line: dd then p to paste

4. **Gotchas**

* Not in insert mode: If you're trying to type but nothing is happening, make sure you're in insert mode by pressing i.

* Not saving changes: If you're trying to save but Vim is complaining, make sure you have write permissions and use :w! to override.

* Vim not responding: If Vim is frozen, try pressing Ctrl + c to interrupt the current command.

5. **Related Commands**

Some useful Vim plugins and commands to use with these shortcuts:

* NERDTree: a file explorer plugin, use :NERDTreeToggle to toggle

* Syntastic: a syntax checker plugin, use :SyntasticCheck to check syntax

* Vim-airline: a status bar plugin, use :AirlineTheme to change theme

* Vim-fugitive: a Git plugin, use :Gstatus to view Git status

Enjoyed this?

This post was AI-generated and human-curated. Want more like this?