Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

This is a ZSH plugin that enables you to use OpenAI's Codex AI in the command line.

License

NotificationsYou must be signed in to change notification settings

tom-doerr/zsh_codex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI in the command line.

Repository's startsIssuesLicense
Latest commitGitHub repository size

You just need to write a comment or variable name and the AI will write the corresponding code.

What is it?

This is a ZSH plugin that enables you to use AI powered code completion in the command line. It now supports both OpenAI's Codex and Google's Generative AI (Gemini). OpenAI Codex is the AI that also powers GitHub Copilot, while Gemini is Google's advanced language model.

How do I install it?

Manual Installation

  1. Install the OpenAI package, the Google package, or boto3.
pip3 install openai

or

pip3 install google-generativeai

or

pip3 install boto3
  1. Download the ZSH plugin.
git clone https://github.com/tom-doerr/zsh_codex.git~/.oh-my-zsh/custom/plugins/zsh_codex
  1. Add the following to your.zshrc file.

Using oh-my-zsh:

    plugins=(zsh_codex)    bindkey'^X' create_completion

Without oh-my-zsh:

# in your/custom/path you need to have a "plugins" folder and in there you clone the repository as zsh_codexexport ZSH_CUSTOM="your/custom/path"source"$ZSH_CUSTOM/plugins/zsh_codex/zsh_codex.plugin.zsh"    bindkey'^X' create_completion
  1. Create a file calledzsh_codex.ini in~/.config.Example:
; Primary service configuration; Set 'service' to match one of the defined sections below.[service]service = groq_service; Example configuration for a self-hosted Ollama service.[my_ollama]api_type = openaiapi_key = dummy_keymodel = llama3.1base_url = http://localhost:11434/v1; OpenAI service configuration; Provide the 'api_key' and specify a 'model' if needed.[openai_service]api_type = openaiapi_key = <openai_apikey>; Groq service configuration; Provide the 'api_key'.[groq_service]api_type = groqapi_key = <groq_apikey>model = gemma2-9b-it; Mistral service configuration; Provide the 'api_key'.[mistral_service]api_type = mistralapi_key = <mistral_apikey>model = mistral-small-latest

In this configuration file, you can define multiple services with their own configurations. The required and optional parameters of theapi_type are specified inservices/sevices.py. Choose which service to use in the[service] section.

  1. Runzsh, start typing and complete it using^X!
  2. If you use virtual environments you can setZSH_CODEX_PYTHON to python executable whereopenai orgoogle-generativeai is installed.e.g. forminiconda you can use:
export ZSH_CODEX_PYTHON="$HOME/miniconda3/bin/python"

Fig Installation

Troubleshooting

Unhandled ZLE widget 'create_completion'

zsh-syntax-highlighting: unhandled ZLE widget 'create_completion'zsh-syntax-highlighting: (This is sometimes caused by doing `bindkey <keys> create_completion` without creating the 'create_completion' widget with `zle -N` or `zle -C`.)

Add the line

zle -N create_completion

before you callbindkey but after loading the plugin (plugins=(zsh_codex)).

Already exists and is not an empty directory

fatal: destination path '~.oh-my-zsh/custom/plugins'

Try to download the ZSH plugin again.

git clone https://github.com/tom-doerr/zsh_codex.git ~/.oh-my-zsh/custom/plugins/zsh_codex

Buy Me A Coffee

More usage examples


Fish Version

Traffic Statistics

About

This is a ZSH plugin that enables you to use OpenAI's Codex AI in the command line.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp