iwantcoding.com
🔥 Daily 👥 Rooms 🏆 Top Log in Sign up

Exercises

Six exercises that turn common VS Code chores into one-keystroke operations. Try each on a real project today; the goal is to internalise the shortcut so the chore disappears.

Six VS Code drills with answers

EXAMPLE
# ============================================================
# Drill 1 — Stop using the mouse to open files
# ============================================================
# Open any file in the project, by name, in under 1 second.
#
# ANSWER: Ctrl+P then type a few characters.
# Variations:
#   Ctrl+P @           jump to symbol in current file
#   Ctrl+P #           workspace symbol search
#   Ctrl+P :42         go to line 42 (also Ctrl+G)
#   Ctrl+Tab           cycle through recently used files

# ============================================================
# Drill 2 — Bulk edit identical strings in one file
# ============================================================
# Rename a variable used 15 times in this file without touching others.
#
# ANSWER: cursor on the variable, then Ctrl+D repeatedly to add the next match;
# or Ctrl+Shift+L to select ALL occurrences at once; then type the new name.
# For project-wide renames, use F2 (Rename Symbol) which understands scope.

# ============================================================
# Drill 3 — Format-on-save with import sort
# ============================================================
# Make every save format the file + sort imports.
#
# ANSWER: settings.json
# {
#   "editor.formatOnSave": true,
#   "editor.codeActionsOnSave": { "source.organizeImports": "explicit" }
# }
# Pair with prettier / black / gofmt / dotnet format as the default formatter.

# ============================================================
# Drill 4 — Run tests with a key binding
# ============================================================
# Make 'run tests' a single keystroke.
#
# ANSWER: .vscode/tasks.json
# {
#   "version": "2.0.0",
#   "tasks": [{
#     "label": "test", "type": "shell",
#     "command": "npm test -- --watch",
#     "presentation": { "reveal": "always", "panel": "dedicated" },
#     "problemMatcher": []
#   }]
# }
# keybindings.json
# [{ "key": "ctrl+alt+t", "command": "workbench.action.tasks.runTask", "args": "test" }]

# ============================================================
# Drill 5 — Stage individual hunks before commit
# ============================================================
# Stage half of the changes in a file but not the others.
#
# ANSWER: Source Control view -> click the gutter icons next to lines to stage
# or unstage individual lines / hunks. OR Ctrl+K Ctrl+S to open the staging
# diff. Replaces 'git add -p' for the visual.

# ============================================================
# Drill 6 — Settings sync across machines
# ============================================================
# Bring your snippets, keybindings, and theme to any machine you sign in on.
#
# ANSWER: Cmd+Shift+P -> 'Settings Sync: Turn On' (uses GitHub/Microsoft account).
# Once synced, your dotfiles for the editor live with the account, and a fresh
# machine takes 30 seconds to feel like home.

# ============================================================
# Bonus exercises
# ============================================================
# - Bind Ctrl+\\ to split editor vertically; Ctrl+W to close
# - Make 'Toggle Word Wrap' a single keystroke (default Alt+Z)
# - Turn on bracket pair colourisation: editor.bracketPairColorization.enabled
# - Enable file:nesting in the explorer so .ts + .test.ts collapse together
# - Bind a snippet 'cl' to 'console.log($1)' and stop typing console.log by hand

# ============================================================
# Scoring
# ============================================================
# 6 / 6 -> consider mentoring teammates
# 4 / 6 -> a 30-min config session will pay for itself this week
# < 4   -> stop. Spend 30 minutes in keybindings.json. Thank me later.

Why it matters

The pattern is always the same: turn a chore you do 20 times a day into a single keystroke. Format-on-save, multi-cursor select, Ctrl+P, F2 — none of them are dramatic on day one and all of them save hours by Friday. Make the boring repeat operations boring keystrokes.

Tip: Tweak the snippet with Try it Yourself », then sit the quiz at the bottom of the page.

Example

Example
// Fill in: Ctrl + Shift + ____   // open the Command Palette
Try it Yourself »

Discussion

Loading…