mirror of
https://github.com/IlanCosman/tide.git
synced 2024-10-26 18:51:05 +03:00
Some work, 1 line prompt functional, 2 line not
This commit is contained in:
parent
2a26fe2002
commit
60327b32db
@ -1,21 +1,17 @@
|
||||
function _tide_1_line_prompt
|
||||
set -g add_prefix
|
||||
_tide_side=left set -f left (for item in $_tide_left_items
|
||||
_tide_item_$item
|
||||
end
|
||||
set_color $prev_bg_color -b normal
|
||||
echo -ns $tide_left_prompt_suffix)
|
||||
|
||||
set -g add_prefix
|
||||
_tide_side=right set -f right (for item in $_tide_right_items
|
||||
_tide_side=right echo (for item in $_tide_right_items
|
||||
_tide_item_$item
|
||||
end
|
||||
set_color $prev_bg_color -b normal
|
||||
echo -ns $tide_right_prompt_suffix)
|
||||
|
||||
# 5 = @PWD@ length which will be replaced
|
||||
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] "
|
||||
set -g add_prefix
|
||||
_tide_side=left echo (for item in $_tide_left_items
|
||||
_tide_item_$item
|
||||
end
|
||||
set_color $prev_bg_color -b normal
|
||||
echo -ns $tide_left_prompt_suffix)
|
||||
end
|
||||
|
||||
function _tide_item_pwd
|
||||
|
@ -17,9 +17,8 @@ function _tide_2_line_prompt
|
||||
set right[2] "$right[2]$_tide_prompt_and_frame_color─╯"
|
||||
|
||||
# 5 = @PWD@ length which will be replaced
|
||||
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
|
||||
|
||||
# math $COLUMNS+5-(string length --visible "$left[1]$right[1]") | read -lx dist_btwn_sides
|
||||
echo -ns "$right[2]"\n"$left[1]"$_tide_prompt_and_frame_color
|
||||
string repeat --no-newline --max (math max 0, $dist_btwn_sides-$pwd_length) $tide_prompt_icon_connection
|
||||
echo -ns "$right[1]"\n"$left[2] "
|
||||
end
|
||||
|
@ -37,9 +37,14 @@ function _tide_cache_variables
|
||||
if contains newline $_tide_left_items
|
||||
set_color $tide_prompt_color_frame_and_connection -b normal | read -gx _tide_prompt_and_frame_color
|
||||
set -g _tide_X_line_prompt _tide_2_line_prompt
|
||||
|
||||
set -g column_offset +5
|
||||
else
|
||||
set -e _tide_prompt_and_frame_color
|
||||
set -g _tide_X_line_prompt _tide_1_line_prompt
|
||||
|
||||
math 5 -$tide_prompt_min_cols | read -g column_offset
|
||||
test $column_offset -gt 0 && set column_offset "+$column_offset"
|
||||
end
|
||||
|
||||
# newline before
|
||||
|
@ -22,15 +22,15 @@ function fish_prompt
|
||||
_tide_status=\$status _tide_pipestatus=\$pipestatus if not set -e _tide_repaint
|
||||
jobs -q && set -lx _tide_jobs
|
||||
fish -c \"set _tide_pipestatus \$_tide_pipestatus
|
||||
CMD_DURATION=\$CMD_DURATION COLUMNS=\$COLUMNS fish_bind_mode=\$fish_bind_mode \
|
||||
set $_tide_prompt_var ($_tide_X_line_prompt)\" &
|
||||
CMD_DURATION=\$CMD_DURATION fish_bind_mode=\$fish_bind_mode set $_tide_prompt_var ($_tide_X_line_prompt)\" &
|
||||
builtin disown
|
||||
|
||||
command kill \$_tide_last_pid 2>/dev/null
|
||||
set -g _tide_last_pid \$last_pid
|
||||
end
|
||||
|
||||
string unescape $_tide_add_newline \$$_tide_prompt_var[1][2..]
|
||||
|
||||
math \$COLUMNS-(string length --visible \"\$$_tide_prompt_var[1][..2]\")$column_offset | read -lx dist_btwn_sides
|
||||
string replace @PWD@ (_tide_pwd) $_tide_add_newline \$$_tide_prompt_var[1][2..]
|
||||
end
|
||||
|
||||
function fish_right_prompt
|
||||
@ -41,4 +41,4 @@ function _tide_on_fish_exit --on-event fish_exit
|
||||
set -e $_tide_prompt_var
|
||||
end"
|
||||
|
||||
set -e _tide_prompt_var _tide_X_line_prompt _tide_add_newline
|
||||
set -e column_offset _tide_prompt_var _tide_X_line_prompt _tide_add_newline
|
||||
|
Loading…
Reference in New Issue
Block a user