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

@ -24,7 +24,7 @@ define-command -hidden -override lsp-hide-code-actions %{
set-option global lsp_debug false set-option global lsp_debug false
# list of filetypes for which LSP will be activated in the window scope # list of filetypes for which LSP will be activated in the window scope
declare-option str-list lsp_filetypes python go rust bash fish c cpp typst markdown yaml json jsonc declare-option str-list lsp_filetypes python go rust bash fish c cpp typst markdown yaml json jsonc bash sh
define-command -hidden lsp-filetype-hooks-update %{ define-command -hidden lsp-filetype-hooks-update %{
try %{ remove-hooks global lsp-filetypes } try %{ remove-hooks global lsp-filetypes }

View file

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

View file

@ -31,17 +31,36 @@ define-command ui-scrolloff-enable %{
define-command ui-scrolloff-toggle -docstring "toggle scrolloff" %{ define-command ui-scrolloff-toggle -docstring "toggle scrolloff" %{
evaluate-commands %sh{ evaluate-commands %sh{
CUR="$kak_opt_scrolloff" # CUR="$kak_opt_scrolloff"
IFS=, # IFS=,
read TARG HOR <<<$kak_opt_base_scrolloff # read TARG HOR <<<$kak_opt_base_scrolloff
IFS=, # IFS=,
read VSCROLL _ <<<$kak_opt_scrolloff # read VSCROLL _ <<<$kak_opt_scrolloff
if [ "$VSCROLL" = 99 ]; then # if [ "$VSCROLL" = 99 ]; then
final="$TARG,$HOR" # final="$TARG,$HOR"
else # else
final="99,$HOR" # final="99,$HOR"
fi # fi
echo "set-option window scrolloff $final" # echo "set-option window scrolloff $final"
# Parse base_scrolloff
IFS=, set -- $kak_opt_base_scrolloff
TARG=${1:-0}
HOR=${2:-0}
# Parse current scrolloff
IFS=, set -- $kak_opt_scrolloff
VSCROLL=${1:-0}
CURHOR=${2:-0}
# Build the new scrolloff value
if [ "$VSCROLL" = 99 ]; then
final="$TARG,$HOR"
else
final="$VSCROLL,$CURHOR"
fi
echo "set-option window scrolloff $final"
} }
} }