The plugin is based on Obeone's Gist
I use Antidote for zsh plugins, but if you use a different system for managing your zsh, it's basically the same: just add ocodo/ollama_zsh_completion to your plugins list and reload your shell.
With Antidote, installation is as simple as editing your ~/.zsh_plugins.txt file and adding:
ocodo/ollama_zsh_completion
Then reload:
source ~/.zshrcOr just start a new shell. Update plugins using antidote update.
If you use Oh My Zsh, you can install this plugin manually:
git clone https://github.com/ocodo/ollama_zsh_completion.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/ollamaThen edit your .zshrc and add ollama to the list of plugins:
plugins=(... ollama)Reload your omz:
omz reloadCommand completion for all ollama CLI commands, see the original gist for more info.
Examples:
ollama [TAB]
cp -- Copy a model
create -- Create a model from a Modelfile
help -- Help about any command
list -- List models
ps -- List running models
pull -- Pull a model from a registry
push -- Push a model to a registry
rm -- Remove a model
run -- Run a model
serve -- Start ollama
show -- Show information for a model
stop -- Stop a running modelollama create -f [TAB] # File completion for Modelfileollama push|cp|run|rm|show [TAB]
# Completion of local modelsollama pull [TAB]
# Completion of models from ollama.com/library
Note: Results cached to ~/.cache/ollama_library_models.cache (1hr TTL)ollama stop [TAB]
# Completion of running models (via `ollama ps`)ollama help [TAB]
cp -- Copy a model
create -- Create a model from a Modelfile
help -- Help about any command
list -- List models
ps -- List running models
pull -- Pull a model from a registry
push -- Push a model to a registry
rm -- Remove a model
run -- Run a model
serve -- Start ollama
show -- Show information for a model
stop -- Stop a running model