zsh: add aichat widget
This commit is contained in:
parent
62bf723da6
commit
597733430e
2 changed files with 12 additions and 0 deletions
common/.config/zsh/config
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue