mirror of
https://github.com/IlanCosman/tide.git
synced 2024-12-23 03:52:12 +03:00
Update prompt_var mechanics
This commit is contained in:
parent
a1949f0e7f
commit
0a9c0d3d26
@ -1,17 +1,17 @@
|
||||
function _tide_1_line_prompt
|
||||
set -g add_prefix
|
||||
_tide_side=right for item in $_tide_right_items
|
||||
_tide_item_$item
|
||||
end
|
||||
set_color $prev_bg_color -b normal
|
||||
echo -s $tide_right_prompt_suffix
|
||||
|
||||
set -g add_prefix
|
||||
_tide_side=left for item in $_tide_left_items
|
||||
_tide_item_$item
|
||||
end
|
||||
set_color $prev_bg_color -b normal
|
||||
echo -s $tide_left_prompt_suffix
|
||||
echo $tide_left_prompt_suffix
|
||||
|
||||
set -g add_prefix
|
||||
_tide_side=right for item in $_tide_right_items
|
||||
_tide_item_$item
|
||||
end
|
||||
set_color $prev_bg_color -b normal
|
||||
echo $tide_right_prompt_suffix
|
||||
end
|
||||
|
||||
function _tide_item_pwd
|
||||
|
@ -1,15 +1,15 @@
|
||||
function _tide_2_line_prompt
|
||||
set -g add_prefix
|
||||
_tide_side=left set -f left (for item in $_tide_left_items
|
||||
_tide_item_$item
|
||||
end)
|
||||
_tide_side=left for item in $_tide_left_items
|
||||
_tide_item_$item
|
||||
end
|
||||
|
||||
echo
|
||||
|
||||
set -g add_prefix
|
||||
_tide_side=right set -f right (for item in $_tide_right_items
|
||||
_tide_item_$item
|
||||
end)
|
||||
|
||||
echo -ns "$right[2]"\n"$left[1]"\n"$right[1]"\n"$left[2]"
|
||||
_tide_side=right for item in $_tide_right_items
|
||||
_tide_item_$item
|
||||
end
|
||||
end
|
||||
|
||||
function _tide_item_pwd
|
||||
|
@ -7,10 +7,8 @@ _tide_remove_unusable_items
|
||||
_tide_cache_variables
|
||||
source (functions --details _tide_pwd)
|
||||
|
||||
# The first element in $$prompt_var is right prompt
|
||||
# All remaining ones are 'left' prompt (also upper right in 2-line prompts)
|
||||
set -l prompt_var _tide_prompt_$fish_pid
|
||||
set -U $prompt_var # So that if we erase $prompt_var, the bg job can't set a uvar
|
||||
set -U $prompt_var # Set var here so if we erase $prompt_var, bg job won't a uvar
|
||||
|
||||
# _tide_repaint prevents us from creating a second background job
|
||||
function _tide_refresh_prompt --on-variable $prompt_var
|
||||
@ -46,15 +44,15 @@ CMD_DURATION=\$CMD_DURATION fish_bind_mode=\$fish_bind_mode set $prompt_var (_ti
|
||||
set -l _tide_last_pid \$last_pid
|
||||
end
|
||||
|
||||
math \$COLUMNS-(string length --visible \"\$$prompt_var[1][2]\$$prompt_var[1][3]\")+$column_offset | read -lx dist_btwn_sides
|
||||
math \$COLUMNS-(string length --visible \"\$$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][2]\")'$prompt_and_framce_color'
|
||||
echo -ns $add_newline'$top_left_frame'(string replace @PWD@ (_tide_pwd) \"\$$prompt_var[1][1]\")'$prompt_and_framce_color'
|
||||
string repeat --no-newline --max (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][4] \"
|
||||
echo -ns \"\$$prompt_var[1][3]$top_right_frame\"\n\"$bot_left_frame\$$prompt_var[1][2] \"
|
||||
end
|
||||
|
||||
function fish_right_prompt
|
||||
string unescape \"\$$prompt_var[1][1]$bot_right_frame\"
|
||||
string unescape \"\$$prompt_var[1][4]$bot_right_frame\"
|
||||
end"
|
||||
else # one line prompt initialization
|
||||
test "$tide_prompt_add_newline_before" = true && set -l add_newline '\0'
|
||||
@ -74,12 +72,12 @@ CMD_DURATION=\$CMD_DURATION fish_bind_mode=\$fish_bind_mode set $prompt_var (_ti
|
||||
set -l _tide_last_pid \$last_pid
|
||||
end
|
||||
|
||||
math \$COLUMNS-(string length --visible \"\$$prompt_var[1][2]\$$prompt_var[1][3]\")$column_offset | read -lx dist_btwn_sides
|
||||
string replace @PWD@ (_tide_pwd) $add_newline \$$prompt_var[1][2]' '
|
||||
math \$COLUMNS-(string length --visible \"\$$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
|
||||
|
||||
function fish_right_prompt
|
||||
string unescape \$$prompt_var[1][1]
|
||||
string unescape \$$prompt_var[1][2]
|
||||
end"
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user