Tab Completion & Inline Editing
Master Cursor's Tab completion that predicts your next edit and Cmd+K inline editing that lets you describe code changes in plain English.
Your Two Fastest Tools
🔄 In Lesson 2, you set up Cursor, imported your VS Code config, and learned the interface. Now you’ll learn the two features you’ll use hundreds of times a day: Tab completion and inline editing.
These are Cursor’s bread and butter. They’re fast enough that you won’t think twice about using them, and they handle the majority of day-to-day coding tasks without opening a chat window or launching an agent.
Tab Completion: The Predictive Edit
Cursor’s Tab isn’t standard autocomplete. Standard autocomplete suggests the next word. Cursor’s Tab model predicts your next edit.
What does that mean in practice?
Say you just renamed a function from getData to fetchUserData. Tab might predict that you need to update the function call on line 47, the import on line 3, and the test reference in another file. It doesn’t just complete words — it anticipates what you’re about to do based on what you just did.
How it works:
- You start typing or make a change
- Cursor shows a ghosted suggestion (gray text)
- Press
Tabto accept the full suggestion - Press
Ctrl+→(right arrow) to accept word-by-word - Press
Escto dismiss
The word-by-word trick is underrated. When the suggestion is 90% right but the last part is wrong, Ctrl+→ lets you accept just the good portion. You don’t have to choose between all-or-nothing.
✅ Quick Check: You’re writing a React component and just created a
useStatehook forisLoading. What might Tab predict next? It’ll likely predict the corresponding state setter call (setIsLoading(true)) where you’d use it, or suggest the loading conditional render pattern ({isLoading && <Spinner />}). Tab learns common patterns — once you create a state variable, it knows you’ll use it somewhere.
Making Tab Work Better
A few patterns that improve Tab’s predictions:
Start with clear variable names. If you name a function handleSubmit, Tab predicts form submission logic. Name it fn1, and Tab has nothing to work with.
Write a comment first. Type // Validate email format before writing the function, and Tab will generate the validation logic. The comment gives it intent.
Edit consistently. If you’re renaming variables across a file, Tab learns the pattern after the first rename and predicts the rest. Same for converting callbacks to promises, adding types, or restructuring data.
Don’t fight it. If Tab keeps suggesting something you don’t want, press Esc and keep typing manually. It’ll adjust to your direction.
Inline Editing with Cmd+K
Tab is reactive — it predicts. Cmd+K is proactive — you direct.
Here’s the workflow:
- Highlight the code you want to change (or place your cursor where you want new code)
- Press
Cmd+K(Mac) orCtrl+K(Windows) - Type your instruction in plain English
- Review the diff — Cursor shows exactly what will change
- Press
Cmd+Enterto accept, orEscto cancel
Example instructions that work well:
| What You Type | What Cursor Does |
|---|---|
| “Convert this to async/await” | Rewrites the function from callbacks or .then() chains to async/await |
| “Add error handling” | Wraps the code in try/catch with appropriate error types |
| “Make this TypeScript” | Adds type annotations, interfaces, and fixes type errors |
| “Simplify this” | Refactors verbose code into a cleaner version |
| “Add input validation for email and password” | Adds validation checks before the function logic |
The key difference from chat: Cmd+K edits the code in place and shows you a diff. You see exactly what changes before accepting. There’s no copy-pasting from a chat window. It’s surgical.
Writing Better Inline Instructions
The quality of your Cmd+K instruction directly affects the quality of the edit. Here’s what works:
Be specific, not vague:
| Vague (worse results) | Specific (better results) |
|---|---|
| “Fix this” | “Fix the null check — handle the case where user.email is undefined” |
| “Add error handling” | “Add try/catch that retries network errors once, then throws” |
| “Make it better” | “Replace the nested if-else with an early return pattern” |
Include constraints: “Convert to TypeScript but keep the existing function signatures” or “Add validation but don’t change the return type.”
Reference the context: “Match the error handling pattern in auth.ts” tells Cursor to find and copy a pattern from another file. This is more effective than describing the pattern from scratch.
✅ Quick Check: You have a 50-line function and only want to change lines 20-25. Should you highlight the whole function or just those lines for Cmd+K? Highlight just lines 20-25. Cmd+K is designed for surgical edits. Giving it the whole function means it might change things you don’t want touched. The smaller your selection, the more focused the edit.
When to Use Which
Here’s a practical decision framework:
| Situation | Use |
|---|---|
| You’re typing and Cursor suggests the right next thing | Tab — just accept it |
| You want to rename, refactor, or transform existing code | Cmd+K — highlight and instruct |
| You need a new function or code block from scratch | Cmd+K — place cursor, describe what you need |
| You’re making the same type of edit across multiple spots | Tab — it learns the pattern after the first edit |
| The edit involves understanding context beyond the current file | Chat (Cmd+L) — covered in the next lesson |
| The edit requires running tests or terminal commands | Agent mode (Cmd+I) — covered in Lesson 5 |
Most developers spend 70% of their Cursor time in Tab and Cmd+K. Chat and Agent handle the other 30% — the bigger, more complex tasks.
Key Takeaways
- Tab completion predicts your next edit, not just the next word — it watches your patterns and anticipates changes across files
- Accept word-by-word with
Ctrl+→when the suggestion is mostly right - Cmd+K (inline editing) lets you describe changes in plain English and review a diff before accepting
- Specific instructions get better results: “Add try/catch that retries network errors” beats “add error handling”
- Use Tab for going with the flow, Cmd+K for directing specific changes
Up Next
Tab and Cmd+K handle individual edits. But what about bigger questions — “How does authentication work in this project?” or “What files would I need to change to add a new API endpoint?” In Lesson 4, you’ll learn Cursor’s Chat and the @ symbol context system that lets you have conversations with your entire codebase.
Knowledge Check
Complete the quiz above first
Lesson completed!