6 min read
On this page

Keyboard First

The Cost of the Mouse

Every time you reach for the mouse, you lose time. Not just the half-second of moving your hand — the real cost is the cognitive break. You shift from thinking about code to thinking about navigation. Where is the menu? Where is the button? Where do I need to click?

Keyboard shortcuts bypass this entirely. The command goes directly from thought to action. After a few weeks of practice, you don't even consciously think about the shortcut — your fingers just do it, the same way you don't think about individual letters when typing a word.

The difference between a keyboard-first engineer and a mouse-dependent one is visible in pair programming sessions. The keyboard-first engineer flows through edits, navigations, and refactors at the speed of thought. The mouse-dependent engineer is constantly interrupted by the physical act of pointing and clicking.

This is not about speed for its own sake. It's about maintaining your train of thought. When you can express edits as fast as you can think of them, you stay in the problem-solving mindset instead of the tool-operating mindset.

The 20 Shortcuts That Cover 80% of Editing

You don't need to memorize 200 shortcuts. You need 20, used until they're automatic. The following are presented in VS Code notation, but equivalents exist in every major editor.

Ctrl+P (Cmd+P)              Go to file by name
Ctrl+G                      Go to line number
Ctrl+Shift+O (Cmd+Shift+O)  Go to symbol in current file
Ctrl+T (Cmd+T)              Go to symbol in workspace
F12                          Go to definition
Alt+Left (Ctrl+-)            Go back to previous location
Ctrl+Tab                    Switch between open files

"Go to file" is the most important shortcut in any editor. If you're using the file tree to navigate, you're doing it wrong. Type the filename (or even a partial match) and you're there in under a second. The file tree is for orientation, not navigation.

"Go to definition" is the second most important. Click on a function call, press F12, and you're at the implementation. Combined with "go back" (Alt+Left), you can dive through call chains and return without losing your place.

Editing

Ctrl+D (Cmd+D)              Select next occurrence of current selection
Ctrl+Shift+L (Cmd+Shift+L)  Select ALL occurrences of current selection
Alt+Up/Down (Opt+Up/Down)   Move current line up/down
Alt+Shift+Up/Down            Duplicate current line up/down
Ctrl+Shift+K (Cmd+Shift+K)  Delete current line
Ctrl+/ (Cmd+/)              Toggle line comment
Ctrl+Shift+/ (Cmd+Shift+/)  Toggle block comment
Ctrl+F (Cmd+F)              Find in current file
Ctrl+H (Cmd+H)              Find and replace in current file
Ctrl+Shift+F (Cmd+Shift+F)  Find in all files
Ctrl+Shift+H (Cmd+Shift+H)  Find and replace in all files

Window management

Ctrl+B (Cmd+B)              Toggle sidebar
Ctrl+` (Ctrl+`)             Toggle terminal
Ctrl+\ (Cmd+\)              Split editor
Ctrl+1/2/3                  Focus editor group 1/2/3

The practice method

Don't try to learn all 20 at once. Pick 3 shortcuts you don't currently use. Write them on a sticky note. Force yourself to use them for a full week, even when it feels slower than the mouse. After a week, they'll be automatic. Pick the next 3.

This takes about 6 weeks to cover the full set. After that, you'll be dramatically faster without having suffered through a painful transition period.

Multi-Cursor Editing

Multi-cursor editing is the single feature that, once learned, you'll wonder how you ever lived without.

Adding cursors

Ctrl+D (Cmd+D)              Add cursor at next match of selection
Ctrl+D repeated              Keep adding cursors at subsequent matches
Ctrl+Shift+L (Cmd+Shift+L)  Add cursors at ALL matches
Alt+Click (Opt+Click)        Add cursor at click position
Ctrl+Alt+Up/Down             Add cursor above/below

Practical examples

Renaming a variable in a local scope:

1. Select the variable name
2. Press Ctrl+D repeatedly until all occurrences in the scope are selected
3. Type the new name — all instances update simultaneously

Adding a prefix to multiple lines:

1. Select the lines
2. Place cursors at the start of each line (Ctrl+Shift+L, then Home)
3. Type the prefix — it appears on every line

Converting a list of values into an array:

# Start with:
apple
banana
cherry
grape

# Select all lines, Ctrl+Shift+L to get cursor on each
# Press Home to go to start of each line, type "  "
# Press End to go to end of each line, type ","
# Add the opening bracket above and closing bracket below

Extracting values from a repetitive structure:

# You have 20 lines like:
# user_id: 123, name: "Alice"
# user_id: 456, name: "Bob"

# Select "user_id: " on the first line
# Ctrl+Shift+L to select all occurrences
# Delete the selection — now you have just the IDs at the start

Multi-cursor is especially powerful combined with find-and-replace. Use regex find to create a complex selection, then use multi-cursor to edit all matches simultaneously.

Find & Replace with Regex

Basic find-and-replace is useful. Regex find-and-replace is a superpower.

Common regex patterns for editing

# Add quotes around unquoted values
Find:    (\w+): (\w+)
Replace: $1: "$2"

# Convert snake_case to camelCase (first step — need multiple passes)
Find:    _([a-z])
Replace: \U$1

# Extract specific parts of a pattern
Find:    function (\w+)\(.*\)
Replace: $1

# Swap two values
Find:    (\w+), (\w+)
Replace: $2, $1

# Add a parameter to every function call
Find:    myFunction\((.*?)\)
Replace: myFunction($1, newParam)

Regex tips for editing

Enable "Use Regular Expression" in the find dialog (usually a .* button).

Use capture groups () and backreferences $1, $2 to preserve parts of the match while changing the rest.

Test your regex on one occurrence before doing "Replace All." A wrong regex applied globally can cause damage that's tedious to undo.

Use \n in the search field to match newlines (in some editors, you need to enable multiline mode).

Split Panes

Working in a single pane is like having a single monitor — functional but limiting.

Common split layouts

# Side by side: code + tests
Left pane:  src/auth/login.ts
Right pane: test/auth/login.test.ts

# Side by side: implementation + interface
Left pane:  user-service.ts
Right pane: user-service.interface.ts

# Top/bottom: code + terminal
Top pane:   Current file
Bottom pane: Integrated terminal running tests

# Three-way: code + test + reference
Left pane:   Implementation
Middle pane: Test file
Right pane:  API documentation or type definitions

Managing splits efficiently

Ctrl+\ (Cmd+\)       Split editor right
Ctrl+1/2/3            Focus specific editor group
Ctrl+W                Close current editor
Drag tab to a pane    Move file between groups

The key insight is that you should always be able to see what you're changing alongside the thing that tells you what to change — whether that's a test file, a type definition, an API spec, or a terminal showing errors.

Editor-Specific Power Features

Command palette

Ctrl+Shift+P (Cmd+Shift+P)  Open command palette

This is the universal escape hatch. If you know what you want to do but don't know the shortcut, open the command palette and type a description. "format document", "fold all", "toggle word wrap." It also shows you the keyboard shortcut next to each command, which is how you gradually learn them.

Quick fixes and refactoring

Ctrl+. (Cmd+.)        Quick fix / code actions
F2                     Rename symbol (project-wide)
Ctrl+Shift+R           Refactor menu

F2 rename is vastly superior to find-and-replace for renaming variables, functions, or classes. It understands scope, respects imports, and updates references across files.

Bracket matching and folding

Ctrl+Shift+\ (Cmd+Shift+\)  Jump to matching bracket
Ctrl+Shift+[ (Cmd+Opt+[)    Fold current block
Ctrl+Shift+] (Cmd+Opt+])    Unfold current block
Ctrl+K Ctrl+0                Fold all
Ctrl+K Ctrl+J                Unfold all

Folding is underused. When navigating a large file, fold everything and then selectively unfold the sections you care about. It turns a 1000-line file into a scannable outline.

Integrated terminal

Your editor's built-in terminal is not a toy. It's a first-class tool. Use it for running tests, git commands, and build processes. The advantage over an external terminal is that it's always visible and you can navigate between it and your editor with a single keystroke.

Ctrl+` (Ctrl+`)       Toggle terminal
Ctrl+Shift+`           Create new terminal instance

Common Pitfalls

Trying to learn everything at once. This leads to frustration and regression to the mouse. Learn 2-3 shortcuts per week. Slow and steady wins.

Memorizing shortcuts without practice. Reading a list of shortcuts does nothing. You have to use them in real editing tasks, repeatedly, until they're muscle memory.

Ignoring the command palette. If you only learn one shortcut, make it the command palette. It's a gateway to every other feature.

Using the file tree for navigation. The file tree is a map, not a GPS. Use "Go to file" (Ctrl+P) to navigate. Reserve the file tree for when you need to see the directory structure.

Not customizing keybindings. If a default shortcut is awkward on your keyboard layout, rebind it. Your editor's keybindings should fit your hands, not the other way around.

Key Takeaways

Keyboard-first editing keeps you in the problem-solving mindset by removing the cognitive overhead of mouse navigation. The benefit is sustained focus, not just speed.

Twenty shortcuts cover 80% of editing needs. Learn them 3 at a time over 6 weeks. Go to file, go to definition, and multi-cursor selection are the highest-impact three.

Multi-cursor editing eliminates repetitive manual edits. Combined with regex find-and-replace, it handles transformations that would otherwise take minutes of tedious work.

Split panes let you see related files simultaneously. Always pair your implementation with whatever tells you what to implement — tests, types, specs, or error output.

The command palette is your safety net. If you forget a shortcut or need a feature you've never used, the command palette will find it for you.