mirror of
https://github.com/IlanCosman/tide.git
synced 2024-11-26 09:42:51 +03:00
Minor edits
This commit is contained in:
parent
57f42f12e0
commit
01d6fcecca
@ -1,25 +1,22 @@
|
|||||||
function _tide_item_status
|
function _tide_item_status
|
||||||
|
# Variables are exported as strings, convert _tide_last_pipestatus back into a list
|
||||||
|
set -l _tide_last_pipestatus (string split ' ' $_tide_last_pipestatus)
|
||||||
|
|
||||||
if string match --quiet --invert 0 $_tide_last_pipestatus # If there is a failure anywhere in the pipestatus
|
if string match --quiet --invert 0 $_tide_last_pipestatus # If there is a failure anywhere in the pipestatus
|
||||||
if test "$_tide_last_pipestatus" = 1 # If simple failure
|
if test "$_tide_last_pipestatus" = 1 # If simple failure
|
||||||
if not contains character $tide_left_prompt_items
|
contains character $tide_left_prompt_items || tide_status_bg_color=$tide_status_bg_color_failure \
|
||||||
tide_status_bg_color=$tide_status_bg_color_failure \
|
tide_status_color=$tide_status_color_failure _tide_print_item status $tide_status_icon_failure' ' 1
|
||||||
tide_status_color=$tide_status_color_failure \
|
|
||||||
_tide_print_item status $tide_status_icon_failure' ' 1
|
|
||||||
end
|
|
||||||
else if test $_tide_last_status = 0
|
else if test $_tide_last_status = 0
|
||||||
tide_status_bg_color=$tide_status_bg_color_success \
|
tide_status_bg_color=$tide_status_bg_color_success tide_status_color=$tide_status_color_success \
|
||||||
tide_status_color=$tide_status_color_success \
|
|
||||||
_tide_print_item status $tide_status_icon_success' ' \
|
_tide_print_item status $tide_status_icon_success' ' \
|
||||||
(fish_status_to_signal $_tide_last_pipestatus | string replace SIG '' | string join '|')
|
(fish_status_to_signal $_tide_last_pipestatus | string replace SIG '' | string join '|')
|
||||||
else
|
else
|
||||||
tide_status_bg_color=$tide_status_bg_color_failure \
|
tide_status_bg_color=$tide_status_bg_color_failure tide_status_color=$tide_status_color_failure \
|
||||||
tide_status_color=$tide_status_color_failure \
|
|
||||||
_tide_print_item status $tide_status_icon_failure' ' \
|
_tide_print_item status $tide_status_icon_failure' ' \
|
||||||
(fish_status_to_signal $_tide_last_pipestatus | string replace SIG '' | string join '|')
|
(fish_status_to_signal $_tide_last_pipestatus | string replace SIG '' | string join '|')
|
||||||
end
|
end
|
||||||
else if not contains character $tide_left_prompt_items
|
else if not contains character $tide_left_prompt_items
|
||||||
tide_status_bg_color=$tide_status_bg_color_success \
|
tide_status_bg_color=$tide_status_bg_color_success tide_status_color=$tide_status_color_success \
|
||||||
tide_status_color=$tide_status_color_success \
|
|
||||||
_tide_print_item status $tide_status_icon_success
|
_tide_print_item status $tide_status_icon_success
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,16 +2,13 @@ function _tide_item_vi_mode
|
|||||||
test "$fish_key_bindings" != fish_default_key_bindings && switch $fish_bind_mode
|
test "$fish_key_bindings" != fish_default_key_bindings && switch $fish_bind_mode
|
||||||
case insert
|
case insert
|
||||||
case default
|
case default
|
||||||
tide_vi_mode_bg_color=$tide_vi_mode_bg_color_default \
|
tide_vi_mode_bg_color=$tide_vi_mode_bg_color_default tide_vi_mode_color=$tide_vi_mode_color_default \
|
||||||
tide_vi_mode_color=$tide_vi_mode_color_default \
|
|
||||||
_tide_print_item vi_mode $tide_vi_mode_icon_default
|
_tide_print_item vi_mode $tide_vi_mode_icon_default
|
||||||
case replace replace_one
|
case replace replace_one
|
||||||
tide_vi_mode_bg_color=$tide_vi_mode_bg_color_replace \
|
tide_vi_mode_bg_color=$tide_vi_mode_bg_color_replace tide_vi_mode_color=$tide_vi_mode_color_replace \
|
||||||
tide_vi_mode_color=$tide_vi_mode_color_replace \
|
|
||||||
_tide_print_item vi_mode $tide_vi_mode_icon_replace
|
_tide_print_item vi_mode $tide_vi_mode_icon_replace
|
||||||
case visual
|
case visual
|
||||||
tide_vi_mode_bg_color=$tide_vi_mode_bg_color_visual \
|
tide_vi_mode_bg_color=$tide_vi_mode_bg_color_visual tide_vi_mode_color=$tide_vi_mode_color_visual \
|
||||||
tide_vi_mode_color=$tide_vi_mode_color_visual \
|
|
||||||
_tide_print_item vi_mode $tide_vi_mode_icon_visual
|
_tide_print_item vi_mode $tide_vi_mode_icon_visual
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
function _tide_prompt
|
function _tide_prompt
|
||||||
# Variables are exported as strings, convert _tide_last_pipestatus back into a list
|
|
||||||
set -g _tide_last_pipestatus (string split ' ' $_tide_last_pipestatus)
|
|
||||||
|
|
||||||
test "$tide_prompt_add_newline_before" = true && echo
|
test "$tide_prompt_add_newline_before" = true && echo
|
||||||
|
|
||||||
left_prompt=(_tide_left_prompt) right_prompt=(_tide_right_prompt) if set -q left_prompt[2] # If prompt is two lines
|
left_prompt=(_tide_left_prompt) right_prompt=(_tide_right_prompt) if set -q left_prompt[2] # If prompt is two lines
|
||||||
set -l prompt_and_frame_color (set_color $tide_prompt_color_frame_and_connection -b normal || echo)
|
set -l prompt_and_frame_color (set_color $tide_prompt_color_frame_and_connection -b normal)
|
||||||
if test "$tide_left_prompt_frame_enabled" = true
|
if test "$tide_left_prompt_frame_enabled" = true
|
||||||
set left_prompt[1] $prompt_and_frame_color╭─"$left_prompt[1]"
|
set left_prompt[1] $prompt_and_frame_color╭─"$left_prompt[1]"
|
||||||
set left_prompt[2] $prompt_and_frame_color╰─"$left_prompt[2]"
|
set left_prompt[2] $prompt_and_frame_color╰─"$left_prompt[2]"
|
||||||
@ -15,18 +12,18 @@ function _tide_prompt
|
|||||||
set right_prompt[2] "$right_prompt[2]"$prompt_and_frame_color─╯
|
set right_prompt[2] "$right_prompt[2]"$prompt_and_frame_color─╯
|
||||||
end
|
end
|
||||||
|
|
||||||
set -lx dist_btwn_sides (math $COLUMNS + 7 - ( # Regex removes color. 7 = @@PWD@@ length which will be replaced
|
set -lx dist_btwn_sides (math $COLUMNS + 5 - ( # Regex removes color. 5 = @PWD@ length which will be replaced
|
||||||
string replace -ar '\e(\[[\d;]*|\(B\e\[)m(\co)?' '' "$left_prompt[1]""$right_prompt[1]" | string length))
|
string replace -ar '\e(\[[\d;]*|\(B\e\[)m(\co)?' '' "$left_prompt[1]""$right_prompt[1]" | string length))
|
||||||
printf '%s' (string replace @@PWD@@ (_tide_pwd) "$left_prompt[1]") $prompt_and_frame_color
|
printf '%s' (string replace @PWD@ (_tide_pwd) "$left_prompt[1]") $prompt_and_frame_color
|
||||||
|
|
||||||
string repeat --no-newline --max (math max 0, $dist_btwn_sides - $pwd_length) $tide_prompt_icon_connection
|
string repeat --no-newline --max (math max 0, $dist_btwn_sides - $pwd_length) $tide_prompt_icon_connection
|
||||||
printf '%s' $right_prompt[1] \n $left_prompt[2]' '
|
printf '%s' $right_prompt[1] \n $left_prompt[2]' '
|
||||||
|
|
||||||
set -U $_tide_right_prompt_display_var $right_prompt[2]
|
set -U $_tide_right_prompt_display_var $right_prompt[2]
|
||||||
else
|
else
|
||||||
set -lx dist_btwn_sides (math $COLUMNS + 7 -$tide_prompt_min_cols - (
|
set -lx dist_btwn_sides (math $COLUMNS + 5 -$tide_prompt_min_cols - (
|
||||||
string replace -ar '\e(\[[\d;]*|\(B\e\[)m(\co)?' '' "$left_prompt[1]""$right_prompt[1]" | string length))
|
string replace -ar '\e(\[[\d;]*|\(B\e\[)m(\co)?' '' "$left_prompt[1]""$right_prompt[1]" | string length))
|
||||||
string replace @@PWD@@ (_tide_pwd) "$left_prompt[1] "
|
string replace @PWD@ (_tide_pwd) "$left_prompt[1] "
|
||||||
|
|
||||||
set -U $_tide_right_prompt_display_var $right_prompt[1]
|
set -U $_tide_right_prompt_display_var $right_prompt[1]
|
||||||
end
|
end
|
||||||
@ -65,5 +62,5 @@ function _tide_right_prompt
|
|||||||
end
|
end
|
||||||
|
|
||||||
function _tide_item_pwd
|
function _tide_item_pwd
|
||||||
_tide_print_item pwd @@PWD@@
|
_tide_print_item pwd @PWD@
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user