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 ~/.zshrczinit light lgdevlop/zsh-ai-completeantigen bundle lgdevlop/zsh-ai-completegit clone https://github.com/lgdevlop/zsh-ai-complete.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-ai-completeThen add to your .zshrc:
plugins=(git zsh-ai-complete)Reload with:
omz reload # if using Oh My Zsh
# or
source ~/.zshrcOn first use, the plugin creates:
~/.config/zsh-ai-complete/ai-providers.jsonBased on the example:
example.ai-providers.jsonCustomize 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+Uto 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!
