Initial commit
This commit is contained in:
commit
be4c358070
89 changed files with 2766 additions and 0 deletions
|
@ -0,0 +1,41 @@
|
|||
function _fake_tide_cache_variables
|
||||
# pwd
|
||||
set_color -o $fake_tide_pwd_color_anchors | read -gx _fake_tide_color_anchors
|
||||
set -gx _fake_tide_color_truncated_dirs "$(set_color $fake_tide_pwd_color_truncated_dirs)"
|
||||
set -gx _fake_tide_reset_to_color_dirs (set_color normal -b $fake_tide_pwd_bg_color; set_color $fake_tide_pwd_color_dirs)
|
||||
|
||||
# git
|
||||
contains git $fake_tide_left_prompt_items $fake_tide_right_prompt_items &&
|
||||
set -gx _fake_tide_location_color "$(set_color $fake_tide_git_color_branch)"
|
||||
|
||||
# private_mode
|
||||
if contains private_mode $fake_tide_left_prompt_items $fake_tide_right_prompt_items && test -n "$fish_private_mode"
|
||||
set -gx _fake_tide_private_mode
|
||||
else
|
||||
set -e _fake_tide_private_mode
|
||||
end
|
||||
|
||||
# Same-color-separator color
|
||||
set -gx _fake_tide_color_separator_same_color "$(set_color $fake_tide_prompt_color_separator_same_color)"
|
||||
|
||||
# two line prompt
|
||||
if contains newline $fake_tide_left_prompt_items
|
||||
set_color $fake_tide_prompt_color_frame_and_connection -b normal | read -gx _fake_tide_prompt_and_frame_color
|
||||
else
|
||||
set -e _fake_tide_prompt_and_frame_color
|
||||
end
|
||||
|
||||
# newline before
|
||||
if test "$fake_tide_prompt_add_newline_before" = true
|
||||
set -g _fake_tide_add_newline ''
|
||||
else
|
||||
set -e _fake_tide_add_newline
|
||||
end
|
||||
|
||||
# item padding
|
||||
if test "$fake_tide_prompt_pad_items" = true
|
||||
set -gx _fake_tide_pad ' '
|
||||
else
|
||||
set -e _fake_tide_pad
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
function _fake_tide_item_character
|
||||
set_color $fake_tide_character_color
|
||||
contains newline $fake_tide_left_prompt_items || echo -ns ' '
|
||||
echo -ns $fake_tide_character_icon
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
function _fake_tide_item_cmd_duration
|
||||
_fake_tide_print_item cmd_duration $fake_tide_cmd_duration_icon' ' 5s
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
function _fake_tide_item_git
|
||||
_fake_tide_print_item git (set_color $fake_tide_git_color_branch) $fake_tide_git_icon' ' main
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
function _fake_tide_item_newline
|
||||
set_color $prev_bg_color -b normal
|
||||
var=fake_tide_"$_fake_tide_side"_prompt_suffix echo $$var
|
||||
set -g add_prefix
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
function _fake_tide_item_os
|
||||
_fake_tide_print_item os $fake_tide_os_icon
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
function _fake_tide_item_time
|
||||
_fake_tide_print_item time (date +$fake_tide_time_format)
|
||||
end
|
|
@ -0,0 +1,22 @@
|
|||
function _fake_tide_print_item -a item
|
||||
var=fake_tide_"$item"_bg_color set -f item_bg_color $$var
|
||||
|
||||
if set -e add_prefix
|
||||
set_color $item_bg_color -b normal
|
||||
var=fake_tide_"$_fake_tide_side"_prompt_prefix echo -ns $$var
|
||||
else if test "$item_bg_color" = "$prev_bg_color"
|
||||
var=fake_tide_"$_fake_tide_side"_prompt_separator_same_color echo -ns $_fake_tide_color_separator_same_color$$var
|
||||
else if test "$_fake_tide_side" = left
|
||||
set_color $prev_bg_color -b $item_bg_color
|
||||
echo -ns $fake_tide_left_prompt_separator_diff_color
|
||||
else
|
||||
set_color $item_bg_color -b $prev_bg_color
|
||||
echo -ns $fake_tide_right_prompt_separator_diff_color
|
||||
end
|
||||
|
||||
var=fake_tide_"$item"_color set_color $$var -b $item_bg_color
|
||||
|
||||
echo -ns $_fake_tide_pad $argv[2..] $_fake_tide_pad
|
||||
|
||||
set -g prev_bg_color $item_bg_color
|
||||
end
|
|
@ -0,0 +1,42 @@
|
|||
function _fake_tide_prompt
|
||||
set -g add_prefix
|
||||
_fake_tide_side=left set -f left (for item in $fake_tide_left_prompt_items
|
||||
_fake_tide_item_$item
|
||||
end
|
||||
if not set -e add_prefix
|
||||
set_color $prev_bg_color -b normal
|
||||
echo -ns $fake_tide_left_prompt_suffix
|
||||
end)
|
||||
|
||||
set -g add_prefix
|
||||
_fake_tide_side=right set -f right (for item in $fake_tide_right_prompt_items
|
||||
_fake_tide_item_$item
|
||||
end
|
||||
if not set -e add_prefix
|
||||
set_color $prev_bg_color -b normal
|
||||
echo -ns $fake_tide_right_prompt_suffix
|
||||
end)
|
||||
|
||||
if set -q _fake_tide_prompt_and_frame_color # If prompt is two lines
|
||||
test "$fake_tide_left_prompt_frame_enabled" = true &&
|
||||
set left[1] "$_fake_tide_prompt_and_frame_color╭─$left[1]" &&
|
||||
set left[2] "$_fake_tide_prompt_and_frame_color╰─$left[2]"
|
||||
test "$fake_tide_right_prompt_frame_enabled" = true &&
|
||||
set right[1] "$right[1]$_fake_tide_prompt_and_frame_color─╮" &&
|
||||
set right[2] "$right[2]$_fake_tide_prompt_and_frame_color─╯"
|
||||
|
||||
# 5 = @PWD@ length which will be replaced
|
||||
math $fake_columns+5-(string length --visible "$left[1]$right[1]") | read -lx dist_btwn_sides
|
||||
echo -ns "$right[2]"\n(string replace @PWD@ (_fake_tide_pwd) "$left[1]")$_fake_tide_prompt_and_frame_color
|
||||
|
||||
string repeat --no-newline --max (math max 0, $dist_btwn_sides-$_tide_pwd_len) $fake_tide_prompt_icon_connection
|
||||
echo -ns "$right[1]"\n"$left[2] "
|
||||
else
|
||||
math $fake_columns+5-(string length --visible "$left[1]$right[1]") -$fake_tide_prompt_min_cols | read -lx dist_btwn_sides
|
||||
string replace @PWD@ (_fake_tide_pwd) "$right[1]" "$left[1] "
|
||||
end
|
||||
end
|
||||
|
||||
function _fake_tide_item_pwd
|
||||
_fake_tide_print_item pwd @PWD@
|
||||
end
|
11
fish/functions/tide/configure/functions/_fake_tide_pwd.fish
Normal file
11
fish/functions/tide/configure/functions/_fake_tide_pwd.fish
Normal file
|
@ -0,0 +1,11 @@
|
|||
function _fake_tide_pwd
|
||||
set -l out (
|
||||
set_color $fake_tide_pwd_color_dirs
|
||||
echo -ns $fake_tide_pwd_icon' ' '~/'
|
||||
set_color -o $fake_tide_pwd_color_anchors
|
||||
echo -ns src
|
||||
set_color normal -b $fake_tide_pwd_bg_color
|
||||
)
|
||||
set -g _tide_pwd_len (string length --visible $out)
|
||||
echo -ns $out
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue