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 (i for inner, a for around) to edit semantic blocks like quotes " and braces {.
  • The Dot Command: The . key repeats the last change. Structure your edits (e.g., use A instead 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.

What command deletes the word under the cursor?
diw
How do you change the content inside "quotes"?
ci"
What does `ct.` do?
Change till dot (delete up to . and enter insert)
What key repeats the last change?
.
--- ## 4. Next Steps Now that you understand the grammar of Vim, you are ready to learn how to edit efficiently. [**Module 3: Advanced Editing**](/vim/03-advanced-editing/) Learn about Visual Block mode, Registers, and Macros. [**Vim Glossary**](/vim/glossary/) Check the glossary for any terms you missed.