Intelligent code completion for Neovim using Mistral Codestral AI. Works with blink.cmp and nvim-cmp.
Using lazy.nvim:
return {
"jrollin/mistral-codestral.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"saghen/blink.cmp", -- or "hrsh7th/nvim-cmp"
},
lazy = false,
priority = 1000,
config = function()
require("mistral-codestral").setup({
api_key = "cmd:head -n1 ~/.mistral_codestral_key | tr -d '\\n'",
model = "codestral-latest",
completion_engine = "blink.cmp",
virtual_text = { enabled = true, idle_delay = 800 },
})
end,
}# Save your API key (get one at https://console.mistral.ai/)
echo "your_key_here" > ~/.mistral_codestral_key
chmod 600 ~/.mistral_codestral_key- Type in any file → Suggestions appear after 800ms idle
- Press
<M-l>→ Accept completion - Press
<C-c>→ Clear suggestion :MistralCodestralComplete→ Manual trigger
For stability in production, pin to a specific version:
return {
"jrollin/mistral-codestral.nvim",
tag = "v0.1.0", -- Pin to specific version
dependencies = {
"nvim-lua/plenary.nvim",
"saghen/blink.cmp",
},
config = function()
require("mistral-codestral").setup({...})
end,
}Or use version ranges:
tag = "v0.*", -- Any v0.x versionSee releases for available versions.
- CONFIGURATION.md - All config options with examples
- ARCHITECTURE.md - How the plugin works (flows, design)
- TROUBLESHOOTING.md - Common issues and solutions
- VIRTUAL-TEXT.md - Virtual text mode details
- COMPLETION-ENGINES.md - nvim-cmp & blink.cmp setup
| Command | Key | Description |
|---|---|---|
:MistralCodestralComplete |
<leader>mc |
Manual completion |
:MistralCodestralAuth status |
<leader>ma |
Check API key |
:MistralCodestralToggle |
- | Enable/disable plugin |
:checkhealth mistral-codestral |
- | Verify setup |
Insert mode bindings:
<M-l>- Accept completion<C-Right>- Accept next word (virtual text)<C-Down>- Accept current line (virtual text)<C-c>- Clear suggestion
- Virtual text - GitHub Copilot-style inline suggestions
- Completion menus - Integrated with blink.cmp and nvim-cmp
- Context-aware - Understands your code structure via LSP
- Smart caching - Faster repeated completions
- Buffer exclusions - Skips UI buffers (help, neo-tree, etc.)
- Non-blocking - Async API calls don't interrupt typing
See docs/quick-start.md for quick verification or docs/testing-guide.md for comprehensive testing.
# Run health check
nvim +checkhealth\ mistral-codestral
# Quick API test
nvim --headless -u ~/.config/nvim/init.lua \
-c "luafile <plugin-dir>/tests/api_test.lua" 2>&1
# Interactive test
bash <plugin-dir>/scripts/run_tests.shNote: Replace <plugin-dir> with your plugin's installation directory:
- lazy.nvim:
~/.local/share/nvim/lazy/mistral-codestral.nvim(Linux) or~/.config/nvim/lazy/mistral-codestral.nvim(macOS) - packer.nvim:
~/.local/share/nvim/site/pack/packer/start/mistral-codestral.nvim(Linux) - vim-plug:
~/.vim/plugged/mistral-codestral.nvimor~/.config/nvim/plugged/mistral-codestral.nvim
- Check TROUBLESHOOTING.md for common issues
- Run
:MistralCodestralAuth statusto check API key - Run
:checkhealth mistral-codestralto verify setup - Review CONFIGURATION.md for available options
MIT - See LICENSE file for details
Get API key: Mistral Console