update prompt, to work on new computer. Not sure why it wasn't
1 files changed, 27 insertions(+), 17 deletions(-)

M functions/fish_prompt.fish
M functions/fish_prompt.fish +27 -17
@@ 1,21 1,31 @@ 
-function fish_prompt --description 'Informative prompt'
-    #Save the return status of the previous command
-    set -l last_pipestatus $pipestatus
+function fish_prompt --description 'Write out the prompt'
+    set -l last_status $status
+    set -l normal (set_color normal)
+    set -l status_color (set_color brgreen)
+    set -l cwd_color (set_color $fish_color_cwd)
+    set -l vcs_color (set_color brpurple)
+    set -l prompt_status ""
+
+    # Since we display the prompt on a new line allow the directory names to be longer.
+    set -q fish_prompt_pwd_dir_length
+    or set -lx fish_prompt_pwd_dir_length 0
 
-    switch "$USER"
-        case root toor
-            printf '%s%s%s# ' (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 $fish_color_status) \
-                                      (set_color --bold $fish_color_status) $last_pipestatus)
+    # Color the prompt differently when we're root
+    set -l suffix '❯'
+    if functions -q fish_is_root_user; and fish_is_root_user
+        if set -q fish_color_cwd_root
+            set cwd_color (set_color $fish_color_cwd_root)
+        end
+        set suffix '#'
+    end
 
-            # zck I'm including the status twice. Not ideal.
-            # The second one ($pipestatus_string) has nice coloring, and only prints when there's an error.
-            printf '\n[%s @ %s]\n%s%s %s%s\f\r> ' $last_pipestatus (date "+%H:%M:%S") \
-                (set_color $fish_color_cwd) $PWD $pipestatus_string \
-                (set_color normal)
+    # Color the prompt in red on error
+    if test $last_status -ne 0
+        set status_color (set_color $fish_color_error)
+        set prompt_status $status_color "[" $last_status "]" $normal
     end
+
+    echo ""
+    echo -s $cwd_color (prompt_pwd) $normal " [" (date "+%H:%M:%S") "]" $vcs_color (fish_vcs_prompt) $normal ' ' $prompt_status
+    echo -n -s $status_color $suffix ' ' $normal
 end