A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/tom-doerr/zsh_codex below:

tom-doerr/zsh_codex: This is a ZSH plugin that enables you to use OpenAI's Codex AI in the command line.

AI in the command line.


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

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.

  1. Install the OpenAI package, the Google package, or boto3.

or

pip3 install google-generativeai

or

  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_codex
    export ZSH_CUSTOM="your/custom/path"
    source "$ZSH_CUSTOM/plugins/zsh_codex/zsh_codex.plugin.zsh"
    bindkey '^X' create_completion
  1. Create a file called zsh_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 = openai
api_key = dummy_key
model = llama3.1
base_url = http://localhost:11434/v1

; OpenAI service configuration
; Provide the 'api_key' and specify a 'model' if needed.
[openai_service]
api_type = openai
api_key = <openai_apikey>

; Groq service configuration
; Provide the 'api_key'.
[groq_service]
api_type = groq
api_key = <groq_apikey>
model = gemma2-9b-it

; Mistral service configuration
; Provide the 'api_key'.
[mistral_service]
api_type = mistral
api_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 the api_type are specified in services/sevices.py. Choose which service to use in the [service] section.

  1. Run zsh, start typing and complete it using ^X!
  2. If you use virtual environments you can set ZSH_CODEX_PYTHON to python executable where openai or google-generativeai is installed. e.g. for miniconda you can use:
export ZSH_CODEX_PYTHON="$HOME/miniconda3/bin/python"

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

before you call bindkey 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

Since the current filesystem is not passed into the ai you will need to either

  1. Pass in all context in your descriptive command
  2. Use a command to collect the context

In order for option 2 to work you will need to first add export ZSH_CODEX_PREEXECUTE_COMMENT="true" to your .zshrc file to enable the feature.

Warning

This will run your prompt using zsh each time before using it, which could potentially modify your system when you hit ^X.

Once you've done that and restarted your shell you can do things like this:

# git add all files. Also commit the current changeset with a descriptive message based on $(git diff). Then git push

Fish Version

Traffic Statistics


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4