Back to Features
Tab Completion - Your AI Pair Programmer
Master Cursor's intelligent Tab completion for lightning-fast coding
💡 What You'll Learn
- How Tab completion predicts your next 1-15 lines of code
- When to trust the AI vs. when to override it
- Keyboard shortcuts to accept, reject, or partially accept suggestions
- Real-world productivity gains (30-50% faster coding)
🚀 What is Tab Completion?
Tab completion is Cursor's most powerful feature. Unlike simple autocomplete, it uses Claude 4.5 Sonnet to predict entire blocks of code based on:
- Your current file context
- Your codebase patterns
- Common programming patterns
- Your recent edits
// Example: Type this line...
function calculateTotal(items) {
// Press Tab to accept this suggestion ↓
return items.reduce((sum, item) => sum + item.price, 0);
}
⌨️ Essential Keyboard Shortcuts
| Action | Shortcut | When to Use |
|---|---|---|
| Accept suggestion | Tab | When the AI is spot-on |
| Accept one word | Cmd+→ / Ctrl+→ | For partial acceptance |
| Reject suggestion | Esc | When you want to write it yourself |
| See next suggestion | Alt+] | Cycle through alternatives |
| See previous suggestion | Alt+[ | Go back to previous option |
🎯 Real-World Examples
Example 1: Writing React Components
// You type:
const UserProfile = ({ user }) => {
// Tab suggests (press Tab to accept):
return (
<div className="profile">
<img src={user.avatar} alt={user.name} />
<h2>{user.name}</h2>
<p>{user.bio}</p>
</div>
);
};
Example 2: API Error Handling
// You type:
try {
const response = await fetch('/api/users');
// Tab suggests complete error handling:
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Failed to fetch users:', error);
throw error;
}
⚡ Pro Tips for Maximum Productivity
✅ Do This
- Write descriptive function names first
- Add comments to guide the AI
- Review suggestions before accepting
- Use Tab for boilerplate code
- Cycle through alternatives (Alt+[ / Alt+])
❌ Avoid This
- Blindly accepting every suggestion
- Using Tab for complex business logic
- Ignoring type errors in suggestions
- Fighting with the AI repeatedly
- Forgetting to test the generated code
🔧 Configuring Tab Completion
Open Settings (Cmd+, or Ctrl+,) and search for "tab":
- Enable/Disable: Toggle "Cursor Tab" on/off
- Suggestion Delay: Adjust how quickly suggestions appear (default: 150ms)
- Show Inline Suggestions: Choose whether to see ghost text
📊 Measuring Your Productivity Gains
Real Developer Results:
- 📈 30-50% faster for repetitive code patterns
- 🎯 70% acceptance rate for boilerplate code
- ⚡ 10x faster for writing tests and types
- 🧠 Less mental fatigue - focus on logic, not syntax
🎓 Practice Exercise
Try This Now:
- Create a new file
utils.ts - Type:
export function debounce - Let Tab complete the entire debounce function
- Review the code - does it make sense?
- Try Alt+] to see alternative implementations
🔗 Next Steps
Now that you've mastered Tab completion, learn how to make precise edits with Cmd+K Inline Editing →