From 76fcb5809982a19c9ea9b2efdec6c61f1439e1ad Mon Sep 17 00:00:00 2001 From: Victor Castell Date: Sat, 5 Nov 2011 13:08:34 +0100 Subject: [PATCH 1/3] envy theme to implement rbenv version promt --- themes/base.theme.bash | 10 ++++++++++ themes/envy/envy.theme.bash | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 themes/envy/envy.theme.bash diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 05db36e5..58efe11d 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -24,6 +24,9 @@ RVM_THEME_PROMPT_SUFFIX='|' VIRTUALENV_THEME_PROMPT_PREFIX=' |' VIRTUALENV_THEME_PROMPT_SUFFIX='|' +RBENV_THEME_PROMPT_PREFIX=' |' +RBENV_THEME_PROMPT_SUFFIX='|' + function scm { if [[ -d .git ]]; then SCM=$SCM_GIT elif [[ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]]; then SCM=$SCM_GIT @@ -113,6 +116,13 @@ function rvm_version_prompt { fi } +function rbenv_version_prompt { + if which rbenv &> /dev/null; then + rbenv=$(rbenv global) || return + echo -e "$RBENV_THEME_PROMPT_PREFIX$rbenv$RBENV_THEME_PROMPT_SUFFIX" + fi +} + function virtualenv_prompt { if which virtualenv &> /dev/null; then virtualenv=$([ ! -z "$VIRTUAL_ENV" ] && echo "`basename $VIRTUAL_ENV`") || return diff --git a/themes/envy/envy.theme.bash b/themes/envy/envy.theme.bash new file mode 100644 index 00000000..6787434e --- /dev/null +++ b/themes/envy/envy.theme.bash @@ -0,0 +1,16 @@ +#!/bin/bash +SCM_THEME_PROMPT_DIRTY=" ${red}✗" +SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓" +SCM_THEME_PROMPT_PREFIX=" |" +SCM_THEME_PROMPT_SUFFIX="${green}|" + +GIT_THEME_PROMPT_DIRTY=" ${red}✗" +GIT_THEME_PROMPT_CLEAN=" ${bold_green}✓" +GIT_THEME_PROMPT_PREFIX=" ${green}|" +GIT_THEME_PROMPT_SUFFIX="${green}|" + +function prompt_command() { + PS1="\n${yellow}$(rbenv_version_prompt)$(rvm_version_prompt) ${purple}\h ${reset_color}in ${green}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}→${reset_color} " +} + +PROMPT_COMMAND=prompt_command; From ef4111e9b0494643c2655692bb10650ea5e54b89 Mon Sep 17 00:00:00 2001 From: Victor Castell Date: Sat, 5 Nov 2011 13:20:00 +0100 Subject: [PATCH 2/3] rbenv plugin --- plugins/available/rbenv.bash | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 plugins/available/rbenv.bash diff --git a/plugins/available/rbenv.bash b/plugins/available/rbenv.bash new file mode 100644 index 00000000..6fd8f10c --- /dev/null +++ b/plugins/available/rbenv.bash @@ -0,0 +1,13 @@ +#!/bin/bash + +# Load rbebv, if you are using it +export PATH="$HOME/.rbenv/bin:$PATH" +eval "$(rbenv init -)" + +# Check to make sure that RVM is actually loaded before adding +# the customizations to it. +if [ "$rvm_path" ] +then + # Load the auto-completion script if rbenv was loaded. + source ~/.rbenv/completions/rbenv.bash +fi \ No newline at end of file From e7deb903355d16b14398c2411895e55a782eba23 Mon Sep 17 00:00:00 2001 From: Victor Castell Date: Sat, 5 Nov 2011 15:53:27 +0100 Subject: [PATCH 3/3] Typos in plugin --- plugins/available/rbenv.bash | 13 ------------- plugins/available/rbenv.plugin.bash | 8 ++++++++ 2 files changed, 8 insertions(+), 13 deletions(-) delete mode 100644 plugins/available/rbenv.bash create mode 100644 plugins/available/rbenv.plugin.bash diff --git a/plugins/available/rbenv.bash b/plugins/available/rbenv.bash deleted file mode 100644 index 6fd8f10c..00000000 --- a/plugins/available/rbenv.bash +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -# Load rbebv, if you are using it -export PATH="$HOME/.rbenv/bin:$PATH" -eval "$(rbenv init -)" - -# Check to make sure that RVM is actually loaded before adding -# the customizations to it. -if [ "$rvm_path" ] -then - # Load the auto-completion script if rbenv was loaded. - source ~/.rbenv/completions/rbenv.bash -fi \ No newline at end of file diff --git a/plugins/available/rbenv.plugin.bash b/plugins/available/rbenv.plugin.bash new file mode 100644 index 00000000..bfac84d1 --- /dev/null +++ b/plugins/available/rbenv.plugin.bash @@ -0,0 +1,8 @@ +#!/bin/bash + +# Load rbebv, if you are using it +export PATH="$HOME/.rbenv/bin:$PATH" +eval "$(rbenv init -)" + +# Load the auto-completion script if rbenv was loaded. +source ~/.rbenv/completions/rbenv.bash \ No newline at end of file