Complete Zsh commands using real-time AI ✨
Supports OpenAI, Ollama, Gemini, and other configurable models.
zsh-ai-complete is a Zsh plugin that brings artificial intelligence to your terminal. It suggests and completes Zsh commands in real time using natural language or partial input.
- 🤖 Works with OpenAI, Ollama, Gemini, and more
- ⚡ Instant AI-powered command suggestions
- 🔄 Switch providers live with
Ctrl+E
- 🔐 Local config file with API tokens and preferences
Make sure the following tools are installed on your system:
Tool | Purpose | Link |
---|---|---|
fzf |
Interactive search UI | Link |
curl |
API requests | Link |
jq |
JSON parsing | Link |
bat |
Syntax-highlighted command preview | Link |
fd |
Optional, for file previews | Link |
git clone https://github.com/lgdevlop/zsh-ai-complete.git ~/.zsh-ai-complete
echo "source ~/.zsh-ai-complete/zsh-ai-complete.plugin.zsh" >> ~/.zshrc
source ~/.zshrc
zinit light lgdevlop/zsh-ai-complete
antigen bundle lgdevlop/zsh-ai-complete
git clone https://github.com/lgdevlop/zsh-ai-complete.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-ai-complete
Then add to your .zshrc
:
plugins=(git zsh-ai-complete)
Reload with:
omz reload # if using Oh My Zsh
# or
source ~/.zshrc
On first use, the plugin creates:
~/.config/zsh-ai-complete/ai-providers.json
Based on the example:
example.ai-providers.json
Customize it with your tokens and preferences:
{
"openai": {
"url": "https://api.openai.com/v1/chat/completions",
"token": "your_api_key",
"model": "gpt-4",
"system_message": "You must output exactly five complete zsh commands. No explanations, no comments, no code blocks, no numbering, no blank lines. Output only the commands, one per line.",
"output_path": ".choices[0].message.content"
}
}
- Press
Ctrl+U
to launch the assistant (viafzf
) - Type a command fragment or a natural question (multi-language supported)
- Select one of the AI-suggested commands
Example:
how do I list docker containers by name?
See project-docs/examples.md
for full walkthroughs.
Key | Action |
---|---|
Ctrl+U |
Launch the AI command assistant |
Ctrl+E |
Switch between configured providers |
ESC |
Cancel without applying a suggestion |
More details in project-docs/shortcuts.md
- Support for multiple AI backends
- Dynamic provider switching (Ctrl+E)
- Example and shortcut documentation
- Output theming and advanced previews
- Cached suggestions
Contributions are welcome! Feel free to open issues or pull requests.
See CODE_OF_CONDUCT.md
.
MIT — See LICENSE
.
Made with ❤️ by Leonardo Gomes
✨ zsh-ai-complete — Make your terminal smarter with the power of AI!