AutoYADM commit: 2025-05-21 20:58:39

This commit is contained in:
Daniel Fichtinger 2025-05-21 20:58:39 -04:00
parent fefa63d54b
commit 9b953c36e0
2 changed files with 22 additions and 4 deletions

View file

@ -86,7 +86,7 @@ function kak-session -w kak --description "kakoune where sessions are derived fr
cat $fifo >/dev/null cat $fifo >/dev/null
command rm -r "$fifo_dir" command rm -r "$fifo_dir"
command kak -c "$session_id" $flags $files command kak -c "$session_id" -e 'try %{ delete-buffer *scratch*; bar-buflist; echo }' $flags $files
else else
command kak -s "$session_id" -e "cd %[$kakroot]" $flags $files command kak -s "$session_id" -e "cd %[$kakroot]" $flags $files
end end
@ -114,7 +114,7 @@ function kak-session -w kak --description "kakoune where sessions are derived fr
setsid kak -d -s "$session_id" -E "cd %[$git_dir]; echo -to-file $fifo ready" & setsid kak -d -s "$session_id" -E "cd %[$git_dir]; echo -to-file $fifo ready" &
cat $fifo >/dev/null cat $fifo >/dev/null
command rm -r "$fifo_dir" command rm -r "$fifo_dir"
command kak -c "$session_id" -e 'try %{ delete-buffer *scratch* }' $flags $files command kak -c "$session_id" -e 'try %{ delete-buffer *scratch*; bar-buflist; echo }' $flags $files
else else
command kak -s "$session_id" -e "cd %[$git_dir]" $flags $files command kak -s "$session_id" -e "cd %[$git_dir]" $flags $files
end end

View file

@ -1,3 +1,21 @@
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_active_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 %{ define-command -hidden bar-buflist %{
evaluate-commands %sh{ evaluate-commands %sh{
list='' list=''
@ -7,9 +25,9 @@ define-command -hidden bar-buflist %{
fi fi
index=$(($index + 1)) index=$(($index + 1))
if [ "$buf" = "$kak_bufname" ]; then if [ "$buf" = "$kak_bufname" ]; then
cur=$(printf '[%s %s]' "$index" "$buf") cur=$(printf "$kak_opt_bar_active_fmt" "$index" "$buf")
else else
cur=$(printf '%s %s' "$index" "$buf") cur=$(printf "$kak_opt_bar_inactive_fmt" "$index" "$buf")
fi fi
list="$list $cur" list="$list $cur"
done <<<$(printf '%s\n' "$kak_buflist" | perl -nE 'say for /(\*[^*]+\*|\S+)/g') done <<<$(printf '%s\n' "$kak_buflist" | perl -nE 'say for /(\*[^*]+\*|\S+)/g')