From 64f5478f13fc92902d959ac3cfaa998dce6581c0 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Mon, 23 Jun 2025 15:30:15 -0400 Subject: [PATCH] AutoYADM commit: 2025-06-23 15:30:15 --- .config/kak/autoload/expand.kak | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.config/kak/autoload/expand.kak b/.config/kak/autoload/expand.kak index 7ac5bede..9435beee 100644 --- a/.config/kak/autoload/expand.kak +++ b/.config/kak/autoload/expand.kak @@ -1,6 +1,21 @@ provide-module expand %— - define-command expand %{ - execute-keys 'LH' + define-command expand-impl %{ + evaluate-commands -itersel %sh{ + sel="$kak_selection_desc" + left=${sel%%,*} + right=${sel##*,} + left_d=${left#*.} + right_d=${right#*.} + if [ "$left_d" -gt "$right_d" ]; then + # sel facing back + echo 'execute-keys HL' + elif [ "$left_d" -lt "$right_d" ]; then + # sel facing forward + echo 'execute-keys LH' + else + echo 'nop' #single cursor do nothing + fi + } } define-command shrink %{ execute-keys 'HL'