Course Lessons
Visual Mode Overview
👁️ Chapter 2: Visual Mode Mastery
Now that you're comfortable with Vim's undo system, it's time to master precise text selection. Visual mode is what makes Vim incredibly powerful for selecting and manipulating text. You'll learn to see exactly what you're working with before making changes.
Why Visual Mode Matters
Key Insight: Visual mode gives you visual feedback about your selection before you act on it. Unlike normal mode where operations happen immediately, visual mode lets you see and adjust your selection first.
This makes complex edits safer and more intuitive, especially when you're learning or working with unfamiliar code.
What You'll Learn This Chapter
Lesson 1: Visual Character Mode (v)
Master character-by-character selections. Select exactly the text you want, from a single character to multiple paragraphs.
Lesson 2: Visual Line Mode (V)
Work with entire lines at once. Perfect for moving code blocks, indenting, or deleting multiple lines.
Lesson 3: Visual Block Mode (Ctrl+v)
Select rectangular columns of text. Amazing for editing multiple lines simultaneously or working with aligned data.
Lesson 4: Visual Mode Operations
Apply operations to visual selections: delete (d), change (c), indent (>, <), case changes (gU, gu), and more.
Lesson 5: Extending Selections
Learn to adjust your selection after starting visual mode using motion commands and text objects.
Lesson 6: Real-World Visual Mode
Practice common visual mode patterns used by professionals every day.
The Three Visual Modes
Vim has three different visual modes, each perfect for different situations:
- • v (character-wise): Select any amount of text character by character. Use when you need precise control over the selection boundaries.
- • V (line-wise): Always selects complete lines. Use when working with line-based operations like moving functions or indenting blocks.
- • Ctrl+v (block-wise): Select rectangular blocks. Use for column editing, adding text to multiple lines, or aligning code.
Each mode has its strengths, and mastering all three will transform how you edit text.
Pro Tip: Visual Mode vs Normal Mode
Visual mode is great for learning and for complex selections, but as you advance, you'll often find normal mode commands faster for simple operations:
- • Instead of V then d to delete a line, just use dd
- • Instead of v then navigate then d, consider d{motion}
- • Visual mode shines when you need to see your selection or make complex edits
Use visual mode when you need the visual feedback, but don't forget the power of normal mode operations!