AutoYADM commit: 2025-05-25 23:24:17

This commit is contained in:
Daniel Fichtinger 2025-05-25 23:24:17 -04:00
parent 0a7eec16bc
commit dadf5d2b3e
3 changed files with 61 additions and 40 deletions

View file

@ -36,34 +36,36 @@ declare-option -docstring %{
} str bar_inactive_modified_fmt '%s %s+'
define-command -hidden bar-buflist %{
evaluate-commands %sh{
# starttime=$(date +%s.%N)
list=''
while read buf; do
if [ "$buf" = '*debug*' ]; then
continue
fi
index=$(($index + 1))
if [ "$buf" = "$kak_bufname" ]; then
if [ "$kak_modified" = "true" ]; then
cur=$(printf "$kak_opt_bar_active_modified_fmt" "$index" "$buf")
else
cur=$(printf "$kak_opt_bar_active_fmt" "$index" "$buf")
fi
else
cur=$(printf "$kak_opt_bar_inactive_fmt" "$index" "$buf")
fi
list="$list $cur"
done <<<$(printf '%s\n' "$kak_buflist" | perl -nE 'say for /(\*[^*]+\*|\S+)/g')
title="$list - $kak_client@[$kak_session]"
# endtime=$(date +%s.%N)
printf "set-option -add global ui_options %%{terminal_title=%s}\n" "$title"
# printf "info 'time elapsed: %s ms'" "$(echo "$endtime - $starttime" | bc -l)"
#!/bin/sh
list=''
index=0
while read buf; do
if [ "$buf" = '*debug*' ]; then
continue
fi
index=$((index + 1))
if [ "$buf" = "$kak_bufname" ]; then
if [ "$kak_modified" = "true" ]; then
cur=$(printf "$kak_opt_bar_active_modified_fmt" "$index" "$buf")
else
cur=$(printf "$kak_opt_bar_active_fmt" "$index" "$buf")
fi
else
cur=$(printf "$kak_opt_bar_inactive_fmt" "$index" "$buf")
fi
list="$list $cur"
done <<EOF
$(printf '%s\n' "$kak_buflist" | awk '{gsub(/\*[^*]+\*|[^[:space:]]+/,"&\n"); print}')
EOF
title="$list - $kak_client@[$kak_session]"
printf "set-option -add global ui_options %%{terminal_title=%s}\n" "$title"
}
}
hook global WinDisplay .* bar-buflist
hook global FocusIn .* bar-buflist
hook global FocusOut .* bar-buflist
hook global WinCreate .* bar-buflist
hook global BufWritePost .* bar-buflist
hook global ModeChange .* bar-buflist
# hook global WinDisplay .* bar-buflist
# hook global FocusIn .* bar-buflist
# hook global FocusOut .* bar-buflist
# hook global WinCreate .* bar-buflist
# hook global BufWritePost .* bar-buflist
# hook global ModeChange .* bar-buflist