sgpt setup in zshrc

This commit is contained in:
Laurent Le Houerou 2024-06-02 21:49:44 +04:00
parent 6c8beadef4
commit ed7a737cf2

View File

@ -80,6 +80,7 @@ alias vi="nvim"
alias vim="nvim" alias vim="nvim"
alias lg="lazygit" alias lg="lazygit"
alias cc="clear" alias cc="clear"
alias sgpts="sgpt --shell"
# Shell integrations # Shell integrations
eval "$(fzf --zsh)" eval "$(fzf --zsh)"
@ -88,6 +89,20 @@ eval "$(zoxide init --cmd cd zsh)"
# bun completions # bun completions
[ -s "/home/laurent/.bun/_bun" ] && source "/home/laurent/.bun/_bun" [ -s "/home/laurent/.bun/_bun" ] && source "/home/laurent/.bun/_bun"
# Shell-GPT integration ZSH v0.2
_sgpt_zsh() {
if [[ -n "$BUFFER" ]]; then
_sgpt_prev_cmd=$BUFFER
BUFFER+="⌛"
zle -I && zle redisplay
BUFFER=$(sgpt --shell <<< "$_sgpt_prev_cmd" --no-interaction)
zle end-of-line
fi
}
zle -N _sgpt_zsh
bindkey ^l _sgpt_zsh
# Shell-GPT integration ZSH v0.2
# bun # bun
export BUN_INSTALL="$HOME/.bun" export BUN_INSTALL="$HOME/.bun"
export PATH="$HOME/go/bin:$BUN_INSTALL/bin:$PATH" export PATH="$HOME/go/bin:$BUN_INSTALL/bin:$HOME/.local/bin:$PATH"