3.6 KiB
3.6 KiB
Doom Emacs Code Completion & Lookup Cheatsheet
🚀 What You Have (Like nvim-cmp + blink.cmp)
If your Doom config includes:
- Company Mode - Auto-completion framework
- LSP Mode - Language Server Protocol support
- Tree-sitter - Advanced syntax parsing
- Lookup tools - Documentation and definition lookup
⌨️ Code Completion (Company)
Auto-completion Controls:
TABorC-SPC- Accept completionC-n/j- Next completion (evil mode)C-p/k- Previous completion (evil mode)C-w- Show documentation for completionC-s- Search/filter completionsESCorC-g- Cancel completion
Manual Completion:
M-/- Complete at point (manual trigger)C-M-/- Expand abbreviation
🔍 Code Lookup & Navigation
Go to Definition/References:
gd- Go to definition (evil mode)gD- Go to declarationgr- Go to referencesSPC c d- Find definitionSPC c D- Find referencesSPC c i- Find implementations
Documentation Lookup:
K- Lookup documentation (evil mode)SPC c k- Lookup documentationSPC c K- Lookup in docsetsC-h f- Describe functionC-h v- Describe variable
Symbol Navigation:
SPC c j- Jump to symbol in bufferSPC c J- Jump to symbol in projectSPC s i- Search for symbol
🛠️ LSP Features (Language Server)
LSP Actions:
SPC c a- Code actions (refactor, fix, etc.)SPC c r- Rename symbolSPC c f- Format buffer/regionSPC c o- Organize imports
Error Navigation:
]e- Next error[e- Previous errorSPC c x- List errors
LSP Info:
SPC c l- LSP menuSPC c h- Show hover infoSPC c s- Show signature
🎯 Language-Specific Features
C/C++ (clang-tools)
- Full completion for functions, variables, types
- Go to definition across files
- Error checking and diagnostics
- Code formatting with clang-format
Nix (nil LSP)
- Nix language completion
- Function documentation
- Syntax checking
- Go to definition for Nix expressions
JSON (vscode-json-languageserver)
- Schema-based completion
- Validation and error checking
- Go to definition in JSON files
⚡ Pro Tips
Fuzzy Search Everything:
SPC f f- Find filesSPC /- Search in projectSPC s s- Search bufferSPC p p- Switch projects
Better Navigation:
C-o- Go back (after jumping to definition)C-i- Go forwardSPC j j- Jump to character (like easymotion)
Completion Tweaks:
- Completions appear after 0.2 seconds of typing
- Minimum 1 character to trigger
- Shows documentation in popup
- Works with both Company and LSP
🔧 Troubleshooting
If completion isn't working:
- Check if LSP server is running:
SPC c l - Restart LSP:
SPC c l r - Check syntax errors:
SPC c x
Performance:
- LSP servers auto-start when you open supported files
- Completion is optimized for fast response
- Use
SPC h r rto reload Doom config after changes
🚀 Quick Start Workflow
- Open a code file (
.c,.nix,.json) - Start typing - completions appear automatically
- Navigate with
j/kand accept withTAB - Use
gdto jump to definitions - Use
Kto see documentation - Use
SPC c afor code actions
📚 Language Servers Included
- C/C++:
clang-tools(clangd) - Nix:
nil - JSON:
vscode-json-languageserver - More can be added per language as needed!