Edit Faster: Vim Motions From Scratch


Edit Faster: Vim Motions From Scratch

Ever watched a developer frantically switching between keyboard and mouse? "Click, type, click, type..." It's like watching someone crawl when they could just walk.

If you're tired of granny mode coding and want to boost your productivity, Vim motions might be exactly what you need.

Every once in a while, I review my processes, trying to improve systems, tools, and yes, motions.
This time I thought, why not share the basics with everyone too?

These motions aren't just for Vim users, but for anyone using a modern code editor like VS Code or PyCharm.

These shortcuts aren't just convenient; they're a language that makes coding (or any text for that matter) significantly faster.

Once you start using them, they'll become second nature, and you'll wonder how you ever coded without them. You'll start searching them everywhere: in your notes app, docs and Slack.

The core problem is simple: context switching between keyboard and mouse kills productivity.

Forcing the fingers to stay on the keyboard, without proper motions, usually means a lot of repeated arrow key strokes. And if there's something that feels like cutting brain connections when I code, it must be hitting the arrow 15 times to change a line or the cursor location on a line of code.

Most developers accept this inefficiency as normal, endlessly reaching for their mouse to navigate code.

"Steep learning curve" They'd say, or "I'd end up spending more time learning these instead of producing lines of code". I know that, because I've said the exact same things to my mentor 12 years ago.

There's nothing further from the truth, yes, Vim is HARD to learn, but not THAT HARD.

In fact, if you read through, and practice just the list in this document, you'll be able to conveniently edit any Vim files on any machine. Kind of like speaking the "street language" of a country you're visiting on your next vacation.

By mastering Vim motions, you can keep your hands on the keyboard and dramatically speed up your workflow.

Vim offers an intuitive movement language centered around the home row keys.

Start with h, j, k, and l for basic navigation (left, down, up, right).

Once comfortable, expand to faster movements: w jumps to the next word's start, e to a word's end, and b moves backward.

Need to find a specific character? Use f followed by the target letter.

For editing, the story gets even better.

Once in normal mode (access via Escape), d deletes, y yanks (copies), and p pastes.

Combine these with movements like dw to delete a word or dd to delete a line.

The "dot" (`.`) operator repeats your last action, making bulk edits remarkably efficient.

Here's a list of the basics:

Navigation: h (left), j (down), k (up), l (right)

Word movement: w (next word start), e (word end), b (backward)

Line navigation: 0 (line start), ^ (first non-space character), $ (line end)

Character finding: f{char} (find forward), F{char} (find backward), ; (repeat find), , (reverse find)

Document navigation: gg (document top), G (document bottom), {n}G (goto line n)

Screen navigation: zz (center current line), H (screen top), M (screen middle), L (screen bottom)

Editing: i (insert), a (append), o (new line below), O (new line above)

Deletion: d{motion}, dd (delete line), D (delete to line end)

Copy/paste: y{motion}, yy (yank line), p (paste after), P (paste before)

Visual selection: v (character mode), V (line mode), Ctrl+v (block mode)

Text objects: diw (delete in word), ci" (change in quotes)

Search: /pattern (search forward), ?pattern (search backward), n (next match), N (previous match)

Undo/Redo: u (undo), Ctrl+r (redo)

Saving/Quitting: :w (save), :q (quit), :wq or ZZ (save and quit)

One clever tweak is remapping the Escape key for easier mode switching.

I suggest adding a custom mapping for jj or jk in your Vim configuration:

This eliminates the need to reach for the Escape key, keeping your fingers on the home row.

To improve your Vim motion control, try Vim Adventures: A game specifically designed to teach Vim navigation through solving mazes using hjkl keys

Vim Golf: Challenges that push you to complete editing tasks with the fewest keystrokes possible

"Vim motions aren't just keys, they're a language. A language so easy on your fingers that you won't just set them up everywhere — they'll become something you can't live without."

Ready to make the keyboard cool again? Start small with basic navigation, practice daily, and gradually add new motions to your repertoire.

Within weeks, you'll find yourself editing text at the speed of thought, leaving mouse-dependent developers in the dust, then, you'd probably want to start watching this.


Thank you for reading.
Feel free to reply directly with any question or feedback.
Have a great weekend!

ESPRESSO FRIDAYS

Every once in a while I send hand picked things I've learned. Kind of like your filter to the tech internet. No spam, I promise!

Read more from ESPRESSO FRIDAYS

You've been lied to about self hosting... This issue is brought to you by: Auth0, my auth provider for the last 6 years. Join their free virtual dev_day on June 18th to learn how to secure AI agents and applications. Save your free spot That title might sound a bit aggressive, but this isn't about hating on hosting platforms. It's about loving the freedom, control, and cost-savings that come from owning your deployment process, without giving up the slick, easy experience we all love. And...

How DHH Solved Deploying to Production (with Open Source) Ever felt depressed by the sheer complexity of getting your application live and serving users? You’re not alone. But what if deploying to production, even (or especially) across multiple servers, could be straightforward and more importantly, free? That’s the reality DHH, the creator of Ruby on Rails and CTO of Basecamp & HEY, wanted to create, and he delivered with an open source tool called Kamal. DHH’s approach to technology always...

The UNDERRATED Open Source Powering My HomeLab This issue is brought to you by: Secure Your AI Future at Snyk Launch 2025 Join Snyk Launch to discover how to establish a foundation to build securely and confidently in the age of AI. Register for Snyk Launch 2025 (It’s Free!) Kestra, an open-source automation platform that's been a game-changer for my homelab and, frankly, could be for a lot more. It's one of those tools that flies under the radar for too many people, but packs so much...