From 95f143dc51d902bdd1b4c46e9ddbebd2c2f0d910 Mon Sep 17 00:00:00 2001 From: Ilan Cosman Date: Wed, 12 Jan 2022 10:24:41 -0800 Subject: [PATCH] Shorten and combine options --- functions/_tide_item_git.fish | 6 +++--- functions/_tide_item_status.fish | 2 +- functions/_tide_pwd.fish | 4 ++-- functions/fish_prompt.fish | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/functions/_tide_item_git.fish b/functions/_tide_item_git.fish index aaa13ae..27a600d 100644 --- a/functions/_tide_item_git.fish +++ b/functions/_tide_item_git.fish @@ -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 diff --git a/functions/_tide_item_status.fish b/functions/_tide_item_status.fish index 0c3e5e3..3a040fd 100644 --- a/functions/_tide_item_status.fish +++ b/functions/_tide_item_status.fish @@ -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 diff --git a/functions/_tide_pwd.fish b/functions/_tide_pwd.fish index 4140598..1fc2745 100644 --- a/functions/_tide_pwd.fish +++ b/functions/_tide_pwd.fish @@ -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.)\" \$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 diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 6657a4d..4399586 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -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 -- knotmirror 0.0.1