1
0
Fork 0

zsh: add aichat widget

This commit is contained in:
Luca Bilke 2025-02-26 18:20:17 +01:00
parent 62bf723da6
commit 597733430e
Signed by: luca
GPG key ID: F6E11C9BAA7C82F5
2 changed files with 12 additions and 0 deletions
common/.config/zsh/config

View file

@ -48,6 +48,7 @@ global_keybinds=(
"$key_info[ControlLeft]" backward-word
"$key_info[ControlRight]" forward-word
"$key_info[Control]E" lf-wrap
"$key_info[Control]A" ai-command
"$key_info[Control]G" lazygit-wrap
"$key_info[Control]S" toggle-fzf-tab
"$key_info[Control]Z" fancy-ctrl-z

View file

@ -14,6 +14,17 @@ function reset_prompt() {
zle reset-prompt
}
function ai-command() {
if [[ -n "$BUFFER" ]]; then
local _old=$BUFFER
BUFFER+=" 󰚭"
zle -I && zle redisplay
BUFFER=$(aichat -e "$_old")
zle end-of-line
fi
}
zle -N ai-command
# Cursor Shape
function zle-keymap-select() {
case $KEYMAP in