2
0

add ais (rust fuzzy selector) and atproto plugin

This commit is contained in:
ai
2026-04-03 08:51:57 +00:00
parent 67c20e9dab
commit 3a6f31e861
4 changed files with 333 additions and 0 deletions

42
.zsh/plugin/ais.zsh Normal file
View File

@@ -0,0 +1,42 @@
# ais - ai selector (Rust)
# unified fuzzy finder replacing cdselect/fileselect/histselect
# requires: ais binary in PATH
if ! command -v ais &>/dev/null; then
return
fi
# C-j: directory selector
ais-cd() {
local dir=$(ais cd)
if [[ -n "$dir" ]]; then
cd "$dir"
fi
zle reset-prompt
}
zle -N ais-cd
bindkey '^j' ais-cd
# C-f: file selector -> insert into buffer
ais-file() {
local file=$(ais file)
if [[ -n "$file" ]]; then
BUFFER+="$file"
CURSOR=${#BUFFER}
fi
zle reset-prompt
}
zle -N ais-file
bindkey '^f' ais-file
# C-r: history selector -> insert into buffer
ais-hist() {
local cmd=$(ais hist)
if [[ -n "$cmd" ]]; then
BUFFER="$cmd"
CURSOR=${#BUFFER}
fi
zle reset-prompt
}
zle -N ais-hist
bindkey '^r' ais-hist

31
.zsh/plugin/atproto.zsh Normal file
View File

@@ -0,0 +1,31 @@
# atproto shell integration
# quick commands for atproto/ailog
if ! command -v ailog &>/dev/null; then
return
fi
# at: quick post
at() {
if [[ -z "$1" ]]; then
echo "usage: at <text>"
return 1
fi
ailog reply "$*" 2>/dev/null
}
# atn: check notifications
atn() {
local count=$(ailog notify count 2>/dev/null | jq -r '.count // 0' 2>/dev/null)
if [[ "$count" -gt 0 ]]; then
echo "\e[33m${count}\e[0m notifications"
ailog notify list 2>/dev/null | jq -r '.notifications[:5][] | "\(.reason) from @\(.author.handle // "unknown")"' 2>/dev/null
else
echo "no notifications"
fi
}
# atw: who am i
atw() {
ailog pds s 2>/dev/null | jq -r '"@\(.handle) on \(.pds)"' 2>/dev/null
}