Skip to content

Instantly share code, notes, and snippets.

@zcutlip
Created December 15, 2024 04:07
Show Gist options
  • Save zcutlip/aaf8e076398f0bb0c78ba18a9e8af62d to your computer and use it in GitHub Desktop.
Save zcutlip/aaf8e076398f0bb0c78ba18a9e8af62d to your computer and use it in GitHub Desktop.
ZSH: check for vscode before running 1Password `op completion`
# 'op' completion for some reason causes VSCode to trigger a
# "would like to access data from other apps" prompt
# this happens when vscode or an extension sources your .zshrc
# we need to check for VSCODE_RESOLVING_ENVIRONMENT, since vscode and
# some extensions set that
# We ALSO need to check TERM_PROGRAM since opening an interactive terminal session
# within vscode will *also* trigger the TCC prompt
if [ -z "$VSCODE_RESOLVING_ENVIRONMENT" ] && [ "$TERM_PROGRAM" != "vscode" ];
then
# initialize 1Password cli completions if 'op' exists
if _command_exists 'op';
then
eval "$(op completion zsh)"; compdef _op op
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment