From ed7a737cf218bad0bc022002c0ab1bd84ba7859e Mon Sep 17 00:00:00 2001 From: Laurent Le Houerou Date: Sun, 2 Jun 2024 21:49:44 +0400 Subject: [PATCH] sgpt setup in zshrc --- zsh/.zshrc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/zsh/.zshrc b/zsh/.zshrc index f844953..056a41a 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -80,6 +80,7 @@ alias vi="nvim" alias vim="nvim" alias lg="lazygit" alias cc="clear" +alias sgpts="sgpt --shell" # Shell integrations eval "$(fzf --zsh)" @@ -88,6 +89,20 @@ eval "$(zoxide init --cmd cd zsh)" # bun completions [ -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 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"