Shorten and combine options

This commit is contained in:
Ilan Cosman 2022-01-12 10:24:41 -08:00
parent 400f37104b
commit 95f143dc51
4 changed files with 9 additions and 9 deletions

View File

@ -1,14 +1,14 @@
function _tide_item_git
if git branch --show-current 2>/dev/null | string replace -r "(.{$tide_git_truncation_length}).+" '$1…' | read -l location
git rev-parse --git-dir --is-inside-git-dir | read -f --line git_dir inside_git_dir
git rev-parse --git-dir --is-inside-git-dir | read -fL git_dir inside_git_dir
set location $_tide_location_color$location
else if test $pipestatus[1] != 0
return
else if git tag --points-at HEAD | string replace -r "(.{$tide_git_truncation_length}).+" '$1…' | read location
git rev-parse --git-dir --is-inside-git-dir | read -f --line git_dir inside_git_dir
git rev-parse --git-dir --is-inside-git-dir | read -fL git_dir inside_git_dir
set location '#'$_tide_location_color$location
else
git rev-parse --git-dir --is-inside-git-dir --short HEAD | read -f --line git_dir inside_git_dir sha
git rev-parse --git-dir --is-inside-git-dir --short HEAD | read -fL git_dir inside_git_dir sha
set location @$_tide_location_color$sha
end

View File

@ -1,5 +1,5 @@
function _tide_item_status
if string match --quiet --invert 0 $_tide_pipestatus # If there is a failure anywhere in the pipestatus
if string match -qv 0 $_tide_pipestatus # If there is a failure anywhere in the pipestatus
if test "$_tide_pipestatus" = 1 # If simple failure
contains character $_tide_left_items || tide_status_bg_color=$tide_status_bg_color_failure \
tide_status_color=$tide_status_color_failure _tide_print_item status $tide_status_icon_failure' ' 1

View File

@ -29,7 +29,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 --visible | read -g pwd_length
string join / \$split_output | string length -V | read -g pwd_length
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
@ -45,7 +45,7 @@ eval "function _tide_pwd
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 --visible | read -g pwd_length
string join / \$split_output | string length -V | read -g pwd_length
end
end

View File

@ -44,10 +44,10 @@ CMD_DURATION=\$CMD_DURATION fish_bind_mode=\$fish_bind_mode set $prompt_var (_ti
set -g _tide_last_pid \$last_pid
end
math \$COLUMNS-(string length --visible \"\$$prompt_var[1][1]\$$prompt_var[1][3]\")+$column_offset | read -lx dist_btwn_sides
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 --no-newline --max (math max 0, \$dist_btwn_sides-\$pwd_length) '$tide_prompt_icon_connection'
string repeat -Nm(math max 0, \$dist_btwn_sides-\$pwd_length) '$tide_prompt_icon_connection'
echo -ns \"\$$prompt_var[1][3]$top_right_frame\"\n\"$bot_left_frame\$$prompt_var[1][2] \"
end
@ -72,7 +72,7 @@ CMD_DURATION=\$CMD_DURATION fish_bind_mode=\$fish_bind_mode set $prompt_var (_ti
set -g _tide_last_pid \$last_pid
end
math \$COLUMNS-(string length --visible \"\$$prompt_var[1][1]\$$prompt_var[1][2]\")$column_offset | read -lx dist_btwn_sides
math \$COLUMNS-(string length -V \"\$$prompt_var[1][1]\$$prompt_var[1][2]\")$column_offset | read -lx dist_btwn_sides
string replace @PWD@ (_tide_pwd) $add_newline \$$prompt_var[1][1]' '
end