AutoYADM commit: 2025-06-23 15:35:14

This commit is contained in:
Daniel Fichtinger 2025-06-23 15:35:14 -04:00
parent 64f5478f13
commit ff3123298a

View file

@ -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 H<a-;>L<a-;>'
if [ "$1" = 'expand' ]; then
echo 'execute-keys "H<a-;>L<a-;>"'
else
echo 'execute-keys "L<a-;>H<a-;>"'
fi
elif [ "$left_d" -lt "$right_d" ]; then
# sel facing forward
echo 'execute-keys L<a-;>H<a-;>'
if [ "$1" = 'expand' ]; then
echo 'execute-keys "L<a-;>H<a-;>"'
else
echo 'execute-keys "H<a-;>L<a-;>"'
fi
else
echo 'nop' #single cursor do nothing
fi
}
}
define-command shrink %{
execute-keys '<a-:>H<a-;>L'
define-command expand-selections %{
expand-impl expand
}
define-command shrink-selections %{
expand-impl shrink
}
map global object <a-e> ': expand-selections<ret>'
map global object <a-s> ': shrink-selections<ret>'