Plugins

A plugin is a set of aliases, functions and environment variables written once in TOML. opal turns it into zsh, bash, fish or PowerShell code when each shell starts.

opal plugin list shows every plugin and whether it's active in the current shell. Enable or disable one with opal plugin enable NAME and opal plugin disable NAME, then open a new terminal or run reload.

Built-in plugins

PluginWhat it adds
core.., ..., mkcd, up N, ll, la, reload, and open, clipcopy/clippaste, x (extract), ports and paths. Adds pbcopy and pbpaste on systems that don't have them.
gitThe git aliases below, plus gcm, gswm and grbm, which find the repository's main branch.
jumpj WORDS to go to a folder you've visited, and ji to pick one with fzf.
pythonva activates the nearest virtualenv in any shell, mkvenv creates one, vd deactivates it, pyserve starts a web server.
nodejsi, jsa, jsr, jsd, jsb, jst, jsx: install, add, run, dev, build, test and dlx with npm, pnpm, yarn or bun, whichever the project's lockfile uses.
dockerdps, dex, dlog, dc, dcu, dcd and more. Only active where docker is installed.
kubectlk, kgp, kgs, kd, kl, kaf, kns and more. Only active where kubectl is installed.
pkgpkg install|remove|search|update|upgrade|list|info with brew, apt, dnf, pacman, zypper, apk, winget, scoop or choco. It prints the real command before running it.

Git aliases

AliasRuns
ggit
gagit add
gaagit add --all
gapagit add --patch
gbgit branch
gbagit branch --all
gbdgit branch --delete
gcgit commit --verbose
gcagit commit --verbose --all
gcamgit commit --all --message
gcmsggit commit --message
gcbgit checkout -b
gcogit checkout
gclgit clone --recurse-submodules
gcpgit cherry-pick
gcfgit config --list
gdgit diff
gdsgit diff --staged
gfgit fetch
gfagit fetch --all --prune
glgit pull
glogit log --oneline --decorate
gloggit log --oneline --decorate --graph
glogagit log --oneline --decorate --graph --all
gmgit merge
gpgit push
gpfgit push --force-with-lease
gpsupgit push --set-upstream origin HEAD
grgit remote
grvgit remote --verbose
grbgit rebase
grbigit rebase --interactive
grbagit rebase --abort
grbcgit rebase --continue
grhgit reset
grhhgit reset --hard
grsgit restore
grstgit restore --staged
gshgit show
gstagit stash push
gstpgit stash pop
gstlgit stash list
gstgit status
gssgit status --short
gswgit switch
gswcgit switch --create
gcmCheck out the main branch (main, trunk, master... whatever this repo uses)
gswmSwitch to the main branch
grbmRebase onto the main branch

In PowerShell, gc, gcm, gl, gm and gp clash with built-in aliases, which opal keeps by default. Set shell.pwsh.clobber_builtin_aliases = true to use the git versions.

Installing plugins from git

opal plugin install someone/opal-plugin-terraform
opal plugin update
opal plugin remove terraform

install clones the repository into ~/.config/opal/plugins/ and enables it. The name comes from the repository, without an opal-plugin- prefix. Any git URL works too. update runs git pull in each installed plugin.

Writing a plugin

Save a TOML file as ~/.config/opal/plugins/NAME.toml, add its name to plugins in the config, and open a new terminal.

name = "terraform"
description = "Terraform shortcuts"
requires = ["terraform"]            # skipped where terraform isn't installed

[aliases]
tf  = "terraform"
tfp = "terraform plan"
tfa = "terraform apply"

[functions.tfw]
desc = "Switch workspace"
sh   = 'terraform workspace select "$1"'
fish = 'terraform workspace select $argv[1]'
pwsh = 'terraform workspace select $args[0]'

[env]
CHECKPOINT_DISABLE = "1"          # no upgrade checks

[native]
bash = 'complete -o nospace -C terraform terraform'

Values follow the same rules as your own aliases and functions: a string applies everywhere, a table picks the most specific key for the shell and OS, and an empty string leaves the entry out. [native] holds code that's included as it is, for a shell feature opal doesn't translate.

To publish a plugin, put the file at the root of a git repository as plugin.toml. The repository can also contain init.zsh, init.bash, init.fish or init.ps1 files, which are included for that shell.