Created
November 27, 2013 14:18
-
-
Save jaimeiniesta/7676379 to your computer and use it in GitHub Desktop.
custom shell prompt showing ruby version and git branch
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
# BEGIN custom prompt | |
show_git_branch() { | |
_branch="$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')" | |
test -n "$_branch" && echo -e " $_branch" | |
} | |
# prompt with ruby version | |
show_ruby_version() | |
{ | |
echo "$(ruby -e 'print RUBY_VERSION')" | |
} | |
show_dev_info() { | |
echo "($(show_ruby_version)$(show_git_branch))" | |
} | |
# colors | |
Black='\e[0;30m' | |
Red='\e[0;31m' | |
LightRed='\e[1;31m' | |
Green='\e[0;32m' | |
LightGreen='\e[1;32m' | |
Yellow='\e[0;33m' | |
Blue='\e[0;34m' | |
Purple='\e[0;35m' | |
Cyan='\e[0;36m' | |
White='\e[0;37m' | |
PS1="\n\[$Yellow\]\u@\h \[$Cyan\]\w \[$Green\]\$(show_dev_info)\n\[$White\]➔\[$White\] " | |
# END custom prompt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment