From ff3123298a7ec9050a0f6db338a65335bb16afb2 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Mon, 23 Jun 2025 15:35:14 -0400 Subject: [PATCH] AutoYADM commit: 2025-06-23 15:35:14 --- .config/kak/autoload/expand.kak | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/.config/kak/autoload/expand.kak b/.config/kak/autoload/expand.kak index 9435beee..1bc54ec9 100644 --- a/.config/kak/autoload/expand.kak +++ b/.config/kak/autoload/expand.kak @@ -1,5 +1,6 @@ provide-module expand %— - define-command expand-impl %{ + define-command -hidden -params 1 expand-impl %{ + # param expand or shrink evaluate-commands -itersel %sh{ sel="$kak_selection_desc" left=${sel%%,*} @@ -8,16 +9,29 @@ provide-module expand %— right_d=${right#*.} if [ "$left_d" -gt "$right_d" ]; then # sel facing back - echo 'execute-keys HL' + if [ "$1" = 'expand' ]; then + echo 'execute-keys "HL"' + else + echo 'execute-keys "LH"' + fi elif [ "$left_d" -lt "$right_d" ]; then # sel facing forward - echo 'execute-keys LH' + if [ "$1" = 'expand' ]; then + echo 'execute-keys "LH"' + else + echo 'execute-keys "HL"' + fi else echo 'nop' #single cursor do nothing fi } } - define-command shrink %{ - execute-keys 'HL' + define-command expand-selections %{ + expand-impl expand } + define-command shrink-selections %{ + expand-impl shrink + } + map global object ': expand-selections' + map global object ': shrink-selections' —