mirror of
https://github.com/IlanCosman/tide.git
synced 2024-12-22 19:41:36 +03:00
Use echo
This commit is contained in:
parent
04b37f45a4
commit
e2f594cde1
@ -12,7 +12,7 @@ function _tide_init_install --on-event _tide_init_install
|
||||
case y ye yes ''
|
||||
tide configure
|
||||
case '*'
|
||||
printf '%s' \n 'Run ' (printf '%s' "tide configure" | fish_indent --ansi) ' to customize your prompt.' \n
|
||||
echo -ns \n 'Run ' (echo -ns "tide configure" | fish_indent --ansi) ' to customize your prompt.' \n
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,16 +1,16 @@
|
||||
function _tide_detect_os
|
||||
switch (uname | string lower)
|
||||
case darwin
|
||||
printf '%s'
|
||||
echo -ns
|
||||
case freebsd openbsd dragonfly
|
||||
printf '%s'
|
||||
echo -ns
|
||||
case linux
|
||||
_tide_detect_os_linux_cases /etc/os-release ID ||
|
||||
_tide_detect_os_linux_cases /etc/os-release ID_LIKE ||
|
||||
_tide_detect_os_linux_cases /etc/lsb-release DISTRIB_ID ||
|
||||
printf '%s'
|
||||
echo -ns
|
||||
case '*'
|
||||
printf '%s' '?'
|
||||
echo -ns '?'
|
||||
end
|
||||
end
|
||||
|
||||
@ -43,5 +43,5 @@ function _tide_detect_os_linux_cases -a file key
|
||||
ubuntu
|
||||
|
||||
set -l distro_index (contains --index $value $distro_icons) || return
|
||||
printf '%s' $distro_icons[(math $distro_index + 1)]
|
||||
echo -ns $distro_icons[(math $distro_index + 1)]
|
||||
end
|
||||
|
@ -6,17 +6,17 @@ function _tide_item_character
|
||||
end
|
||||
|
||||
if test "$fish_key_bindings" = fish_default_key_bindings
|
||||
printf %s $tide_character_icon
|
||||
echo -ns $tide_character_icon
|
||||
else
|
||||
switch $fish_bind_mode
|
||||
case insert
|
||||
printf %s $tide_character_icon
|
||||
echo -ns $tide_character_icon
|
||||
case default
|
||||
printf %s $tide_character_vi_icon_default
|
||||
echo -ns $tide_character_vi_icon_default
|
||||
case replace replace_one
|
||||
printf %s $tide_character_vi_icon_replace
|
||||
echo -ns $tide_character_vi_icon_replace
|
||||
case visual
|
||||
printf %s $tide_character_vi_icon_visual
|
||||
echo -ns $tide_character_vi_icon_visual
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -60,12 +60,12 @@ function _tide_item_git
|
||||
set -g tide_git_bg_color $tide_git_bg_color_unstable
|
||||
end
|
||||
|
||||
_tide_print_item git $_tide_location_color $tide_git_icon' ' (set_color white; printf %s $location
|
||||
set_color $tide_git_color_operation; printf %s ' '$tide_git_operation ' '$tide_git_step/$tide_git_total_steps
|
||||
set_color $tide_git_color_upstream; printf %s ' ⇣'$upstream_behind ' ⇡'$upstream_ahead
|
||||
set_color $tide_git_color_stash; printf %s ' *'$stash
|
||||
set_color $tide_git_color_conflicted; printf %s ' ~'$conflicted
|
||||
set_color $tide_git_color_staged; printf %s ' +'$staged
|
||||
set_color $tide_git_color_dirty; printf %s ' !'$dirty
|
||||
set_color $tide_git_color_untracked; printf %s ' ?'$untracked)
|
||||
_tide_print_item git $_tide_location_color $tide_git_icon' ' (set_color white; echo -ns $location
|
||||
set_color $tide_git_color_operation; echo -ns ' '$tide_git_operation ' '$tide_git_step/$tide_git_total_steps
|
||||
set_color $tide_git_color_upstream; echo -ns ' ⇣'$upstream_behind ' ⇡'$upstream_ahead
|
||||
set_color $tide_git_color_stash; echo -ns ' *'$stash
|
||||
set_color $tide_git_color_conflicted; echo -ns ' ~'$conflicted
|
||||
set_color $tide_git_color_staged; echo -ns ' +'$staged
|
||||
set_color $tide_git_color_dirty; echo -ns ' !'$dirty
|
||||
set_color $tide_git_color_untracked; echo -ns ' ?'$untracked)
|
||||
end
|
||||
|
@ -1,5 +1,5 @@
|
||||
function _tide_item_newline
|
||||
set_color $_tide_previous_bg_color -b normal
|
||||
side_working_on_suffix_name=tide_"$_tide_which_side_working_on"_prompt_suffix printf '%s' $$side_working_on_suffix_name \n
|
||||
side_working_on_suffix_name=tide_"$_tide_which_side_working_on"_prompt_suffix echo $$side_working_on_suffix_name
|
||||
set -g _tide_last_item_was_newline
|
||||
end
|
||||
|
@ -4,31 +4,31 @@ function _tide_print_item -a item
|
||||
if test "$_tide_which_side_working_on" = left
|
||||
if set -e _tide_last_item_was_newline
|
||||
set_color $item_bg_color -b normal
|
||||
printf '%s' $tide_left_prompt_prefix
|
||||
echo -ns $tide_left_prompt_prefix
|
||||
else if test "$item_bg_color" = "$_tide_previous_bg_color"
|
||||
set_color $tide_prompt_color_separator_same_color
|
||||
printf '%s' $tide_left_prompt_separator_same_color
|
||||
echo -ns $tide_left_prompt_separator_same_color
|
||||
else
|
||||
set_color $_tide_previous_bg_color -b $item_bg_color
|
||||
printf '%s' $tide_left_prompt_separator_diff_color
|
||||
echo -ns $tide_left_prompt_separator_diff_color
|
||||
end
|
||||
else if set -e _tide_last_item_was_newline
|
||||
set_color $item_bg_color -b normal
|
||||
printf '%s' $tide_right_prompt_prefix
|
||||
echo -ns $tide_right_prompt_prefix
|
||||
else if test "$item_bg_color" = "$_tide_previous_bg_color"
|
||||
set_color $tide_prompt_color_separator_same_color
|
||||
printf '%s' $tide_right_prompt_separator_same_color
|
||||
echo -ns $tide_right_prompt_separator_same_color
|
||||
else
|
||||
set_color $item_bg_color -b $_tide_previous_bg_color
|
||||
printf '%s' $tide_right_prompt_separator_diff_color
|
||||
echo -ns $tide_right_prompt_separator_diff_color
|
||||
end
|
||||
|
||||
item_color_name=tide_"$item"_color set_color $$item_color_name -b $item_bg_color
|
||||
|
||||
if test "$tide_prompt_pad_items" = true
|
||||
printf '%s' ' ' $argv[2..] ' '
|
||||
echo -ns ' ' $argv[2..] ' '
|
||||
else
|
||||
printf '%s' $argv[2..]
|
||||
echo -ns $argv[2..]
|
||||
end
|
||||
|
||||
set -g _tide_previous_bg_color $item_bg_color
|
||||
|
@ -13,10 +13,10 @@ function _tide_prompt
|
||||
|
||||
# 5 = @PWD@ length which will be replaced
|
||||
math $COLUMNS+5-(string length --visible "$left_prompt[1]""$right_prompt[1]") | read -lx dist_btwn_sides
|
||||
printf '%s' (string replace @PWD@ (_tide_pwd) "$left_prompt[1]") $_tide_prompt_and_frame_color
|
||||
echo -ns (string replace @PWD@ (_tide_pwd) "$left_prompt[1]") $_tide_prompt_and_frame_color
|
||||
|
||||
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]' '
|
||||
echo -ns $right_prompt[1] \n $left_prompt[2]' '
|
||||
else
|
||||
echo $right_prompt[1]
|
||||
|
||||
@ -34,7 +34,7 @@ function _tide_left_prompt
|
||||
|
||||
if not set -e _tide_last_item_was_newline
|
||||
set_color $_tide_previous_bg_color -b normal
|
||||
printf '%s' $tide_left_prompt_suffix
|
||||
echo -ns $tide_left_prompt_suffix
|
||||
end
|
||||
|
||||
set_color normal # Make sure there is something printed on the last line
|
||||
@ -49,7 +49,7 @@ function _tide_right_prompt
|
||||
|
||||
if not set -e _tide_last_item_was_newline
|
||||
set_color $_tide_previous_bg_color -b normal
|
||||
printf '%s' $tide_right_prompt_suffix
|
||||
echo -ns $tide_right_prompt_suffix
|
||||
end
|
||||
|
||||
set_color normal # Make sure there is something printed on the last line
|
||||
|
@ -16,7 +16,7 @@ end
|
||||
|
||||
function _tide_sub_configure
|
||||
if test $COLUMNS -lt 55 -o $LINES -lt 21
|
||||
printf '%s\n' 'Terminal size too small; must be at least 55 x 21'
|
||||
echo 'Terminal size too small; must be at least 55 x 21'
|
||||
return 1
|
||||
end
|
||||
|
||||
@ -45,16 +45,15 @@ function _tide_option -a symbol text
|
||||
set -ga _tide_option_list $symbol
|
||||
|
||||
set_color -o
|
||||
printf '%s\n' "($symbol) $text"
|
||||
echo "($symbol) $text"
|
||||
set_color normal
|
||||
end
|
||||
|
||||
function _tide_menu
|
||||
set -l list_with_slashes (string join '/' $_tide_option_list)
|
||||
|
||||
printf '%s\n' \
|
||||
'(r) Restart from the beginning' \
|
||||
'(q) Quit and do nothing'\n
|
||||
echo '(r) Restart from the beginning'
|
||||
echo '(q) Quit and do nothing'\n
|
||||
|
||||
while true
|
||||
set_color -o
|
||||
|
@ -1,5 +1,5 @@
|
||||
function _fake_tide_item_newline
|
||||
set_color $_fake_tide_previous_bg_color -b normal
|
||||
side_working_on_suffix_name=fake_tide_"$_fake_tide_which_side_working_on"_prompt_suffix printf '%s' $$side_working_on_suffix_name \n
|
||||
side_working_on_suffix_name=fake_tide_"$_fake_tide_which_side_working_on"_prompt_suffix echo -ns $$side_working_on_suffix_name \n
|
||||
set -g _fake_tide_last_item newline
|
||||
end
|
||||
|
@ -5,32 +5,32 @@ function _fake_tide_print_item -a item
|
||||
if test "$_fake_tide_last_item" = newline
|
||||
if test "$item" != character
|
||||
set_color $item_bg_color -b normal
|
||||
printf '%s' $fake_tide_left_prompt_prefix
|
||||
echo -ns $fake_tide_left_prompt_prefix
|
||||
end
|
||||
else if test "$item_bg_color" = "$_fake_tide_previous_bg_color"
|
||||
set_color $fake_tide_prompt_color_separator_same_color
|
||||
printf '%s' $fake_tide_left_prompt_separator_same_color
|
||||
echo -ns $fake_tide_left_prompt_separator_same_color
|
||||
else
|
||||
set_color $_fake_tide_previous_bg_color -b $item_bg_color
|
||||
printf '%s' $fake_tide_left_prompt_separator_diff_color
|
||||
echo -ns $fake_tide_left_prompt_separator_diff_color
|
||||
end
|
||||
else if test "$_fake_tide_last_item" = newline
|
||||
set_color $item_bg_color -b normal
|
||||
printf '%s' $fake_tide_right_prompt_prefix
|
||||
echo -ns $fake_tide_right_prompt_prefix
|
||||
else if test "$item_bg_color" = "$_fake_tide_previous_bg_color"
|
||||
set_color $fake_tide_prompt_color_separator_same_color
|
||||
printf '%s' $fake_tide_right_prompt_separator_same_color
|
||||
echo -ns $fake_tide_right_prompt_separator_same_color
|
||||
else
|
||||
set_color $item_bg_color -b $_fake_tide_previous_bg_color
|
||||
printf '%s' $fake_tide_right_prompt_separator_diff_color
|
||||
echo -ns $fake_tide_right_prompt_separator_diff_color
|
||||
end
|
||||
|
||||
item_color_name=fake_tide_"$item"_color set_color $$item_color_name -b $item_bg_color
|
||||
|
||||
if test "$fake_tide_prompt_pad_items" = true -a "$item" != character
|
||||
printf '%s' ' ' $argv[2..] ' '
|
||||
echo -ns ' ' $argv[2..] ' '
|
||||
else
|
||||
printf '%s' $argv[2..]
|
||||
echo -ns $argv[2..]
|
||||
end
|
||||
|
||||
set -g _fake_tide_previous_bg_color $item_bg_color
|
||||
|
@ -11,23 +11,23 @@ function _fake_tide_prompt
|
||||
set right_prompt[2] "$right_prompt[2]"$_tide_prompt_and_frame_color─╯
|
||||
end
|
||||
|
||||
printf '%s' $left_prompt[1] $_tide_prompt_and_frame_color
|
||||
echo -ns $left_prompt[1] $_tide_prompt_and_frame_color
|
||||
|
||||
set -l dist_btwn_sides (math $fake_columns - ( # Regex removes color codes
|
||||
string replace -ar '\e(\[[\d;]*|\(B\e\[)m(\co)?' '' "$left_prompt[1]""$right_prompt[1]" | string length))
|
||||
test $dist_btwn_sides -gt 0 && string repeat --no-newline --max $dist_btwn_sides $fake_tide_prompt_icon_connection
|
||||
|
||||
printf '%s' $right_prompt[1] \n $left_prompt[-1]' '
|
||||
echo -ns $right_prompt[1] \n $left_prompt[-1]' '
|
||||
|
||||
string repeat --no-newline --max (math $fake_columns - ( # The -1 is necessary for some reason
|
||||
string replace -ar '\e(\[[\d;]*|\(B\e\[)m(\co)?' '' "$left_prompt[-1]""$right_prompt[-1]" | string length) - 1) ' '
|
||||
printf '%s' $right_prompt[2]
|
||||
echo -ns $right_prompt[2]
|
||||
else
|
||||
printf '%s' $left_prompt[-1]' '
|
||||
echo -ns $left_prompt[-1]' '
|
||||
|
||||
string repeat --no-newline --max (math $fake_columns - ( # The -1 is necessary for some reason
|
||||
string replace -ar '\e(\[[\d;]*|\(B\e\[)m(\co)?' '' "$left_prompt[-1]""$right_prompt[-1]" | string length) - 1) ' '
|
||||
printf '%s' $right_prompt[-1]
|
||||
echo -ns $right_prompt[-1]
|
||||
end
|
||||
|
||||
set_color normal
|
||||
@ -43,7 +43,7 @@ function _fake_tide_left_prompt
|
||||
|
||||
if not contains -- $_fake_tide_last_item newline character
|
||||
set_color $_fake_tide_previous_bg_color -b normal
|
||||
printf '%s' $fake_tide_left_prompt_suffix
|
||||
echo -ns $fake_tide_left_prompt_suffix
|
||||
end
|
||||
|
||||
set_color normal # Make sure there is something printed on the last line
|
||||
@ -59,7 +59,7 @@ function _fake_tide_right_prompt
|
||||
|
||||
if test "$_fake_tide_last_item" != newline
|
||||
set_color $_fake_tide_previous_bg_color -b normal
|
||||
printf '%s' $fake_tide_right_prompt_suffix
|
||||
echo -ns $fake_tide_right_prompt_suffix
|
||||
end
|
||||
|
||||
set_color normal # Make sure there is something printed on the last line
|
||||
|
Loading…
Reference in New Issue
Block a user