2020-11-21 01:04:04 +03:00
|
|
|
function _tide_prompt
|
2021-10-01 20:52:44 +03:00
|
|
|
set -g prev_item_was_newline
|
|
|
|
_tide_side=left set -f left (for item in $tide_left_prompt_items
|
2021-09-15 21:00:34 +03:00
|
|
|
_tide_item_$item
|
|
|
|
end
|
2021-10-01 20:52:44 +03:00
|
|
|
if not set -e prev_item_was_newline
|
|
|
|
set_color $prev_bg_color -b normal
|
2021-09-15 21:00:34 +03:00
|
|
|
echo -ns $tide_left_prompt_suffix
|
|
|
|
end)
|
|
|
|
|
2021-10-01 20:52:44 +03:00
|
|
|
set -g prev_item_was_newline
|
|
|
|
_tide_side=right set -f right (for item in $tide_right_prompt_items
|
2021-09-15 21:00:34 +03:00
|
|
|
_tide_item_$item
|
|
|
|
end
|
2021-10-01 20:52:44 +03:00
|
|
|
if not set -e prev_item_was_newline
|
|
|
|
set_color $prev_bg_color -b normal
|
2021-09-15 21:00:34 +03:00
|
|
|
echo -ns $tide_right_prompt_suffix
|
|
|
|
end)
|
|
|
|
|
|
|
|
if set -q _tide_prompt_and_frame_color # If prompt is two lines
|
2021-10-10 04:52:17 +03:00
|
|
|
test "$tide_left_prompt_frame_enabled" = true &&
|
|
|
|
set left[1] "$_tide_prompt_and_frame_color╭─$left[1]" &&
|
2021-10-01 20:52:44 +03:00
|
|
|
set left[2] "$_tide_prompt_and_frame_color╰─$left[2]"
|
2021-10-10 04:52:17 +03:00
|
|
|
test "$tide_right_prompt_frame_enabled" = true &&
|
|
|
|
set right[1] "$right[1]$_tide_prompt_and_frame_color─╮" &&
|
2021-10-01 20:52:44 +03:00
|
|
|
set right[2] "$right[2]$_tide_prompt_and_frame_color─╯"
|
2021-03-04 22:05:49 +03:00
|
|
|
|
2021-08-26 23:47:43 +03:00
|
|
|
# 5 = @PWD@ length which will be replaced
|
2021-10-01 20:52:44 +03:00
|
|
|
math $COLUMNS+5-(string length --visible "$left[1]$right[1]") | read -lx dist_btwn_sides
|
|
|
|
echo -ns "$right[2]"\n(string replace @PWD@ (_tide_pwd) "$left[1]")$_tide_prompt_and_frame_color
|
2021-06-27 22:15:10 +03:00
|
|
|
|
2021-09-08 06:51:16 +03:00
|
|
|
string repeat --no-newline --max (math max 0, $dist_btwn_sides-$pwd_length) $tide_prompt_icon_connection
|
2021-10-01 20:52:44 +03:00
|
|
|
echo -ns "$right[1]"\n"$left[2] "
|
2021-05-05 01:25:38 +03:00
|
|
|
else
|
2021-10-01 20:52:44 +03:00
|
|
|
math $COLUMNS+5-(string length --visible "$left[1]$right[1]") -$tide_prompt_min_cols | read -lx dist_btwn_sides
|
|
|
|
string replace @PWD@ (_tide_pwd) "$right[1]" "$left[1] "
|
2021-03-04 22:05:49 +03:00
|
|
|
end
|
2021-01-01 07:14:55 +03:00
|
|
|
end
|
2021-05-04 19:29:34 +03:00
|
|
|
|
2021-05-30 03:11:46 +03:00
|
|
|
function _tide_item_pwd
|
2021-07-03 21:24:29 +03:00
|
|
|
_tide_print_item pwd @PWD@
|
2021-05-30 03:11:46 +03:00
|
|
|
end
|