You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This plugin works by asking GPT (gpt-4o) for terminal commands that achieve the described target action.
To use it just type what you want to do (e.g. list all files in this directory) and hit the configured hotkey (default: Ctrl+o).
When GPT responds with its suggestions just select the one from the list you want to use.
Replace the placeholder with your own key.
The config can be set e.g in your .zshrc in this case be careful to not leak the key should you be sharing your config files.
Configuration Variables
Variable
Default
Description
ZSH_AI_COMMANDS_OPENAI_API_KEY
-/- (not set)
OpenAI API key
ZSH_AI_COMMANDS_HOTKEY
'^o' (Ctrl+o)
Hotkey to trigger the request
ZSH_AI_COMMANDS_LLM_NAME
gpt-4o
LLM name
ZSH_AI_COMMANDS_N_GENERATIONS
5
Number of completions to ask for
ZSH_AI_COMMANDS_EXPLAINER
true
If true, GPT will comment the command
ZSH_AI_COMMANDS_HISTORY
false
If true, save the natural language prompt to the shell history (and atuin if installed)
Known Bugs
Sometimes the commands in the response have to much / unexpected special characters and the string is not preprocessed enough. In this case the fzf list stays empty.
The placeholder message, that should be shown while the GPT request is running, is not always shown. For me it only works if zsh-autosuggestions is enabled.
About
Zsh plugin to convert natural language prompts to terminal commands with GPT-4