6f39351feff2126608ea696ca1ab9ba6b13cb77f

Author
Runrioter Wung <runrioter@gmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(codex): add plugin (#13757)

Diff

 1diff --git a/plugins/codex/README.md b/plugins/codex/README.md
 2new file mode 100644
 3index 0000000000000000000000000000000000000000..ce46a254ad3f73a58eb25cf1f27b532960f6d757
 4--- /dev/null
 5+++ b/plugins/codex/README.md
 6@@ -0,0 +1,11 @@
 7+# codex Plugin
 8+
 9+## Introduction
10+
11+This `codex` plugin sets up completion for [codex](https://github.com/openai/codex).
12+
13+To use it, add `codex` to the plugins array of your zshrc file:
14+
15+```bash
16+plugins=(... codex)
17+```
18diff --git a/plugins/codex/codex.plugin.zsh b/plugins/codex/codex.plugin.zsh
19new file mode 100644
20index 0000000000000000000000000000000000000000..b5d1ab617a2e0d8ffcff0021831f7bae99aace14
21--- /dev/null
22+++ b/plugins/codex/codex.plugin.zsh
23@@ -0,0 +1,14 @@
24+# COMPLETION FUNCTION
25+if (( ! $+commands[codex] )); then
26+  return
27+fi
28+
29+# If the completion file doesn't exist yet, we need to autoload it and
30+# bind it to `codex`. Otherwise, compinit will have already done that.
31+if [[ ! -f "$ZSH_CACHE_DIR/completions/_codex" ]]; then
32+  typeset -g -A _comps
33+  autoload -Uz _codex
34+  _comps[codex]=_codex
35+fi
36+
37+codex completion zsh 2> /dev/null >| "$ZSH_CACHE_DIR/completions/_codex" &|