# New Start: A modern Arch workflow built with an emphasis on functionality.
# Copyright (C) 2017-2018 Donovan Glover

function fish_prompt

    # Use a more informative and non-unicode prompt for ttys
    if status --is-login; and test -z "$DISPLAY"
        set hostname (hostname)

        set_color yellow;   echo -n "$USER@$hostname"
        set_color normal;   echo -n " "
        set_color magenta;  echo -n "($PWD)"
    else
        set pwd (basename $PWD)

        if [ $pwd = $USER ]
            set pwd "~"
        end

        set_color magenta;  echo -n "$pwd"
        set_color normal;   echo -n " "
        set_color red;      echo -n "➤"
        set_color green;    echo -n "➤"
        set_color blue;     echo -n "➤"
    end

    set_color normal;   echo -n " "
end

# New Start: A modern Arch workflow built with an emphasis on functionality.
# Copyright (C) 2017-2018 Donovan Glover

function fish_prompt

    # Use a more informative and non-unicode prompt for ttys
    if status --is-login; and test -z "$DISPLAY"
        set hostname (hostname)

        set_color yellow;   echo -n "$USER@$hostname"
        set_color normal;   echo -n " "
        set_color magenta;  echo -n "($PWD)"
    else
        set pwd (basename $PWD)
        set branch (git branch ^/dev/null | sed -n '/\* /s///p')

        if [ $pwd = $USER ]
            set pwd "~"
        end

        set_color magenta;  echo -n "$pwd"

        if [ "$branch" ]
            set_color normal;   echo -n " on "
            set_color yellow;   echo -n "$branch"
        end

        set_color normal;   echo -n " "
        set_color red;      echo -n "➤"
        set_color green;    echo -n "➤"
        set_color blue;     echo -n "➤"
    end

    set_color normal;   echo -n " "
end

Add git branch information to fish prompt
meta: Add git branch information to fish prompt

If I stayed on zsh instead of switch to fish, I would've probably never
known how easy it is to add certain information to the prompt. Since
the prompt itself is just a function, you can run any commands you want
inside it to get information, including git commands.

This commit adds the current branch you're on only when inside a git
repository, and only when you're not in a tty.

GloverDonovan/new-start