Diff
1diff --git a/plugins/bun/README.md b/plugins/bun/README.md
2new file mode 100644
3index 0000000000000000000000000000000000000000..5a312370f455c215875f609d08d46502b770f30d
4--- /dev/null
5+++ b/plugins/bun/README.md
6@@ -0,0 +1,20 @@
7+# Bun Plugin
8+
9+This plugin sets up completion for [Bun](https://bun.sh).
10+
11+To use it, add `bun` to the plugins array in your zshrc file:
12+
13+```zsh
14+plugins=(... bun)
15+```
16+
17+This plugin does not add any aliases.
18+
19+## Cache
20+
21+This plugin caches the completion script and is automatically updated when the
22+plugin is loaded, which is usually when you start up a new terminal emulator.
23+
24+The cache is stored at:
25+
26+- `$ZSH_CACHE_DIR/completions/_bun_` completions script
27diff --git a/plugins/bun/bun.plugin.zsh b/plugins/bun/bun.plugin.zsh
28new file mode 100644
29index 0000000000000000000000000000000000000000..9924faa8444ee871e87b7df9a3a85ffed1d6d8d5
30--- /dev/null
31+++ b/plugins/bun/bun.plugin.zsh
32@@ -0,0 +1,14 @@
33+# If Bun is not found, don't do the rest of the script
34+if (( ! $+commands[bun] )); then
35+ return
36+fi
37+
38+# If the completion file doesn't exist yet, we need to autoload it and
39+# bind it to `bun`. Otherwise, compinit will have already done that.
40+if [[ ! -f "$ZSH_CACHE_DIR/completions/_bun" ]]; then
41+ typeset -g -A _comps
42+ autoload -Uz _bun
43+ _comps[bun]=_bun
44+fi
45+
46+bun completions >| "$ZSH_CACHE_DIR/completions/_bun" &|