From 750030a110b5715f3eb6d231dfd0955cfe3ebb82 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Wed, 1 Feb 2017 05:13:31 -0800 Subject: [PATCH] Remove a ton of `set_color normal` calls. Eases the pain of fish-shell/fish-shell#3793 just a bit. This _shouldn't_ ever look any different to the end user. I think. --- fish_prompt.fish | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/fish_prompt.fish b/fish_prompt.fish index a1d73b6..7253799 100644 --- a/fish_prompt.fish +++ b/fish_prompt.fish @@ -224,8 +224,7 @@ function __bobthefish_start_segment -S -d 'Start a prompt segment' set -e argv[1] set_color normal # clear out anything bold or underline... - set_color -b $bg - set_color $fg $argv + set_color -b $bg $fg $argv switch "$__bobthefish_current_bg" case '' @@ -271,7 +270,6 @@ function __bobthefish_path_segment -S -a current_dir -d 'Display a shortened for echo -n $parent set_color -b $segment_basename_color echo -ns $directory ' ' - set_color normal end function __bobthefish_finish_segments -S -d 'Close open prompt segments' @@ -281,8 +279,8 @@ function __bobthefish_finish_segments -S -d 'Close open prompt segments' echo -ns $__bobthefish_right_black_arrow_glyph ' ' end - set __bobthefish_current_bg set_color normal + set __bobthefish_current_bg end @@ -331,7 +329,6 @@ function __bobthefish_prompt_vagrant_vbox -S -a id -d 'Display VirtualBox Vagran __bobthefish_start_segment $__color_vagrant echo -ns $vagrant_status ' ' - set_color normal end function __bobthefish_prompt_vagrant_vmware -S -a id -d 'Display VMWare Vagrant status' @@ -345,7 +342,6 @@ function __bobthefish_prompt_vagrant_vmware -S -a id -d 'Display VMWare Vagrant __bobthefish_start_segment $__color_vagrant echo -ns $vagrant_status ' ' - set_color normal end function __bobthefish_prompt_vagrant_parallels -S -d 'Display Parallels Vagrant status' @@ -369,14 +365,12 @@ function __bobthefish_prompt_vagrant_parallels -S -d 'Display Parallels Vagrant __bobthefish_start_segment $__color_vagrant echo -ns $vagrant_status ' ' - set_color normal end function __bobthefish_prompt_docker -S -d 'Show docker machine name' [ "$theme_display_docker_machine" = 'no' -o -z "$DOCKER_MACHINE_NAME" ]; and return __bobthefish_start_segment $__color_vagrant echo -ns $DOCKER_MACHINE_NAME ' ' - set_color normal end function __bobthefish_prompt_status -S -a last_status -d 'Display symbols for a non zero exit status, root and background jobs' @@ -399,7 +393,8 @@ function __bobthefish_prompt_status -S -a last_status -d 'Display symbols for a if [ "$nonzero" -o "$superuser" -o "$bg_jobs" ] __bobthefish_start_segment $__color_initial_segment_exit if [ "$nonzero" ] - set_color normal; set_color -b $__color_initial_segment_exit + set_color normal + set_color -b $__color_initial_segment_exit if [ "$theme_show_exit_status" = 'yes' ] echo -ns $last_status ' ' else @@ -408,16 +403,16 @@ function __bobthefish_prompt_status -S -a last_status -d 'Display symbols for a end if [ "$superuser" ] - set_color normal; set_color -b $__color_initial_segment_su + set_color normal + set_color -b $__color_initial_segment_su echo -n $__bobthefish_superuser_glyph end if [ "$bg_jobs" ] - set_color normal; set_color -b $__color_initial_segment_jobs + set_color normal + set_color -b $__color_initial_segment_jobs echo -n $__bobthefish_bg_job_glyph end - - set_color normal end end @@ -543,9 +538,11 @@ function __bobthefish_prompt_git -S -a current_dir -d 'Display the actual git st if [ "$work_parent" ] echo -n "$work_parent/" end - set_color normal; set_color -b $__color_repo_work_tree + set_color normal + set_color -b $__color_repo_work_tree echo -n (basename $work_dir) - set_color normal; set_color --background $colors + set_color normal + set_color -b $colors [ "$project_pwd" ] and echo -n '/' end @@ -590,7 +587,6 @@ function __bobthefish_prompt_vi -S -d 'Display vi mode' __bobthefish_start_segment $__color_vi_mode_visual echo -n 'V ' end - set_color normal end function __bobthefish_virtualenv_python_version -S -d 'Get current python version' @@ -614,7 +610,6 @@ function __bobthefish_prompt_virtualfish -S -d "Display activated virtual enviro echo -ns $__bobthefish_virtualenv_glyph $version_glyph ' ' end echo -ns (basename "$VIRTUAL_ENV") ' ' - set_color normal end function __bobthefish_rvm_parse_ruby -S -a ruby_string scope -d 'Parse RVM Ruby string' @@ -689,7 +684,6 @@ function __bobthefish_show_ruby -S -d 'Current Ruby (rvm/rbenv)' [ -z "$ruby_version" ]; and return __bobthefish_start_segment $__color_rvm echo -ns $__bobthefish_ruby_glyph $ruby_version ' ' - set_color normal end function __bobthefish_prompt_rubies -S -d 'Display current Ruby information'