Created
March 23, 2025 00:32
-
-
Save brandon-fryslie/efd4bbb584cfa19b6972bbb78c77c237 to your computer and use it in GitHub Desktop.
sgpt_zsh_cmd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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