Last active
December 16, 2015 05:19
-
-
Save adamgreig/5383809 to your computer and use it in GitHub Desktop.
Powerline prompts for fish
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set fish_greeting | |
function activate | |
set -x VIRTUAL_ENV_DISABLE_PROMPT '1' | |
. venv/bin/activate.fish | |
end | |
function fish_prompt | |
if [ $USER = "root" ] | |
set_color -b RED WHITE | |
else | |
set_color -b GREEN BLACK | |
end | |
echo -n " " | |
if [ $USER != "adam" ] | |
echo -n $USER | |
echo -n "@" | |
end | |
echo -n (hostname) | |
echo -n " " | |
if test -n "$VIRTUAL_ENV" | |
if [ $USER = "root" ] | |
set_color -b PURPLE RED | |
else | |
set_color -b PURPLE GREEN | |
end | |
echo -n \ue0b0 | |
set_color -b PURPLE WHITE | |
echo -n " " | |
echo -n (basename "$VIRTUAL_ENV") | |
echo -n " " | |
set_color -b BLUE PURPLE | |
else | |
if [ $USER = "root" ] | |
set_color -b BLUE RED | |
else | |
set_color -b BLUE GREEN | |
end | |
end | |
echo -n \ue0b0 | |
set_color -b BLUE WHITE | |
echo -n " " | |
echo -n (prompt_pwd) | |
echo -n " " | |
set_color -b NORMAL BLUE | |
echo -n \ue0b0 | |
set_color -b NORMAL NORMAL | |
echo -n " " | |
end | |
function fish_right_prompt | |
if test -z (git branch --quiet 2>|grep "fatal") | |
set_color -b NORMAL BLACK | |
echo -n \ue0b2 | |
if [ (git status --porcelain 2>/dev/null | wc -l) = "0" ] | |
set_color -b BLACK GREEN | |
else | |
set_color -b BLACK YELLOW | |
end | |
echo -n " " | |
echo -n \ue0a0 | |
echo -n " " | |
echo (git rev-parse --abbrev-ref HEAD) | |
echo -n " " | |
set_color -b BLACK CYAN | |
echo -n \ue0b2 | |
set_color -b CYAN BLACK | |
else | |
set_color -b NORMAL CYAN | |
echo -n \ue0b2 | |
set_color -b CYAN BLACK | |
end | |
echo -n " " | |
echo (date +"%H:%M:%S") | |
echo -n " " | |
set_color -b NORMAL NORMAL | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment