tide/functions/_tide_print_item.fish

39 lines
1.5 KiB
Fish
Raw Normal View History

2021-04-23 23:58:28 +03:00
function _tide_print_item -a item
2021-05-12 23:13:51 +03:00
item_bg_color_name=tide_"$item"_bg_color set item_bg_color $$item_bg_color_name
2021-04-23 23:58:28 +03:00
2021-04-25 03:40:43 +03:00
if test "$_tide_which_side_working_on" = left
2021-05-08 23:08:36 +03:00
if test "$_tide_last_item" = newline
2021-04-25 03:42:12 +03:00
if test "$item" != character
2021-05-12 23:13:51 +03:00
set_color $item_bg_color -b normal
2021-04-25 03:40:43 +03:00
printf '%s' $tide_left_prompt_prefix
end
2021-05-12 23:13:51 +03:00
else if test "$item_bg_color" = "$_tide_previous_bg_color"
2021-05-20 18:46:39 +03:00
set_color $tide_prompt_color_separator_same_color
printf '%s' $tide_left_prompt_separator_same_color
2021-04-25 03:40:43 +03:00
else
2021-05-12 23:13:51 +03:00
set_color $_tide_previous_bg_color -b $item_bg_color
2021-05-20 18:46:39 +03:00
printf '%s' $tide_left_prompt_separator_diff_color
2021-04-23 23:58:28 +03:00
end
2021-05-08 23:08:36 +03:00
else if test "$_tide_last_item" = newline
2021-05-12 23:13:51 +03:00
set_color $item_bg_color -b normal
2021-05-08 23:08:36 +03:00
printf '%s' $tide_right_prompt_prefix
2021-05-12 23:13:51 +03:00
else if test "$item_bg_color" = "$_tide_previous_bg_color"
2021-05-20 18:46:39 +03:00
set_color $tide_prompt_color_separator_same_color
printf '%s' $tide_right_prompt_separator_same_color
2021-04-23 23:58:28 +03:00
else
2021-05-12 23:13:51 +03:00
set_color $item_bg_color -b $_tide_previous_bg_color
2021-05-20 18:46:39 +03:00
printf '%s' $tide_right_prompt_separator_diff_color
2021-04-23 23:58:28 +03:00
end
2021-05-13 22:53:57 +03:00
item_color_name=tide_"$item"_color set_color $$item_color_name -b $item_bg_color
2021-04-23 23:58:28 +03:00
2021-04-26 23:27:02 +03:00
if test "$tide_prompt_pad_items" = true -a "$item" != character
printf '%s' ' ' $argv[2..] ' '
2021-04-26 23:27:02 +03:00
else
printf '%s' $argv[2..]
2021-04-26 23:27:02 +03:00
end
2021-04-23 23:58:28 +03:00
2021-05-12 23:13:51 +03:00
set -g _tide_previous_bg_color $item_bg_color
2021-05-08 23:08:36 +03:00
set -g _tide_last_item $item
2021-04-23 23:58:28 +03:00
end