configs  Artifact [0611b46b8d]

Artifact 0611b46b8da3e484d9c42ea2276975f7301c6618a1f5cdd4d4b3912391f2ad2f:

  • File fish/functions/fish_prompt.fish — part of check-in [50621c3061] at 2020-08-23 12:07:26 on branch trunk — Include user in prompt if not the normal user (user: js size: 913)

function fish_prompt --description 'Write out the prompt'
    set -l suffix
    switch "$USER"
        case root toor
            set suffix (set_color $fish_color_cwd_root)'#'
        case '*'
            set suffix '>'
    end

    set -l branch (fossil branch current 2>/dev/null)

    if test -z "$branch"
        set branch (git symbolic-ref HEAD 2>/dev/null)
        set branch (string replace -r "^refs/heads/" "" $branch)
    end

    set -l vcs
    if test -n "$branch"
        set vcs (set_color $fish_color_vcs_braces)"(" \
                (set_color $fish_color_vcs)"$branch" \
                (set_color $fish_color_vcs_braces)")"
    end

    echo -n -s (set_color $fish_color_host) (prompt_user) (prompt_hostname) \
               ' ' (set_color $fish_color_cwd) (prompt_pwd) \
               (string join '' $vcs) (set_color $fish_color_suffix) $suffix \
               (set_color normal) ' '
end