Overview
The completion configuration is located inlua/user/cmp.lua and integrates:
- LSP completions
- Snippet expansion (LuaSnip)
- Buffer text completions
- Path completions
- Custom icons and formatting
Configuration
Basic Setup
lua/user/cmp.lua:1
Completion Sources
Completion suggestions come from multiple sources:lua/user/cmp.lua:112
Source Priority
Sources are tried in order. LSP has highest priority, followed by snippets, buffer text, and paths.Keybindings
Navigation
| Key | Action | Description |
|---|---|---|
<C-k> | select_prev_item() | Previous suggestion |
<C-j> | select_next_item() | Next suggestion |
<C-b> | scroll_docs(-1) | Scroll docs up |
<C-f> | scroll_docs(1) | Scroll docs down |
<C-Space> | complete() | Trigger completion |
<C-e> | abort()/close() | Close completion menu |
<CR> | confirm() | Accept completion |
Tab Behavior
Smart tab handling with snippet expansion:lua/user/cmp.lua:68
Shift-Tab Behavior
Reverse navigation:lua/user/cmp.lua:84
Snippet Integration
LuaSnip Setup
Snippet engine configuration:lua/user/cmp.lua:49
Loading Snippets
VSCode-style snippets are loaded automatically:lua/user/cmp.lua:11
Formatting
Completion Item Icons
Custom icons for different completion types:lua/user/cmp.lua:18
Format Function
Customize how completions are displayed:lua/user/cmp.lua:97
Window Appearance
Documentation Window
Rounded border for documentation popup:lua/user/cmp.lua:122
Confirm Behavior
lua/user/cmp.lua:118
Experimental Features
lua/user/cmp.lua:127
Ghost Text
Enable to show completion preview inline:Helper Functions
Backspace Check
Determines when Tab should insert a tab character:lua/user/cmp.lua:13
- Cursor is at beginning of line
- Character before cursor is whitespace
Customization
Adding More Sources
Add additional completion sources:Customizing Source Priority
Usepriority to control ordering:
Changing Keybindings
Edit the mapping table:Filtering Completions
Limit buffer completions to nearby text:LSP Integration
Completion capabilities are configured inlua/user/lsp/handlers.lua:8:
- Snippets in completions
- nvim-cmp specific features
- Rich completion items
Troubleshooting
No Completions Appearing
-
Check LSP is attached:
-
Verify cmp is loaded:
-
Check sources:
Snippets Not Working
Ensure LuaSnip is installed and loaded:Slow Completions
Limit buffer source to current buffer:Related Pages
Snippets
Configure and create code snippets
LSP Handlers
LSP capabilities and integration

