tide/functions/_tide_left_prompt.fish

48 lines
1.5 KiB
Fish
Raw Normal View History

2020-05-20 20:05:33 +03:00
function _tide_left_prompt
2021-03-04 22:06:17 +03:00
set -l lastItem newline
2020-06-25 05:45:50 +03:00
for item in $tide_left_prompt_items
2021-03-02 20:46:40 +03:00
if test "$item" = newline
2020-11-25 07:20:39 +03:00
set_color $previousColor -b normal
printf '%s' $tide_left_prompt_suffix\n
else
set -l output (_tide_item_$item)
2021-03-04 22:06:17 +03:00
test -n "$output" || continue
2020-06-29 22:32:56 +03:00
2021-03-04 22:06:17 +03:00
set -l colorName tide_"$item"_bg_color
set -l color $$colorName
2020-06-25 05:45:50 +03:00
2021-03-04 22:06:17 +03:00
if test "$lastItem" = newline
if test "$item" != prompt_char
set_color $color -b normal
printf '%s' $tide_left_prompt_prefix
2020-07-04 23:47:08 +03:00
end
2021-03-04 22:06:17 +03:00
else if test "$color" = "$previousColor"
set_color $tide_left_prompt_item_separator_same_color_color
printf '%s' $tide_left_prompt_item_separator_same_color
else
set_color $previousColor -b $color
printf '%s' $tide_left_prompt_item_separator_diff_color
end
2020-06-27 00:59:35 +03:00
2021-03-04 22:06:17 +03:00
set_color -b $color
2020-07-04 23:47:08 +03:00
2021-03-04 22:06:17 +03:00
if test "$tide_left_prompt_pad_items" = true -a "$item" != prompt_char
printf '%s' " $output "
else
printf '%s' "$output"
2020-07-04 23:47:08 +03:00
end
2021-03-04 22:06:17 +03:00
set previousColor $color
2020-06-30 05:54:59 +03:00
end
2021-03-04 22:06:17 +03:00
set lastItem $item
2020-05-20 20:05:33 +03:00
end
2020-06-30 21:49:37 +03:00
2021-03-04 22:06:17 +03:00
if test "$lastItem" != newline -a "$lastItem" != prompt_char
set_color $previousColor -b normal
printf '%s' $tide_left_prompt_suffix
2020-06-30 21:49:37 +03:00
end
2021-03-04 22:05:49 +03:00
set_color normal
2021-03-02 20:46:40 +03:00
end