Rename var

This commit is contained in:
Ilan Cosman 2022-01-26 09:35:35 -08:00
parent 0a11fe5fd7
commit d75e4be05a
4 changed files with 6 additions and 6 deletions

View File

@ -19,7 +19,7 @@ eval "function _tide_pwd
set -l split_output \"$reset_to_color_dirs\$icon\" \"$color_anchors\$split_pwd[2]$reset_to_color_dirs\" \$split_pwd[3..]
set split_output[-1] \"$color_anchors\$split_pwd[-1]$reset_to_color_dirs\"
string join / \$split_output | string length -V | read -g pwd_length
string join / \$split_output | string length -V | read -g _tide_pwd_len
i=1 for dir_section in \$split_pwd[2..-2]
string join -- / \$split_pwd[..\$i] | string replace '~' $HOME | read -l parent_dir # Uses i before increment
@ -30,12 +30,12 @@ eval "function _tide_pwd
test -e \$parent_dir/\$dir_section/\$marker && break
end
set split_output[\$i] \"$color_anchors\$dir_section$reset_to_color_dirs\"
else if test \$pwd_length -gt \$dist_btwn_sides
else if test \$_tide_pwd_len -gt \$dist_btwn_sides
set -l trunc
while string match -qr \"(?<trunc>\$trunc.)\" \$dir_section && test (count \$parent_dir/\$trunc*/) != 1
end
test -n \"\$trunc\" && set split_output[\$i] \"$color_truncated\$trunc$reset_to_color_dirs\" &&
string join / \$split_output | string length -V | read pwd_length
string join / \$split_output | string length -V | read _tide_pwd_len
end
end

View File

@ -48,7 +48,7 @@ CMD_DURATION=\$CMD_DURATION fish_bind_mode=\$fish_bind_mode set $prompt_var (_ti
math \$COLUMNS-(string length -V \"\$$prompt_var[1][1]\$$prompt_var[1][3]\")+$column_offset | read -lx dist_btwn_sides
echo -ns $add_newline'$top_left_frame'(string replace @PWD@ (_tide_pwd) \"\$$prompt_var[1][1]\")'$prompt_and_frame_color'
string repeat -Nm(math max 0, \$dist_btwn_sides-\$pwd_length) '$tide_prompt_icon_connection'
string repeat -Nm(math max 0, \$dist_btwn_sides-\$_tide_pwd_len) '$tide_prompt_icon_connection'
echo -ns \"\$$prompt_var[1][3]$top_right_frame\"\n\"$bot_left_frame\$$prompt_var[1][2] \"
end

View File

@ -29,7 +29,7 @@ function _fake_tide_prompt
math $fake_columns+5-(string length --visible "$left[1]$right[1]") | read -lx dist_btwn_sides
echo -ns "$right[2]"\n(string replace @PWD@ (_fake_tide_pwd) "$left[1]")$_fake_tide_prompt_and_frame_color
string repeat --no-newline --max (math max 0, $dist_btwn_sides-$pwd_length) $fake_tide_prompt_icon_connection
string repeat --no-newline --max (math max 0, $dist_btwn_sides-$_tide_pwd_len) $fake_tide_prompt_icon_connection
echo -ns "$right[1]"\n"$left[2] "
else
math $fake_columns+5-(string length --visible "$left[1]$right[1]") -$fake_tide_prompt_min_cols | read -lx dist_btwn_sides

View File

@ -1,5 +1,5 @@
function _fake_tide_pwd
set -g pwd_length 5
set -g _tide_pwd_len 5
echo -ns (set_color $fake_tide_pwd_color_dirs)$fake_tide_pwd_icon' ' \
(set_color -o $fake_tide_pwd_color_anchors)'~'(set_color normal -b $fake_tide_pwd_bg_color) \
(set_color $fake_tide_pwd_color_dirs)'/'(set_color normal -b $fake_tide_pwd_bg_color) \