From 3b97e2d7ec62aaa7e3f64cb54ee833e145a34e17 Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Tue, 9 Apr 2019 03:37:10 -0700 Subject: [PATCH] Stop caching set_color output in rest of prompts No more __fish_prompt_* variables. --- .../sample_prompts/debian_chroot.fish | 30 +++++-------------- .../sample_prompts/informative.fish | 6 ++-- .../sample_prompts/informative_vcs.fish | 9 ------ .../web_config/sample_prompts/lonetwin.fish | 10 +------ 4 files changed, 11 insertions(+), 44 deletions(-) diff --git a/share/tools/web_config/sample_prompts/debian_chroot.fish b/share/tools/web_config/sample_prompts/debian_chroot.fish index b986746f6..aec17ff11 100644 --- a/share/tools/web_config/sample_prompts/debian_chroot.fish +++ b/share/tools/web_config/sample_prompts/debian_chroot.fish @@ -2,14 +2,6 @@ # author: Maurizio De Santis function fish_prompt --description 'Write out the prompt, prepending the Debian chroot environment if present' - if not set -q __fish_prompt_normal - set -g __fish_prompt_normal (set_color normal) - end - - if not set -q __fish_prompt_chroot_env - set -g __fish_prompt_chroot_env (set_color yellow) - end - # Set variable identifying the chroot you work in (used in the prompt below) if not set -q debian_chroot and test -r /etc/debian_chroot @@ -23,27 +15,19 @@ function fish_prompt --description 'Write out the prompt, prepending the Debian # Prepend the chroot environment if present if set -q __fish_debian_chroot_prompt - echo -n -s "$__fish_prompt_chroot_env" "$__fish_debian_chroot_prompt" "$__fish_prompt_normal" ' ' + echo -n -s (set_color yellow) "$__fish_debian_chroot_prompt" (set_color normal) ' ' end switch "$USER" case root toor - if not set -q __fish_prompt_cwd - if set -q fish_color_cwd_root - set -g __fish_prompt_cwd (set_color $fish_color_cwd_root) - else - set -g __fish_prompt_cwd (set_color $fish_color_cwd) - end - end - - echo -n -s "$USER" @ (prompt_hostname) ' ' "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal" '# ' + echo -n -s "$USER" @ (prompt_hostname) ' ' (set -q fish_color_cwd_root + and set_color $fish_color_cwd_root + or set_color $fish_color_cwd) (prompt_pwd) \ + (set_color normal) '# ' case '*' - if not set -q __fish_prompt_cwd - set -g __fish_prompt_cwd (set_color $fish_color_cwd) - end - - echo -n -s "$USER" @ (prompt_hostname) ' ' "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal" '> ' + echo -n -s "$USER" @ (prompt_hostname) ' ' (set_color $fish_color_cwd) (prompt_pwd) \ + (set_color normal) '> ' end end diff --git a/share/tools/web_config/sample_prompts/informative.fish b/share/tools/web_config/sample_prompts/informative.fish index 61ffac113..072d409de 100644 --- a/share/tools/web_config/sample_prompts/informative.fish +++ b/share/tools/web_config/sample_prompts/informative.fish @@ -15,9 +15,9 @@ function fish_prompt --description 'Informative prompt' switch "$USER" case root toor - printf '%s@%s %s%s%s# ' $USER (prompt_hostname) (set -q fish_color_cwd_root && \ - set_color $fish_color_cwd_root || \ - set_color $fish_color_cwd) \ + printf '%s@%s %s%s%s# ' $USER (prompt_hostname) (set -q fish_color_cwd_root + and set_color $fish_color_cwd_root + or set_color $fish_color_cwd) \ (prompt_pwd) (set_color normal) case '*' set -l pipestatus_string (__fish_print_pipestatus "[" "] " "|" (set_color yellow) \ diff --git a/share/tools/web_config/sample_prompts/informative_vcs.fish b/share/tools/web_config/sample_prompts/informative_vcs.fish index 99645fdaa..cf16a3ca8 100644 --- a/share/tools/web_config/sample_prompts/informative_vcs.fish +++ b/share/tools/web_config/sample_prompts/informative_vcs.fish @@ -1,8 +1,6 @@ # name: Informative Vcs # author: Mariusz Smykula - - function fish_prompt --description 'Write out the prompt' set -l last_pipestatus $pipestatus set -l last_status $status @@ -13,7 +11,6 @@ function fish_prompt --description 'Write out the prompt' if not set -q __fish_git_prompt_hide_untrackedfiles set -g __fish_git_prompt_hide_untrackedfiles 1 end - if not set -q __fish_git_prompt_color_branch set -g __fish_git_prompt_color_branch magenta --bold end @@ -29,7 +26,6 @@ function fish_prompt --description 'Write out the prompt' if not set -q __fish_git_prompt_char_upstream_prefix set -g __fish_git_prompt_char_upstream_prefix "" end - if not set -q __fish_git_prompt_char_stagedstate set -g __fish_git_prompt_char_stagedstate "●" end @@ -45,7 +41,6 @@ function fish_prompt --description 'Write out the prompt' if not set -q __fish_git_prompt_char_cleanstate set -g __fish_git_prompt_char_cleanstate "✔" end - if not set -q __fish_git_prompt_color_dirtystate set -g __fish_git_prompt_color_dirtystate blue end @@ -62,10 +57,6 @@ function fish_prompt --description 'Write out the prompt' set -g __fish_git_prompt_color_cleanstate green --bold end - if not set -q __fish_prompt_normal - set -g __fish_prompt_normal (set_color normal) - end - set -l color_cwd set -l prefix set -l suffix diff --git a/share/tools/web_config/sample_prompts/lonetwin.fish b/share/tools/web_config/sample_prompts/lonetwin.fish index d14ccbdf7..30adf9736 100644 --- a/share/tools/web_config/sample_prompts/lonetwin.fish +++ b/share/tools/web_config/sample_prompts/lonetwin.fish @@ -2,13 +2,5 @@ # author: Steve function fish_prompt --description 'Write out the prompt' - if not set -q __fish_prompt_normal - set -g __fish_prompt_normal (set_color normal) - end - - if not set -q __fish_prompt_cwd - set -g __fish_prompt_cwd (set_color $fish_color_cwd) - end - - echo -n -s "$USER" @ (prompt_hostname) ' ' "$__fish_prompt_cwd" (prompt_pwd) (fish_vcs_prompt) "$__fish_prompt_normal" '> ' + echo -n -s "$USER" @ (prompt_hostname) ' ' (set_color $fish_color_cwd) (prompt_pwd) (fish_vcs_prompt) (set_color normal) '> ' end