From ba437c354ac7a8398032df79508038bbe3bff19a Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Wed, 21 May 2025 23:21:52 -0400 Subject: [PATCH] AutoYADM commit: 2025-05-21 23:21:52 --- .config/fish/functions/kak-session.fish | 2 ++ .config/kak/autoload/title.kak | 22 ++++++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.config/fish/functions/kak-session.fish b/.config/fish/functions/kak-session.fish index 3fca4023..6354a948 100644 --- a/.config/fish/functions/kak-session.fish +++ b/.config/fish/functions/kak-session.fish @@ -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 diff --git a/.config/kak/autoload/title.kak b/.config/kak/autoload/title.kak index d2e91b61..f9cf204f 100644 --- a/.config/kak/autoload/title.kak +++ b/.config/kak/autoload/title.kak @@ -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 - cur=$(printf "$kak_opt_bar_active_fmt" "$index" "$buf") + 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