Merge pull request #229 from oddjobsman/master
Added Sexy Bash Prompt suggested by @addyosmani in "A Toolbelt For The M...
diff --git a/README.md b/README.md
index 105d5be..527034c 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@
## Install
-1. Check a clone of this repo: `git clone http://github.com/revans/bash-it.git ~/.bash_it`
+1. Check a clone of this repo: `git clone https://github.com/revans/bash-it.git ~/.bash_it`
2. Run `~/.bash_it/install.sh` (it automatically backs up your `~/.bash_profile`)
3. Edit your `~/.bash_profile` file in order to customize bash-it.
diff --git a/aliases/available/gitsvn.aliases.bash b/aliases/available/gitsvn.aliases.bash
new file mode 100644
index 0000000..feb608b
--- /dev/null
+++ b/aliases/available/gitsvn.aliases.bash
@@ -0,0 +1,7 @@
+cite 'about-alias'
+about-alias 'common git-svn abbreviations'
+
+# Aliases
+alias gsr='git svn rebase'
+alias gsc='git svn dcommit'
+alias gsi='git svn info'
diff --git a/plugins/available/chruby-auto.bash b/plugins/available/chruby-auto.bash
new file mode 100644
index 0000000..49efc50
--- /dev/null
+++ b/plugins/available/chruby-auto.bash
@@ -0,0 +1,5 @@
+cite about-plugin
+about-plugin 'load chruby + auto-switching (from /usr/local/share/chruby)'
+
+source /usr/local/share/chruby/chruby.sh
+source /usr/local/share/chruby/auto.sh
diff --git a/plugins/available/chruby.bash b/plugins/available/chruby.bash
new file mode 100644
index 0000000..c679347
--- /dev/null
+++ b/plugins/available/chruby.bash
@@ -0,0 +1,4 @@
+cite about-plugin
+about-plugin 'load chruby (from /usr/local/share/chruby)'
+
+source /usr/local/share/chruby/chruby.sh
diff --git a/themes/base.theme.bash b/themes/base.theme.bash
index 5a5edd3..001ca65 100644
--- a/themes/base.theme.bash
+++ b/themes/base.theme.bash
@@ -132,8 +132,18 @@
fi
}
+function chruby_version_prompt {
+ if declare -f -F chruby &> /dev/null; then
+ if declare -f -F chruby_auto &> /dev/null; then
+ chruby_auto
+ fi
+ chruby=$(ruby --version | awk '{print $1, $2;}') || return
+ echo -e "$CHRUBY_THEME_PROMPT_PREFIX$chruby$CHRUBY_THEME_PROMPT_SUFFIX"
+ fi
+}
+
function ruby_version_prompt {
- echo -e "$(rbfu_version_prompt)$(rbenv_version_prompt)$(rvm_version_prompt)"
+ echo -e "$(rbfu_version_prompt)$(rbenv_version_prompt)$(rvm_version_prompt)$(chruby_version_prompt)"
}
function virtualenv_prompt {
diff --git a/themes/nwinkler/nwinkler.theme.bash b/themes/nwinkler/nwinkler.theme.bash
new file mode 100644
index 0000000..b8bcc22
--- /dev/null
+++ b/themes/nwinkler/nwinkler.theme.bash
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+# Two line prompt showing the following information:
+# (time) SCM [username@hostname] pwd (SCM branch SCM status)
+# →
+#
+# Example:
+# (14:00:26) ± [foo@bar] ~/.bash_it (master ✓)
+# →
+#
+# The arrow on the second line is showing the exit status of the last command:
+# * Green: 0 exit status
+# * Red: non-zero exit status
+#
+# The exit code functionality currently doesn't work if you are using the 'fasd' plugin,
+# since 'fasd' is messing with the $PROMPT_COMMAND
+
+
+PROMPT_END_CLEAN="${green}→${reset_color}"
+PROMPT_END_DIRTY="${red}→${reset_color}"
+
+function prompt_end() {
+ echo -e "$PROMPT_END"
+}
+
+prompt_setter() {
+ local exit_status=$?
+ if [[ $exit_status -eq 0 ]]; then PROMPT_END=$PROMPT_END_CLEAN
+ else PROMPT_END=$PROMPT_END_DIRTY
+ fi
+ # Save history
+ history -a
+ history -c
+ history -r
+ PS1="(\t) $(scm_char) [${blue}\u${reset_color}@${green}\H${reset_color}] ${yellow}\w${reset_color}$(scm_prompt_info) ${reset_color}\n$(prompt_end) "
+ PS2='> '
+ PS4='+ '
+}
+
+PROMPT_COMMAND=prompt_setter
+
+SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}"
+SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}"
+SCM_THEME_PROMPT_PREFIX=" ("
+SCM_THEME_PROMPT_SUFFIX=")"
+RVM_THEME_PROMPT_PREFIX=" ("
+RVM_THEME_PROMPT_SUFFIX=")"