How to master Peek and Edit on Cursor
Peek and Edit in Cursor allows you to view and modify code definitions without leaving your current context. This feature enables efficient code navigation and editing by opening inline windows that display referenced code.
Prerequisites
- Basic knowledge of code editors
- Familiarity with Cursor interface
- Understanding of code navigation concepts
- Knowledge of keyboard shortcuts
Step-by-Step Instructions
Enable Peek and Edit functionality
Ctrl+, on Windows/Linux or Cmd+, on Mac.Use Peek Definition to view code
Alt+F12 (Windows/Linux) or Option+F12 (Mac) to open the peek definition window. The definition will appear in an inline editor below your current line without navigating away from your current file.Navigate within the peek window
F12 to go to the actual definition file. The peek window shows line numbers and syntax highlighting.Edit code directly in peek window
Ctrl+Z for undo, Ctrl+C/V for copy/paste, and Ctrl+F for find within the peek window.Use Peek References to see usage
Shift+F12 to open peek references. This shows all locations where the symbol is used across your project. Navigate between references using the reference list on the left side of the peek window.Master peek window management
Escape or clicking the X button. Resize peek windows by dragging the borders. You can have multiple peek windows open simultaneously by using peek commands on different symbols. Switch between peek windows using Tab when focused in a peek window.Customize peek behavior and appearance
Common Issues & Troubleshooting
Peek definition shows 'No definition found'
Ensure your language server is running properly. Check the Language Server Status in the status bar. Try restarting Cursor or running Developer: Reload Window from the command palette.
Peek window appears too small or cut off
Drag the peek window borders to resize, or go to Settings > Editor > Peek Editor and adjust the Default Height value. Try values between 12-20 for optimal viewing.
Keyboard shortcuts not working for peek commands
Check File > Preferences > Keyboard Shortcuts and search for 'peek'. Verify the shortcuts aren't conflicting with other extensions. Reset to default if needed.
Changes in peek window not saving
Ensure the file isn't read-only and you have write permissions. Check if the file is part of a version control system with locks. Try manually saving with Ctrl+S while focused in the peek window.