Skip to content

Instantly share code, notes, and snippets.

@GeneralD
Last active February 26, 2025 00:26
Show Gist options
  • Save GeneralD/a7fe68ab28195799cc01c558b93bd384 to your computer and use it in GitHub Desktop.
Save GeneralD/a7fe68ab28195799cc01c558b93bd384 to your computer and use it in GitHub Desktop.
type op &>/dev/null && {
eval "$(op completion zsh)" && compdef _op op
[ -f ~/.config/op/plugins.sh ] && source ~/.config/op/plugins.sh
# enable auto-completion through op plugins
local plugins=($(\ls -1 ~/.config/op/plugins/used_items | sed 's/.[^.]*$//'))
for plugin in $plugins; do
eval "
function _${plugin}_wrapped() {
op plugin run -- $plugin \$@
}
alias $plugin=_${plugin}_wrapped
compdef _$plugin _${plugin}_wrapped
"
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment