From edcf15e3d7f0444e2954c45eeaac808782c48498 Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Mon, 31 Oct 2016 23:29:50 -0700 Subject: [PATCH] Sorin prompt: updates Use $USER, prompt_hostname, string Update to use correct color names such as magenta over purple. Use bright color variants instead of bold in some cases. --- share/completions/fish_key_reader.fish | 1 + .../web_config/sample_prompts/sorin.fish | 22 +++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) create mode 100644 share/completions/fish_key_reader.fish diff --git a/share/completions/fish_key_reader.fish b/share/completions/fish_key_reader.fish new file mode 100644 index 000000000..fba8f57e8 --- /dev/null +++ b/share/completions/fish_key_reader.fish @@ -0,0 +1 @@ +complete -c fish_key_reader -s y -d "Young cow" diff --git a/share/tools/web_config/sample_prompts/sorin.fish b/share/tools/web_config/sample_prompts/sorin.fish index 21d516a81..0869c22b6 100644 --- a/share/tools/web_config/sample_prompts/sorin.fish +++ b/share/tools/web_config/sample_prompts/sorin.fish @@ -2,8 +2,7 @@ # author: Ivan Tham function fish_prompt - test $SSH_TTY; and printf (set_color red)(whoami)(set_color white)'@'(set_color yellow)(prompt_hostname)' ' - + test $SSH_TTY; and printf (set_color red)$USER(set_color brwhite)'@'(set_color yellow)(prompt_hostname)' ' test $USER = 'root'; and echo (set_color red)"#" # Main @@ -15,10 +14,10 @@ function fish_right_prompt test $status != 0; and printf (set_color red)"⏎ " if git rev-parse ^ /dev/null - # Purple if branch detached else green - git branch -qv | grep "\*" | grep -q detached - and set_color purple --bold - or set_color green --bold + # Magenta if branch detached else green + git branch -qv | grep "\*" | string match -rq detached + and set_color brmagenta + or set_color brgreen # Need optimization on this block (eliminate space) git name-rev --name-only HEAD @@ -32,9 +31,9 @@ function fish_right_prompt (git status --porcelain | cut -c 1-2 | uniq) switch $i case "*[ahead *" - printf (set_color purple)⬆' ' + printf (set_color magenta)⬆' ' case "*behind *" - printf (set_color purple)⬇' ' + printf (set_color magenta)⬇' ' case "." printf (set_color green)✚' ' case " D" @@ -42,13 +41,12 @@ function fish_right_prompt case "*M*" printf (set_color blue)✱' ' case "*R*" - printf (set_color purple)➜' ' + printf (set_color brmagenta)➜' ' case "*U*" - printf (set_color brown)═' ' + printf (set_color bryellow)═' ' case "??" - printf (set_color white)◼' ' + printf (set_color brwhite)◼' ' end end - set_color normal end end