Project 1: The “No-HJKL” Navigator

Build a navigation drill file and a repeatable practice routine that trains you to move by intent (targets) instead of by arrow keys or raw j/k spam.

Quick Reference

Attribute Value
Difficulty Level 1: Beginner
Time Estimate 4-8 hours
Main Programming Language None (plain text)
Alternative Programming Languages N/A
Coolness Level Level 1: Foundation
Business Potential 2: Productivity multiplier
Prerequisites Basic Vim modes, open/save/quit, comfortable in CLI
Key Topics Motions, counts, search/find, viewport navigation

1. Learning Objectives

By completing this project, you will:

  1. Navigate to visible targets with 1-3 commands instead of repeated j/k.
  2. Choose the right motion unit (word, line, paragraph, screen) on purpose.
  3. Use search and find as motions that drive edits, not just navigation.
  4. Apply counts to reduce keystrokes and increase precision.
  5. Build a daily drill that gradually increases speed and accuracy.
  6. Diagnose when you are “over-navigating” and replace it with semantic jumps.

2. All Theory Needed (Per-Concept Breakdown)

2.1 Semantic Motions and Counts

Fundamentals

Semantic motions are the vocabulary of Vim navigation. A motion is not just “move one step”; it is a deliberate instruction like “next word” or “end of paragraph.” When you learn to select the right unit, you stop thinking in characters and start thinking in structures. Counts multiply these units. A count before the operator and a count before the motion multiply together, which means a tiny command can cover large distances. The fundamental shift is that you are no longer steering the cursor like a joystick. You are issuing a command that describes where the cursor should be.

Counts are not about speed alone. They are about expressing scale. If you know you need to move five words, using 5w is not just faster; it is more reliable because it is a single command that can be repeated with . or combined with operators. The system becomes predictable, and prediction is what builds muscle memory.

Deep Dive into the concept

Every motion in Vim describes a “text object boundary” even if it is not a text object. Motions like w, b, and e are defined in terms of what Vim considers a word. That definition is controlled by the iskeyword option and changes across filetypes. That means your navigation vocabulary is slightly different in code versus prose. Understanding that makes you less surprised by where Vim stops.

Counts work at two levels: operator counts and motion counts. In 2d3w, Vim first multiplies 2 by 3 and deletes six words. This matters for navigation too because the grammar is the same. You can practice pure motion with counts (5w) and then apply the same reasoning to editing (d5w, c2e). The deeper insight is that counts are compositional. You can always reduce multi-step navigation into a single composable sentence. This is the backbone of “thinking in Vim.”

How this fits on projects

  • You will use motion units and counts to reach targets in the drill file.
  • You will measure how many keystrokes each target costs.

Definitions & key terms

  • Motion: A command that moves the cursor by a semantic unit.
  • Count: A numeric prefix that repeats or scales an action.
  • Word: A sequence of keyword characters (configurable by iskeyword).
  • WORD: A sequence of non-blank characters separated by whitespace.

Mental model diagram (ASCII)

[Intent] -> [Choose unit] -> [Add count] -> [Execute motion]
   "next word"     w              5             5w

Motion sentence flow

How it works (step-by-step)

  1. Decide the unit (character, word, WORD, line, paragraph, screen).
  2. Choose the corresponding motion (w, W, 0, $, {, }, H/M/L).
  3. Add a count if the target is multiple units away.
  4. Execute and verify that the cursor lands exactly where intended.

Minimal concrete example

5w    " move forward five words
2e    " move to end of the second word
3{    " move up three paragraphs

Common misconceptions

  • “Counts are only for advanced users”: Counts make navigation easier, not harder.
  • “j/k is always safer”: Single-letter vertical moves are often less precise.
  • “w always stops at punctuation”: It depends on iskeyword and filetype.

Check-your-understanding questions

  1. What is the difference between w and W on foo.bar?
  2. Why does 2d3w delete six words?
  3. When is e better than w for a change operation?

Check-your-understanding answers

  1. w stops at punctuation; W treats foo.bar as one WORD.
  2. The counts multiply: 2 * 3 = 6.
  3. e lands on the end of a word, which is useful for ce changes.

Real-world applications

  • Jumping between identifiers in code without losing context.
  • Skipping across log fields quickly.
  • Moving through Markdown by paragraphs instead of lines.

Where you’ll apply it

References

  • :help motion.txt
  • “Practical Vim” by Drew Neil, Ch. 8
  • “Learning the vi and Vim Editors” by Lamb/Robbins, Ch. 3

Key insights

A motion is a sentence about structure, not a step about distance.

Summary

Semantic motions and counts let you navigate with intent. Once you trust the units, you stop “steering” and start “commanding.” The goal of this project is to make these commands automatic.

Homework/Exercises to practice the concept

  1. Navigate a paragraph using only { and }.
  2. Move to the 5th word on a line using counts only.
  3. Find a punctuation-heavy identifier and compare w vs W.

Solutions to the homework/exercises

  1. Use { to move backward and } to move forward between paragraphs.
  2. 5w from the start of the line lands on the 5th word.
  3. w stops at punctuation; W treats the full token as one unit.

2.2 Search and Find as Motions

Fundamentals

Search (/ and ?) and find (f, t, F, T) are not separate tools from navigation; they are motions. That means they can be combined with operators and repeated with n, N, ;, and ,. The basic idea is that a target is more important than the path. If the target is visible or uniquely identifiable, search is almost always faster than counting with j/k or w.

Find is a precision tool for the current line. It is ideal for punctuation-rich lines like code or logs. Search is global within the buffer. The distinction matters because the repetition keys differ: ; repeats a find, while n repeats a search. Once you internalize this, you can move like a radar: find to align on a line, then search to jump across the file.

Deep Dive into the concept

Search is regex-based and uses Vim’s magic modes. Even if you avoid advanced regex, the search register becomes a reusable motion. The last search pattern is stored and can be recalled with / followed by <Up>, or simply repeated with n. This is why Vim rewards you for making a clean, intentional search: it becomes a reusable motion you can apply again and again.

Find (f and t) is line-scoped, which keeps it fast and safe. The t variant stops before the character, which is perfect for delete/change operations like dt, or ct). When practicing navigation, this is important because you want to land on the exact insertion point, not just the character itself. The deeper skill is learning to blend search and find: search to the correct line, then find to the correct column.

How this fits on projects

  • You will use /pattern to jump to targets in the drill file.
  • You will use f and t to land precisely on symbols.

Definitions & key terms

  • Search: A regex-based motion that moves to the next match.
  • Find: A line-scoped motion that jumps to a character.
  • Repeat: n/N for search, ; and , for find.

Mental model diagram (ASCII)

Search:  buffer-wide radar
Find:    line-scoped laser
Repeat:  n/N for search, ;/, for find

How it works (step-by-step)

  1. Identify a unique target string or character.
  2. Use /target or fX to jump to it.
  3. Use repeat keys to continue or refine.
  4. Combine with operators if you are editing.

Minimal concrete example

/Timeout<Enter>   " jump to next Timeout
n                " next Timeout
f;               " jump to semicolon on current line

Common misconceptions

  • “Search is only for navigation”: It is a motion and can drive edits.
  • “Find equals search”: Find is line-scoped and faster for punctuation.
  • “You must retype search”: n repeats, and / history exists.

Check-your-understanding questions

  1. What does dt, do, and why is it useful?
  2. Which key repeats the last f search?
  3. How do you search backward for a word?

Check-your-understanding answers

  1. It deletes up to (but not including) the comma; useful for field edits.
  2. ; repeats the last find.
  3. Use ?word.

Real-world applications

  • Jumping to log fields separated by commas or spaces.
  • Editing argument lists in code.
  • Navigating Markdown headings quickly.

Where you’ll apply it

References

  • :help search
  • :help f
  • “Learning the vi and Vim Editors” Ch. 3

Key insights

If a target is visible, search is faster than counting.

Summary

Search and find turn navigation into target acquisition. The more you repeat and reuse patterns, the more Vim feels like a command language rather than a cursor.

Homework/Exercises to practice the concept

  1. Find a line with three commas and delete up to the second comma using dt,.
  2. Search for a repeated word and use n to visit every match.
  3. Use t) to stop before a closing parenthesis.

Solutions to the homework/exercises

  1. Use dt, twice from the start of the line.
  2. /word then n repeatedly.
  3. t) places the cursor just before ).

2.3 Viewport-Relative Motions and Scrolling

Fundamentals

Viewport-relative motions (H, M, L) move the cursor to the top, middle, or bottom of the visible window. They are about the screen, not the file. This is useful because your eyes are usually anchored in the viewport, and the fastest navigation is often “move to what I can already see.” Scrolling commands like zz, zt, and zb reposition the viewport around the cursor, keeping your focus stable.

The foundational idea is that your screen is a workspace. Treating it as a coordinate system (top, middle, bottom) reduces the need to count lines. Instead of thinking “move down 17 lines,” you think “move to the bottom, then jump to the target.” This makes navigation faster and less error-prone.

Deep Dive into the concept

Viewport motions are most powerful when combined with relative line numbers. With set relativenumber, the distance from the cursor becomes visible. This means you can see that a target is 8 lines away and use 8j rather than repeated j taps. The deeper insight is that H/M/L reduce the mental cost of navigation because they turn the screen into a reference grid.

Scrolling commands (zz, zt, zb) change where the cursor sits in the viewport. This matters for editing because many operations need context: you want to see the surrounding lines while editing. zz centers the cursor, which stabilizes your field of view. zt puts it at the top, which is great when you want to see what follows. zb puts it at the bottom, which is useful when you are editing up from the bottom of the view.

How this fits on projects

  • You will use H/M/L to move instantly within the visible area.
  • You will use zz to keep targets centered as you drill.

Definitions & key terms

  • Viewport: The visible portion of the buffer.
  • Screen-relative motion: Motions based on top/middle/bottom of the viewport.
  • Recenter: zz, zt, zb to reposition the view around the cursor.

Mental model diagram (ASCII)

+---------------------+
| H  top of screen    |
|                     |
| M  middle of screen |
|                     |
| L  bottom of screen |
+---------------------+

Screen positions

How it works (step-by-step)

  1. Identify a target already visible on screen.
  2. Use H/M/L to jump near it.
  3. Use a short motion or find to land precisely.
  4. Recenter with zz to keep focus stable.

Minimal concrete example

H      " move to top visible line
M      " move to middle visible line
L      " move to bottom visible line
zz     " center the cursor in the viewport

Common misconceptions

  • “H/M/L are just shortcuts”: They are anchors for fast navigation.
  • “Scrolling is separate from motion”: Recenter commands are part of navigation.
  • “Relative numbers are distracting”: They often reduce mental math.

Check-your-understanding questions

  1. When would you use zt instead of zz?
  2. Why does H feel faster than 10k in a dense file?
  3. What does M do in a split window?

Check-your-understanding answers

  1. Use zt when you want to see more context below the cursor.
  2. H is a single command tied to the viewport, no counting.
  3. It moves to the middle line of the active window, not the file.

Real-world applications

  • Navigating stack traces and logs where the relevant line is visible.
  • Editing code with many short lines in a tight viewport.
  • Keeping context while refactoring.

Where you’ll apply it

References

  • :help H
  • :help zz
  • “Practical Vim” Ch. 8

Key insights

Treat the screen as a coordinate system, not just the file.

Summary

Viewport-relative motions and recentering reduce navigation friction. They help you move quickly within what your eyes already see.

Homework/Exercises to practice the concept

  1. Use H, M, and L to touch three targets without j/k.
  2. Recenter the cursor with zz after each jump.

Solutions to the homework/exercises

  1. Use H, then M, then L to reach targets in the viewport.
  2. Press zz after each motion to keep the cursor centered.

3. Project Specification

3.1 What You Will Build

You will build a navigation practice system consisting of:

  • A plain-text drill file containing lines engineered for motion practice.
  • A repeatable routine that targets specific symbols, words, and lines.
  • A short checklist to measure progress (keystrokes per target, error rate).

This is not a code project. It is a behavior-change project with a measurable output.

3.2 Functional Requirements

  1. Drill File: Create navigation_practice.txt with at least 150 lines of varied text (logs, code-like lines, Markdown headings).
  2. Target Markers: Include visible target strings (e.g., TARGET_A, ERROR, TODO) in predictable positions.
  3. Motion Rules: Complete drills using only motions, search, and find. No arrow keys.
  4. Count Usage: Each drill must include at least 10 commands using counts.
  5. Viewport Jumps: Each drill must use H/M/L and zz at least once.
  6. Measurement: Record how many keystrokes per target for three sessions.

3.3 Non-Functional Requirements

  • Repeatability: The drill is repeatable on any machine without plugins.
  • Clarity: Targets are clearly labeled and easy to spot.
  • Determinism: The file is static so practice results are comparable.
  • Ergonomics: Drill sessions are short (15-20 minutes) to avoid fatigue.

3.4 Example Usage / Output

Open file: vim navigation_practice.txt

Goal: jump to the next TARGET_B, then to the semicolon on the same line.

/ TARGET_B<Enter>
;      (repeat last find if applicable)
f;     (find semicolon)

3.5 Data Formats / Schemas / Protocols

The drill file is plain text. Use a simple schema to ensure variety:

[LOG] 2025-01-15 10:23:45 ERROR TARGET_A: message...
[CODE] if (user.role == "guest") { /* TARGET_B */ }
[MD] ## Section Title - TARGET_C

3.6 Edge Cases

  • Target appears multiple times on one line.
  • Search pattern matches too many results.
  • Target is at top or bottom of viewport.
  • Very long line with many punctuation characters.

3.7 Real World Outcome

You should be able to open the drill file and hit targets with minimal keystrokes.

3.7.1 How to Run (Copy/Paste)

cd /path/to/drills
vim navigation_practice.txt

3.7.2 Golden Path Demo (Deterministic)

  1. Place cursor at top (gg).
  2. Jump to ERROR line with /ERROR<Enter>.
  3. Move to the word after ERROR with w.
  4. Recenter with zz.

Expected cursor position:

[LOG] 2025-01-15 10:23:47 ERROR |TARGET_A: connection failed

3.7.3 Failure Demo (Deterministic)

If you use repeated j to reach the same target, you should notice:

  • More than 15 keystrokes for a single jump.
  • Higher error rate (overshooting or undershooting the target).

3.7.4 If CLI

Not applicable. This project is an interactive Vim workflow, not a CLI tool.

3.7.5 If Web App

Not applicable.

3.7.6 If API

Not applicable.

3.7.7 If Library

Not applicable.

3.7.8 If TUI

ASCII layout of the Vim session during drills:

+------------------------------------------------------+
| navigation_practice.txt                              |
| [LOG] 2025-01-15 10:23:45 ERROR TARGET_A ...         |
| [LOG] 2025-01-15 10:23:46 INFO  TARGET_B ...          |
| [CODE] if (user.role == "guest") { /* TARGET_C */ } |
|                                                      |
| -- NORMAL --                                         |
+------------------------------------------------------+

p01_navigation_practice_screen

Navigation practice screen

Key interactions:

  • /pattern<Enter> to jump to a target
  • f<char> to hit punctuation on the same line
  • H/M/L to move within the viewport

4. Solution Architecture

4.1 High-Level Design

+--------------------+    +--------------------+    +--------------------+
| Drill File         | -> | Navigation Routine | -> | Progress Checklist |
+--------------------+    +--------------------+    +--------------------+

Drill pipeline

4.2 Key Components

Component Responsibility Key Decisions
Drill file Provide predictable targets Use mixed log/code/markdown lines
Routine checklist Enforce motion-only navigation No arrow keys, no mouse
Measurement log Track keystrokes and errors Simple notes in a log file

4.3 Data Structures (No Full Code)

DrillSession:
- date
- targets_hit
- total_keystrokes
- error_count

4.4 Algorithm Overview

Key Algorithm: Target Acquisition

  1. Identify the most distinctive target string.
  2. Use search to jump to the line.
  3. Use find or motion to land precisely.
  4. Recenter and repeat.

Complexity Analysis:

  • Time: O(k) per target, where k is number of keypresses.
  • Space: O(1)

5. Implementation Guide

5.1 Development Environment Setup

# Verify Vim is installed
vim --version

# Create a practice workspace
mkdir -p ~/vim-motions-drill
cd ~/vim-motions-drill

5.2 Project Structure

vim-motions-drill/
|-- navigation_practice.txt
|-- drill_log.txt
`-- README.md

5.3 The Core Question You’re Answering

“How do I move my cursor at the speed of my eyes?”

5.4 Concepts You Must Understand First

Stop and research these before starting:

  1. Word vs WORD motions (w vs W)
  2. Search vs find (/ vs f)
  3. Screen-relative motions (H/M/L, zz)

5.5 Questions to Guide Your Design

  1. Which targets are best reached by search rather than counts?
  2. Can I reduce two motions into one by choosing a larger unit?
  3. How will I measure if my navigation is improving?

5.6 Thinking Exercise

Pick any visible symbol and write the shortest motion sequence to reach it. Then perform it without hesitation.

5.7 The Interview Questions They’ll Ask

  1. “What is the difference between f and t?”
  2. “How do you move to the middle of the screen?”
  3. “What does zz do?”

5.8 Hints in Layers

Hint 1: Start with search Use / for long-distance jumps.

Hint 2: Find for precision Use f and t to land on punctuation.

Hint 3: Counts reduce steps 5w is better than wwwww.

Hint 4: Recenter often Use zz to keep your focus centered.

5.9 Books That Will Help

Topic Book Chapter
Motions “Practical Vim” Ch. 8
Navigation “Learning the vi and Vim Editors” Ch. 3

5.10 Implementation Phases

Phase 1: Foundation (1-2 hours)

Goals:

  • Build the drill file with mixed line types.
  • Add at least 20 targets.

Tasks:

  1. Create 50 log-like lines and sprinkle TARGET_A.
  2. Add 50 code-like lines with punctuation targets.

Checkpoint: You can visually see targets without scrolling much.

Phase 2: Navigation Drills (2-3 hours)

Goals:

  • Use search and find to hit targets quickly.
  • Practice counts intentionally.

Tasks:

  1. Hit 30 targets using / and n.
  2. Hit 20 targets using f, t, ;.
  3. Use counts on at least 10 targets.

Checkpoint: Average keystrokes per target is under 4.

Phase 3: Speed and Stability (1-2 hours)

Goals:

  • Reduce hesitation and over-navigation.
  • Build a short daily routine.

Tasks:

  1. Time a 10-target run and log results.
  2. Repeat on a different day and compare.

Checkpoint: You can describe the fastest motion before executing it.

5.11 Key Implementation Decisions

Decision Options Recommendation Rationale
Drill file size 50 / 150 / 300 lines 150 lines Enough variety without fatigue
Target density Sparse / Moderate / Dense Moderate Forces search without clutter
Measurement Notes / Timer / Script Notes + timer Simple and repeatable

6. Testing Strategy

6.1 Test Categories

Category Purpose Examples
Skill checks Verify motion accuracy Hit target in <= 3 commands
Consistency Repeatability over time Same drill, fewer keystrokes
Error handling Recover from mistakes Use u, re-center, continue

6.2 Critical Test Cases

  1. Long-distance target: Use / to reach a target 100+ lines away.
  2. Line-local target: Use f and ; to jump between punctuation.
  3. Viewport target: Use H/M/L to hit three visible targets.

6.3 Test Data

[LOG] 2025-01-15 10:23:45 ERROR TARGET_A: msg
[CODE] if (value == 0) { /* TARGET_B */ }
[MD] ## TARGET_C Section Title

7. Common Pitfalls & Debugging

7.1 Frequent Mistakes

Pitfall Symptom Solution
Overusing j/k Many keystrokes per target Force / or f for each target
Misusing word motions Cursor stops too early Use W or adjust iskeyword
Forgetting repeat Retyping searches Use n and ;

7.2 Debugging Strategies

  • Record keystrokes: Write down sequences that felt slow and optimize them.
  • Use :set rnu: Relative numbers help estimate distances.

7.3 Performance Traps

  • Spending time counting lines instead of searching.
  • Reaching for arrows when tired.

8. Extensions & Challenges

8.1 Beginner Extensions

  • Add a second drill file with shorter lines.
  • Practice only w/W motions for 10 minutes.

8.2 Intermediate Extensions

  • Add targets inside quotes and use f" to reach them.
  • Practice gg, G, and % for structural jumps.

8.3 Advanced Extensions

  • Perform the drill using only / and n (no j/k).
  • Add paragraph jumps { and } into the routine.

9. Real-World Connections

9.1 Industry Applications

  • Fast navigation in production logs during incident response.
  • Quick code skimming in code reviews without an IDE.
  • Vim: The editor itself; reading its help reinforces these motions.
  • Neovim: Modern fork with the same core navigation model.

9.3 Interview Relevance

  • Motion fluency demonstrates tool mastery and efficiency.
  • Expect questions about search, find, and % in editor discussions.

10. Resources

10.1 Essential Reading

  • “Practical Vim” by Drew Neil - Ch. 8 (motions)
  • “Learning the vi and Vim Editors” - Ch. 3 (navigation)

10.2 Video Resources

  • Vim motions drills (search on YouTube for “Vim motions practice”)
  • Vimcast episodes on basic motions

10.3 Tools & Documentation

  • :help motion.txt
  • :help search

11. Self-Assessment Checklist

11.1 Understanding

  • I can explain the difference between w and W.
  • I can describe when to use search vs find.
  • I can explain what H/M/L do without guessing.

11.2 Implementation

  • Drill file exists and contains 150+ lines.
  • I can reach any target without arrow keys.
  • I can hit three targets in a row with <= 4 keystrokes each.

11.3 Growth

  • I recorded at least two practice sessions.
  • I can identify my slowest motions.
  • I can describe one change I will make to my routine.

12. Submission / Completion Criteria

Minimum Viable Completion:

  • Completed a full drill session (20 targets) without arrow keys.
  • Used search and find at least 10 times each.
  • Logged keystrokes for one session.

Full Completion:

  • All minimum criteria plus:
  • Average <= 4 keystrokes per target.
  • Used H/M/L and zz in every drill session.

Excellence (Going Above & Beyond):

  • Documented a personal “motion cheat sheet” and improved results after one week.
  • Demonstrated the routine on a real code or log file.