config/zsh: implement aichat
This commit is contained in:
parent
3b40c16b0c
commit
d1ef716aa4
|
@ -189,8 +189,13 @@ source_existing() {
|
|||
done
|
||||
}
|
||||
|
||||
source_existing $CONFIG_ZSH/.p10k.zsh # To customize prompt, run `p10k configure` or edit .p10k.zsh.
|
||||
source_existing $CONFIG_ZSH/sgpt.zsh
|
||||
# To customize p10k prompt, run `p10k configure` or edit .p10k.zsh.
|
||||
source $CONFIG_ZSH/.p10k.zsh
|
||||
source $CONFIG_ZSH/aichat.zsh
|
||||
for file in $(find "$CONFIG_ZSH" -name '*.zsh')
|
||||
do #echo "sourcing $file"
|
||||
# . $file
|
||||
done
|
||||
source_existing /usr/share/fzf/key-bindings.zsh /usr/share/fzf/completion.zsh
|
||||
|
||||
source_existing "$NVM_DIR/nvm.sh"
|
||||
|
@ -205,3 +210,4 @@ source_existing $HOME/.nix-profile/etc/profile.d/nix.sh
|
|||
which direnv >/dev/null && eval "$(direnv hook zsh)"
|
||||
|
||||
true
|
||||
l
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
# https://github.com/sigoden/aichat/blob/main/scripts/shell-integration/integration.zsh
|
||||
_aichat_zsh() {
|
||||
if [[ -n "$BUFFER" ]]; then
|
||||
local _old=$BUFFER
|
||||
BUFFER+="⌛"
|
||||
zle -I && zle redisplay
|
||||
BUFFER=$(aichat -e "$_old")
|
||||
zle end-of-line
|
||||
fi
|
||||
}
|
||||
zle -N _aichat_zsh
|
||||
# bindkey '\ee' _aichat_zsh
|
||||
# Original above, this inspired by jsgpt
|
||||
bindkey '^o' _aichat_zsh
|
Loading…
Reference in New Issue