Last active
October 24, 2016 21:30
-
-
Save freshvolk/5415471 to your computer and use it in GitHub Desktop.
Fish prompty
This file contains 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
function _git_branch_name | |
echo (git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||') | |
end | |
function _is_git_dirty | |
echo (git status -s --ignore-submodules=dirty ^/dev/null) | |
end | |
function fish_prompt | |
set_color yellow | |
printf '%s' (whoami) | |
set_color normal | |
printf ' at ' | |
set_color magenta | |
printf '%s' (hostname|cut -d . -f 1) | |
set_color normal | |
printf ' in ' | |
set_color $fish_color_cwd | |
printf '%s' (prompt_pwd) | |
set_color normal | |
if [ (_git_branch_name) ] | |
set_color normal | |
printf ' on ' | |
set_color cyan | |
printf '%s' (_git_branch_name) | |
set_color normal | |
printf ' is ' | |
if [ (_is_git_dirty) ] | |
set_color yellow | |
printf '汚い' | |
else | |
set_color green | |
printf '浄' | |
end | |
set_color normal | |
end | |
# Line 2 | |
echo | |
if test $VIRTUAL_ENV | |
printf "(%s) " (set_color blue)(basename $VIRTUAL_ENV)(set_color normal) | |
end | |
printf '↪ ' | |
set_color normal | |
end |
This file contains 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
# Shell Variable Configuration | |
RED="\[\033[31m\]" | |
GRE="\[\033[32m\]" | |
YEL="\[\033[33m\]" | |
BLU="\[\033[34m\]" | |
PUR="\[\033[35m\]" | |
WHI="\[\033[37m\]" | |
NUL="\[\033[0m\]" | |
export PS1="${BLU}\u${NUL} at ${YEL}\H${NUL} in ${PUR}"'$(_fish_style_dirs_above)'"\W${NUL}"'`if [ "$(_git_branch_name)" ]; then echo -n " on "\[\e[32m\]; echo -n "$(_git_branch_name)"; echo -n \[\e[0m\]; fi;`'" at ${RED}\t \n${PUR}"'$(echo `basename "/$VIRTUAL_ENV"` | sed s#/##g)'"${NUL} > " | |
function _git_branch_name { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' | |
} | |
function _fish_style_dirs_above { | |
echo `temp=$(echo "${PWD/$HOME/~}" |sed -r 's/(\/.)[^/]*/\1/g'); echo -n ${temp:0:$(( ${#temp} - 1 ))}` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment