Skip to content

SOP-004: Tab Autocomplete

Document Control

FieldValue
SOP IDSOP-004
Version1.0
StatusActive
Last Updated2024-12

Purpose

This SOP covers mastering Cursor's Tab autocomplete feature, including multi-line completions, cross-file navigation, and auto-imports.

Scope

  • Understanding Tab suggestions
  • Accepting and rejecting completions
  • File jumps and auto-imports
  • Configuration options

Prerequisites

  • Cursor installed and configured
  • Tab enabled in Cursor Settings

Procedure

How Tab Works

Flow: You Type → AI Predicts → Ghost Text → Accept/Reject

StepWhat Happens
You TypeCode + intent
AI PredictsContext + recent edits analyzed
Ghost TextSemi-opaque suggestion appears
Accept/RejectTab = Accept, Esc = Reject

Context Considered:

  • Current file content
  • Recent changes
  • Linter errors
  • Previously accepted edits

Step 1: Basic Usage

Trigger Suggestions: Simply start typing. Tab suggestions appear automatically as ghost text.

Accept/Reject:

ActionShortcut
Accept full suggestionTab
Reject suggestionEscape
Accept word-by-wordCmd+→ / Ctrl+→
Keep typingSuggestion updates

Example:

javascript
// Type: function calc
// Ghost text appears: ulateSum(a, b) { return a + b; }
// Press Tab to accept
function calculateSum(a, b) { return a + b; }

Step 2: Multi-Line Completions

Tab can suggest entire blocks of code:

You type: if (user.

Tab suggests:

javascript
if (user.isAuthenticated) {
  return { success: true };
} else {
  return { success: false, error: 'Unauthorized' };
}

Press Tab to accept all lines

Step 3: Partial Accepts

Enable in Cursor Settings > Tab > Partial Accepts

Use Cmd+→ / Ctrl+→ to accept one word at a time:

// Suggestion: console.log('User authenticated successfully');
// Press Cmd+→ once: console.
// Press Cmd+→ again: console.log(
// Continue until satisfied

When to Use Partial Accepts

  • When suggestion is mostly right but needs tweaking
  • When you want to verify each part
  • When learning what Tab suggests

Step 4: Jump in File

After accepting a Tab suggestion, Tab can jump you to the next edit location:

javascript
function greet(name) {          // ← Accept Tab here
  return `Hello, ${name}`;
}

// Press Tab again...

function farewell(name) {       // ← Jumps here automatically
  return `Goodbye, ${name}`;
}

Tab predicts where you'll need to edit next and jumps there.

Step 5: Jump Across Files

Tab predicts edits needed in related files:

  1. You edit: api/users.ts - add new function getUser()
  2. Portal appears: at bottom of screen
  3. Shows suggestion: types/user.ts - Add type definition
  4. Press Tab: to jump to types/user.ts and apply the edit

This works great for:

  • Adding type definitions when creating new functions
  • Updating imports when adding exports
  • Synchronizing related code across files

Step 6: Auto-Import

Tab automatically adds missing imports (TypeScript & Python):

typescript
// You type: const response = axios.get(
// Tab auto-adds at top of file:
import axios from 'axios';

// Then completes your code:
const response = axios.get('/api/users');

Troubleshooting Auto-Import:

  • Ensure language server is active
  • Check if import shows in Quick Fix (Cmd+. / Ctrl+.)
  • Verify TypeScript/Python extensions installed

Step 7: Tab in Peek

Use Tab inside Go to Definition peek views:

  1. Right-click a function → Go to Definition (or press F12)
  2. Peek view opens inline
  3. Tab works inside the peek view
  4. Great for updating function signatures and fixing call sites

Vim Users

Use gd to jump to definitions, modify with Tab, then return.


Configuration

Navigate to Cursor Settings > Tab:

SettingDescriptionDefault
Cursor TabEnable/disable AI completionsOn
Partial AcceptsWord-by-word acceptanceOff
Suggestions While CommentingTab in comment blocksOn
Whitespace-OnlyFormat-only suggestionsOff
Auto Import (TS)TypeScript auto-importsOn
Auto Import (Python)Python auto-importsBeta

Toggling Tab

Use status bar (bottom-right) to:

  • Snooze: Temporarily disable
  • Disable globally: Turn off for all files
  • Disable for extensions: Turn off for specific file types (e.g., .md, .json)

Best Practices

DO:

  • Write descriptive variable/function names
  • Add comments for complex logic (Tab reads them)
  • Use partial accepts for verification
  • Let Tab complete boilerplate

DON'T:

  • Accept suggestions without reading them
  • Fight Tab - if rejecting often, adjust approach
  • Rely on Tab for security-critical code

Verification Checklist

  • [ ] Tab suggestions appear when typing
  • [ ] Escape properly rejects suggestions
  • [ ] Partial accepts work with Cmd+→
  • [ ] Jump in file works after accepting
  • [ ] Cross-file jump portal appears when relevant
  • [ ] Auto-imports added for TypeScript/Python

Troubleshooting

IssueSolution
No suggestions appearingCheck Tab is enabled in settings
Wrong/irrelevant suggestionsAdd more context (comments, variable names)
Auto-import not workingCheck language server active, test with Cmd+.
Tab interfering with typingSnooze temporarily or disable for file type
Slow suggestionsCheck network, disable heavy extensions

See Also

Built with VitePress | Powered by Claude AI