diff --git a/.config/zsh/autoload/git/git-last-changed b/.config/zsh/autoload/git/git-last-changed index 9e09434..0fe40f5 100755 --- a/.config/zsh/autoload/git/git-last-changed +++ b/.config/zsh/autoload/git/git-last-changed @@ -22,4 +22,9 @@ ls -1p --color="$color_set" "$@" \ done \ | sort -r -t$'\t' -k2,2 \ | column -s$'\t' -t \ -| cut -c -"$COLUMNS" +| env COLUMNS="$COLUMNS" awk \ + '{ + sanit = gensub(/\033\[[0-9;]*m/, "", "g", $0); + trunc_len = ENVIRON["COLUMNS"] + length($0) - length(sanit) - 3; + print gensub("^(.{" trunc_len "}).{4,}$", "\\1...", "g") + }'