Skip to content

Instantly share code, notes, and snippets.

@jethroo
Last active June 5, 2019 13:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jethroo/3e4fde7ba7f7d9fa1812a7c70d7fc19f to your computer and use it in GitHub Desktop.
Save jethroo/3e4fde7ba7f7d9fa1812a7c70d7fc19f to your computer and use it in GitHub Desktop.
function ruby_v() {
if [ -n "$(ls -A ./Gemfile 2>/dev/null)" ]
then
echo "${$(ruby_prompt_info)/ruby-/ }"
fi
}
function fg_c_code() {
echo "\\033[38;5;$1m"
}
function bg_c_code() {
echo "\\033[48;5;$1m"
}
function color_reset() {
echo "\\033[0m"
}
function my_win_prompt() {
echo "$(fg_c_code "230")\ufb8a$(color_reset)"
}
function my_fail_prompt() {
echo "$(fg_c_code "124")\ufb8a$(color_reset)"
}
function node_prompt_version {
if which node &> /dev/null; then
if [ -n "$(ls -A ./package.json 2>/dev/null)" ]
then
echo "%{$fg_bold[green]%}\uf898 $(node -v)%{$fg[blue]%}%{$reset_color%}"
fi
fi
}
local ret_status="%(?:$(my_win_prompt) :$(my_fail_prompt) )"
PROMPT='%{$reset_color%}$(ruby_v)$(node_prompt_version) %{$fg[cyan]%}%c $(git_prompt_info)${ret_status}%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="$(fg_c_code "118")\ue725($(fg_c_code "178")"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY=")$(fg_c_code "9")\ue726"
ZSH_THEME_GIT_PROMPT_CLEAN="$(fg_c_code "118"))"
ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg_bold[red]%}\ue791%{$reset_color%}"
ZSH_THEME_RUBY_PROMPT_SUFFIX=" "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment