Module Review: Vim Grammar
[!NOTE] This module explores the core principles of Module Review: Vim Grammar, deriving solutions from first principles and hardware constraints to build world-class, production-ready expertise.
1. Key Takeaways
- Vim is a Language: Edit by combining Operators (Verbs) and Motions (Nouns).
- The Formula:
Operator + Motion = Action(e.g.,d+w=dw). - Precision Matters: Use Text Objects (
ifor inner,afor around) to edit semantic blocks like quotes"and braces{. - The Dot Command: The
.key repeats the last change. Structure your edits (e.g., useAinstead of$a) to make them repeatable. - Efficiency: Don’t repeat yourself. If you do something twice, find a way to do it once and repeat it.
2. Cheat Sheet
| Category | Key | Name | Description |
|---|---|---|---|
| Operators | d |
Delete | Cut text to register. |
c |
Change | Cut text and enter Insert mode. | |
y |
Yank | Copy text to register. | |
| Motions | w / b |
Word | Next/Previous word start. |
e |
End | End of current word. | |
$ / 0 |
Line | End / Start of line. | |
f{char} |
Find | Jump to next occurrence of {char}. |
|
| Objects | iw |
Inner Word | The word under cursor. |
it |
Inner Tag | Content inside HTML tag. | |
i" |
Inner Quote | Content inside quotes. | |
as |
Around Sentence | Sentence including whitespace. | |
| Special | . |
Dot | Repeat last change. |
dd |
Line Op | Delete current line. | |
cc |
Line Op | Change current line. |
</div>
3. Interactive Flashcards
Click a card to reveal the answer.