dotfiles/.config/kak/autoload/expand.kak

23 lines
705 B
Text

provide-module expand %—
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 H<a-;>L<a-;>'
elif [ "$left_d" -lt "$right_d" ]; then
# sel facing forward
echo 'execute-keys L<a-;>H<a-;>'
else
echo 'nop' #single cursor do nothing
fi
}
}
define-command shrink %{
execute-keys '<a-:>H<a-;>L'
}