From 2d5474005ca6814b6c7b4f10c852ba977ae59283 Mon Sep 17 00:00:00 2001 From: Ilan Cosman Date: Wed, 22 Dec 2021 14:59:52 -0800 Subject: [PATCH] Further optimize pwd truncation --- functions/_tide_pwd.fish | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/functions/_tide_pwd.fish b/functions/_tide_pwd.fish index e9b9d04..dd2488b 100644 --- a/functions/_tide_pwd.fish +++ b/functions/_tide_pwd.fish @@ -27,9 +27,8 @@ function _tide_pwd end set split_output[$i] $_tide_color_anchors$dir_section$_tide_reset_to_color_dirs else if test $pwd_length -gt $dist_btwn_sides - trunc_len=1 while string match -qr "(?.{$trunc_len})" $dir_section && - test (count $parent_dir/$trunc*/) != 1 - math $trunc_len+1 | read trunc_len + set -l trunc + while string match -qr "(?$trunc.)" $dir_section && test (count $parent_dir/$trunc*/) != 1 end test -n "$trunc" && set split_output[$i] $_tide_color_truncated_dirs$trunc$_tide_reset_to_color_dirs && string join / $split_output | string length --visible | read -g pwd_length