Add $_tide_color_normal var for speed

This commit is contained in:
Ilan Cosman 2020-06-07 20:14:15 -07:00
parent 6a98714b7b
commit 9b8404bfb7
5 changed files with 7 additions and 16 deletions

View File

@ -2,10 +2,6 @@ function _tide_pwd
set -l truncatedPwd $_tide_pwd
set -g _tide_pwd_output $_tide_pwd
set -l _tide_pwd_truncated_dir_color (set_color $tide_pwd_color_truncated_dirs)
set -l _tide_pwd_anchor_color (set_color -o $tide_pwd_color_anchors)
set -l _tide_pwd_dir_color (set_color $tide_pwd_color_dirs)
if not test -w $PWD
set _tide_pwd_output $_tide_pwd_dir_color{$tide_pwd_unwritable_icon}' '$_tide_pwd_output
end
@ -14,7 +10,7 @@ function _tide_pwd
for dir in $_tide_split_pwd
if contains $dir $_tide_pwd_anchors
set _tide_pwd_output (string replace $dir "$_tide_pwd_anchor_color"$dir(set_color normal) $_tide_pwd_output)
set _tide_pwd_output (string replace $dir (set_color -o $tide_pwd_color_anchors)$dir$_tide_color_normal $_tide_pwd_output)
else
if test (string length $truncatedPwd) -gt $_tide_pwd_max_length
set -l dirTruncated $dir
@ -26,10 +22,10 @@ function _tide_pwd
set -a truncatedList $dirTruncated
set truncatedPwd (string replace $dir $dirTruncated $truncatedPwd)
set _tide_pwd_output (string replace $dir "$_tide_pwd_truncated_dir_color"$dirTruncated $_tide_pwd_output)
set _tide_pwd_output (string replace $dir (set_color $tide_pwd_color_truncated_dirs)$dirTruncated $_tide_pwd_output)
end
end
end
set _tide_pwd_output (string replace -a '/' "$_tide_pwd_dir_color"'/' $_tide_pwd_output)
set _tide_pwd_output (string replace -a '/' (set_color $tide_pwd_color_dirs)'/' $_tide_pwd_output)
end

View File

@ -1,3 +1,3 @@
function _tide_decolor -a text
string replace -a (set_color normal) '' "$text" | string replace -ar '\e\[[0-9;]*m' ''
string replace -a $_tide_color_normal '' "$text" | string replace -ar '\e\[[0-9;]*m' ''
end

View File

@ -1,8 +1,5 @@
function _tide_left_prompt
for item in _tide_item_{$tide_left_prompt_items}
set -l itemOutput ($item)
printf '%b' "$itemOutput"
set_color normal
printf '%b' ($item)$_tide_color_normal
end
end

View File

@ -24,10 +24,7 @@ function _fetch_right_prompt_items
printf '%s' ' '
for item in _tide_item_{$tide_right_prompt_items}
set -l itemOutput ($item)
printf '%s' "$itemOutput"
set_color normal
printf '%s' ($item)$_tide_color_normal
end
end

View File

@ -14,6 +14,7 @@ function _set_tide_defaults
_set _tide_color_green 5FD700
_set _tide_color_light_blue 00AFFF
_set _tide_color_dark_blue 0087AF
_set _tide_color_normal (set_color normal)
# ---------Prompt Connection---------
_set tide_prompt_connection_color 6C6C6C
_set tide_prompt_connection_icon ' '