AutoYADM commit: 2025-05-21 23:21:52

This commit is contained in:
Daniel Fichtinger 2025-05-21 23:21:52 -04:00
parent 314cefd1ca
commit ba437c354a
2 changed files with 22 additions and 2 deletions

View file

@ -90,6 +90,8 @@ function kak-session -w kak --description "kakoune where sessions are derived fr
else
command kak -s "$session_id" -e "cd %[$kakroot]" $flags $files
end
else
command kak -c "$session_id" $flags $files
end
else if [ -n "$git_dir" ]
# when in a git directory, share sessions

View file

@ -14,10 +14,20 @@ declare-option -docstring %{
It receives two string arguments, where the first is the buffer index,
and the second is the buffer name.
Default: '[%s %s]+'
} str bar_active_modified_fmt '[%s %s]+'
declare-option -docstring %{
Format string passed to printf for the bufferlist.
It should be set in the global scope.
It receives two string arguments, where the first is the buffer index,
and the second is the buffer name.
Default: '%s %s'
} str bar_inactive_fmt '%s %s'
define-command -hidden bar-buflist %{
evaluate-commands %sh{
starttime=$(date +%s%3N)
list=''
while read buf; do
if [ "$buf" = '*debug*' ]; then
@ -25,14 +35,20 @@ define-command -hidden bar-buflist %{
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%3N)
printf "set-option -add global ui_options %%{terminal_title=%s}" "$title"
printf "info 'time elapsed: %s ms'" "$((end - start))"
}
}
@ -40,4 +56,6 @@ hook global WinDisplay .* bar-buflist
hook global FocusIn .* bar-buflist
hook global FocusOut .* bar-buflist
hook global WinCreate .* bar-buflist
hook global BufClose .* bar-buflist
hook global NormalIdle .* bar-buflist
hook global BufWritePost .* bar-buflist
hook global ModeChange .* bar-buflist