Skip to content

Instantly share code, notes, and snippets.

@cybersiddhu
Created October 30, 2015 07:42
Show Gist options
  • Select an option

  • Save cybersiddhu/6701f0202310142b44fc to your computer and use it in GitHub Desktop.

Select an option

Save cybersiddhu/6701f0202310142b44fc to your computer and use it in GitHub Desktop.
#RVM settings
if [[ -s ~/.rvm/scripts/rvm ]] ; then
RPS1="%{$fg[yellow]%}rvm:%{$reset_color%}%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt)%{$reset_color%} $EPS1"
else
if which rbenv &> /dev/null; then
RPS1="%{$fg[yellow]%}rbenv:%{$reset_color%}%{$fg[red]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$reset_color%} $EPS1"
fi
fi
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}["
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""
#Customized git status, oh-my-zsh currently does not allow render dirty status before branch
git_custom_status() {
local cb=$(current_branch)
if [ -n "$cb" ]; then
echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX"
fi
}
# current perl version
perl_version_from_perlbrew() {
if which perlbrew &> /dev/null; then
echo $(perlbrew list | grep '*' | sed 's/*//')
else
echo $(perl -v | grep 'This is perl'| cut -d ' ' -f9 | sed -e 's/)//' -e 's/(//' -e 's/v//')
fi
}
perl_version_from_plenv() {
if which plenv &> /dev/null; then
echo $(plenv versions| grep '*' | cut -f2 -d ' ')
else
echo $(perl -v | grep 'This is perl'| cut -d ' ' -f9 | sed -e 's/)//' -e 's/(//' -e 's/v//')
fi
}
PROMPT='╭─$(git_custom_status)($(perl_version_from_plenv))%{$fg[cyan]%}[%~% ]%{$reset_color%}
╰─%B$%b '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment