Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save brandon-fryslie/efd4bbb584cfa19b6972bbb78c77c237 to your computer and use it in GitHub Desktop.
Save brandon-fryslie/efd4bbb584cfa19b6972bbb78c77c237 to your computer and use it in GitHub Desktop.
sgpt_zsh_cmd
# Copy and paste this into your .zshrc. The press ctrl+i, ctrl+i to use it
sgpt_cmd() {
if [[ -n "$BUFFER" ]]; then
_sgpt_prev_cmd=$BUFFER
BUFFER+="⌛"
zle -I && zle redisplay
BUFFER="$("$@" <<< "$_sgpt_prev_cmd")"
zle end-of-line
fi
}
# replace a prompt inline in your shell
sgpt_zsh() {
sgpt_cmd sgpt --shell --no-interaction
}
zle -N sgpt_zsh
bindkey '^i^i' sgpt_zsh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment