mirror of
https://github.com/prdlk/dotfiles.git
synced 2026-11-02 19:32:43 +00:00
13 lines
552 B
Fish
13 lines
552 B
Fish
function _agents_bind --description 'ctrl-a: pick an AI agent (tv agents --inline) and start it, then redraw the prompt'
|
|
# The cable's launch action writes `ran` to $AGENTS_STATE before exec'ing
|
|
# the agent. Cancelled: tv left the cursor on the line below the prompt, so
|
|
# step back up; ran: the prompt goes wherever the agent left the cursor.
|
|
set -lx AGENTS_STATE (mktemp)
|
|
tv agents --inline
|
|
if test "$(cat $AGENTS_STATE)" != ran
|
|
printf '\033[A' >/dev/tty
|
|
end
|
|
rm -f $AGENTS_STATE
|
|
commandline -f repaint
|
|
end
|