Merge pull request #225 from Bakke/master
Add Bakke theme
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/git.aliases.bash b/aliases/available/git.aliases.bash
index ab86853..d0dacbd 100644
--- a/aliases/available/git.aliases.bash
+++ b/aliases/available/git.aliases.bash
@@ -5,6 +5,8 @@
alias gcl='git clone'
alias ga='git add'
alias gall='git add .'
+alias gus='git reset HEAD'
+alias gm="git merge"
alias g='git'
alias get='git'
alias gst='git status'
@@ -19,6 +21,7 @@
alias gdv='git diff -w "$@" | vim -R -'
alias gc='git commit -v'
alias gca='git commit -v -a'
+alias gcm='git commit -v -m'
alias gci='git commit --interactive'
alias gb='git branch'
alias gba='git branch -a'
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/aliases/available/osx.aliases.bash b/aliases/available/osx.aliases.bash
index 3d82b50..3a5f45a 100644
--- a/aliases/available/osx.aliases.bash
+++ b/aliases/available/osx.aliases.bash
@@ -5,7 +5,7 @@
alias fireworks="open -a '/Applications/Adobe Fireworks CS3/Adobe Fireworks CS3.app'"
alias photoshop="open -a '/Applications/Adobe Photoshop CS3/Adobe Photoshop.app'"
alias preview="open -a '$PREVIEW'"
-alias xcode="open -a '/Developer/Applications/Xcode.app'"
+alias xcode="open -a '/Applications/XCode.app'"
alias filemerge="open -a '/Developer/Applications/Utilities/FileMerge.app'"
alias safari="open -a safari"
alias firefox="open -a firefox"
diff --git a/aliases/available/vagrant.aliases.bash b/aliases/available/vagrant.aliases.bash
new file mode 100644
index 0000000..f8ff843
--- /dev/null
+++ b/aliases/available/vagrant.aliases.bash
@@ -0,0 +1,17 @@
+cite 'about-alias'
+about-alias 'vagrant aliases'
+
+# Aliases
+alias vup="vagrant up"
+alias vh="vagrant halt"
+alias vs="vagrant suspend"
+alias vr="vagrant resume"
+alias vrl="vagrant reload"
+alias vssh="vagrant ssh"
+alias vst="vagrant status"
+alias vp="vagrant provision"
+alias vdstr="vagrant destroy"
+# requires vagrant-list plugin
+alias vl="vagrant list"
+# requires vagrant-hostmanager plugin
+alias vhst="vagrant hostmanager"
diff --git a/completion/available/capistrano.completion.bash b/completion/available/capistrano.completion.bash
new file mode 100644
index 0000000..a48bd4d
--- /dev/null
+++ b/completion/available/capistrano.completion.bash
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+# Bash completion support for Capistrano.
+
+export COMP_WORDBREAKS=${COMP_WORDBREAKS/\:/}
+
+_capcomplete() {
+ if [ -f Capfile ]; then
+ recent=`ls -t .cap_tasks~ Capfile **/*.cap 2> /dev/null | head -n 1`
+ if [[ $recent != '.cap_tasks~' ]]; then
+ cap --tool --tasks | cut -d " " -f 2 > .cap_tasks~
+ fi
+ COMPREPLY=($(compgen -W "`cat .cap_tasks~`" -- ${COMP_WORDS[COMP_CWORD]}))
+ return 0
+ fi
+}
+
+complete -o default -o nospace -F _capcomplete cap
diff --git a/completion/available/grunt.completion.bash b/completion/available/grunt.completion.bash
new file mode 100644
index 0000000..99a96b5
--- /dev/null
+++ b/completion/available/grunt.completion.bash
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+# grunt-cli
+# http://gruntjs.com/
+#
+# Copyright (c) 2012 Tyler Kellen, contributors
+# Licensed under the MIT license.
+# https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
+
+# Usage:
+#
+# To enable bash <tab> completion for grunt, add the following line (minus the
+# leading #, which is the bash comment character) to your ~/.bashrc file:
+#
+# eval "$(grunt --completion=bash)"
+
+# Search the current directory and all parent directories for a gruntfile.
+function _grunt_gruntfile() {
+ local curpath="$PWD"
+ while [[ "$curpath" ]]; do
+ for gruntfile in "$curpath/"{G,g}runtfile.{js,coffee}; do
+ if [[ -e "$gruntfile" ]]; then
+ echo "$gruntfile"
+ return
+ fi
+ done
+ curpath="${curpath%/*}"
+ done
+ return 1
+}
+
+# Enable bash autocompletion.
+function _grunt_completions() {
+ # The currently-being-completed word.
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ # The current gruntfile, if it exists.
+ local gruntfile="$(_grunt_gruntfile)"
+ # The current grunt version, available tasks, options, etc.
+ local gruntinfo="$(grunt --version --verbose 2>/dev/null)"
+ # Options and tasks.
+ local opts="$(echo "$gruntinfo" | awk '/Available options: / {$1=$2=""; print $0}')"
+ local compls="$(echo "$gruntinfo" | awk '/Available tasks: / {$1=$2=""; print $0}')"
+ # Only add -- or - options if the user has started typing -
+ [[ "$cur" == -* ]] && compls="$compls $opts"
+ # Tell complete what stuff to show.
+ COMPREPLY=($(compgen -W "$compls" -- "$cur"))
+}
+
+complete -o default -F _grunt_completions grunt
diff --git a/plugins/available/base.plugin.bash b/plugins/available/base.plugin.bash
index e07401b..e028fe6 100644
--- a/plugins/available/base.plugin.bash
+++ b/plugins/available/base.plugin.bash
@@ -175,6 +175,33 @@
type "$1" &> /dev/null ;
}
+mkiso ()
+{
+
+ about 'creates iso from current dir in the parent dir (unless defined)'
+ param '1: ISO name'
+ param '2: dest/path'
+ param '3: src/path'
+ example 'mkiso'
+ example 'mkiso ISO-Name dest/path src/path'
+ group 'base'
+
+ if type "mkisofs" > /dev/null; then
+ [ -z ${1+x} ] && local isoname=${PWD##*/} || local isoname=$1
+ [ -z ${2+x} ] && local destpath=../ || local destpath=$2
+ [ -z ${3+x} ] && local srcpath=${PWD} || local srcpath=$3
+
+ if [ ! -f "${destpath}${isoname}.iso" ]; then
+ echo "writing ${isoname}.iso to ${destpath} from ${srcpath}"
+ mkisofs -V ${isoname} -iso-level 3 -r -o "${destpath}${isoname}.iso" "${srcpath}"
+ else
+ echo "${destpath}${isoname}.iso already exists"
+ fi
+ else
+ echo "mkisofs cmd does not exist, please install cdrtools"
+ fi
+}
+
# useful for administrators and configs
buf ()
{
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/plugins/available/git.plugin.bash b/plugins/available/git.plugin.bash
index 0b77111..6506ca4 100644
--- a/plugins/available/git.plugin.bash
+++ b/plugins/available/git.plugin.bash
@@ -17,6 +17,92 @@
git push origin master:refs/heads/master
}
+function git_pub() {
+ about 'publishes current branch to remote origin'
+ group 'git'
+ BRANCH=$(git rev-parse --abbrev-ref HEAD)
+
+ echo "Publishing ${BRANCH} to remote origin"
+ git push -u origin $BRANCH
+}
+
+function git_revert() {
+ about 'applies changes to HEAD that revert all changes after this commit'
+ group 'git'
+
+ git reset $1
+ git reset --soft HEAD@{1}
+ git commit -m "Revert to ${1}"
+ git reset --hard
+}
+
+function git_rollback() {
+ about 'resets the current HEAD to this commit'
+ group 'git'
+
+ function is_clean() {
+ if [[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]]; then
+ echo "Your branch is dirty, please commit your changes"
+ kill -INT $$
+ fi
+ }
+
+ function commit_exists() {
+ git rev-list --quiet $1
+ status=$?
+ if [ $status -ne 0 ]; then
+ echo "Commit ${1} does not exist"
+ kill -INT $$
+ fi
+ }
+
+ function keep_changes() {
+ while true
+ do
+ read -p "Do you want to keep all changes from rolled back revisions in your working tree? [Y/N]" RESP
+ case $RESP
+ in
+ [yY])
+ echo "Rolling back to commit ${1} with unstaged changes"
+ git reset $1
+ break
+ ;;
+ [nN])
+ echo "Rolling back to commit ${1} with a clean working tree"
+ git reset --hard $1
+ break
+ ;;
+ *)
+ echo "Please enter Y or N"
+ esac
+ done
+ }
+
+ if [ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]; then
+ is_clean
+ commit_exists $1
+
+ while true
+ do
+ read -p "WARNING: This will change your history and move the current HEAD back to commit ${1}, continue? [Y/N]" RESP
+ case $RESP
+ in
+ [yY])
+ keep_changes $1
+ break
+ ;;
+ [nN])
+ break
+ ;;
+ *)
+ echo "Please enter Y or N"
+ esac
+ done
+ else
+ echo "you're currently not in a git repository"
+ fi
+}
+
function git_remove_missing_files() {
about "git rm's missing files"
group 'git'
diff --git a/plugins/available/osx.plugin.bash b/plugins/available/osx.plugin.bash
index fde9c83..5b605ce 100644
--- a/plugins/available/osx.plugin.bash
+++ b/plugins/available/osx.plugin.bash
@@ -11,7 +11,7 @@
end
tell application "Terminal"
activate
- do script with command "cd \"$PWD\"; $*" in window 1
+ do script with command " cd \"$PWD\"; $*" in window 1
end tell
EOF
}
diff --git a/themes/base.theme.bash b/themes/base.theme.bash
index 5a5edd3..d616927 100644
--- a/themes/base.theme.bash
+++ b/themes/base.theme.bash
@@ -70,18 +70,28 @@
}
function git_prompt_vars {
- if [[ -n $(git status -s 2> /dev/null |grep -v ^# |grep -v "working directory clean") ]]; then
+ SCM_GIT_AHEAD=''
+ SCM_GIT_BEHIND=''
+ SCM_GIT_STASH=''
+ local status="$(git status -bs --porcelain 2> /dev/null)"
+ if [[ -n "$(grep -v ^# <<< "${status}")" ]]; then
SCM_DIRTY=1
- SCM_STATE=${GIT_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY}
+ SCM_STATE=${GIT_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY}
else
SCM_DIRTY=0
- SCM_STATE=${GIT_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN}
+ SCM_STATE=${GIT_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN}
fi
SCM_PREFIX=${GIT_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX}
SCM_SUFFIX=${GIT_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX}
local ref=$(git symbolic-ref HEAD 2> /dev/null)
SCM_BRANCH=${ref#refs/heads/}
SCM_CHANGE=$(git rev-parse HEAD 2>/dev/null)
+ local ahead_re='.+ahead ([0-9]+).+'
+ local behind_re='.+behind ([0-9]+).+'
+ [[ "${status}" =~ ${ahead_re} ]] && SCM_GIT_AHEAD=" ${SCM_GIT_AHEAD_CHAR}${BASH_REMATCH[1]}"
+ [[ "${status}" =~ ${behind_re} ]] && SCM_GIT_BEHIND=" ${SCM_GIT_BEHIND_CHAR}${BASH_REMATCH[1]}"
+ local stash_count="$(git stash list | wc -l | tr -d ' ')"
+ [[ "${stash_count}" -gt 0 ]] && SCM_GIT_STASH=" {${stash_count}}"
}
function svn_prompt_vars {
@@ -132,8 +142,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=")"
diff --git a/themes/powerline-plain/powerline-plain.theme.bash b/themes/powerline-plain/powerline-plain.theme.bash
new file mode 100644
index 0000000..4a83513
--- /dev/null
+++ b/themes/powerline-plain/powerline-plain.theme.bash
@@ -0,0 +1,93 @@
+#!/usr/bin/env bash
+
+SHELL_SSH_CHAR="⌁ "
+SHELL_THEME_PROMPT_COLOR=32
+SHELL_SSH_THEME_PROMPT_COLOR=208
+
+VIRTUALENV_CHAR="ⓔ "
+VIRTUALENV_THEME_PROMPT_COLOR=35
+
+SCM_NONE_CHAR=""
+SCM_GIT_CHAR="⎇ "
+SCM_GIT_BEHIND_CHAR="↓"
+SCM_GIT_AHEAD_CHAR="↑"
+SCM_THEME_PROMPT_CLEAN=""
+SCM_THEME_PROMPT_DIRTY=""
+SCM_THEME_PROMPT_COLOR=238
+SCM_THEME_PROMPT_CLEAN_COLOR=231
+SCM_THEME_PROMPT_DIRTY_COLOR=220
+
+CWD_THEME_PROMPT_COLOR=240
+
+LAST_STATUS_THEME_PROMPT_COLOR=52
+
+function set_rgb_color {
+ if [[ "${1}" != "-" ]]; then
+ fg="38;5;${1}"
+ fi
+ if [[ "${2}" != "-" ]]; then
+ bg="48;5;${2}"
+ [[ -n "${fg}" ]] && bg=";${bg}"
+ fi
+ echo -e "\[\033[${fg}${bg}m\]"
+}
+
+function powerline_shell_prompt {
+ if [[ -n "${SSH_CLIENT}" ]]; then
+ SHELL_PROMPT="${bold_white}$(set_rgb_color - ${SHELL_SSH_THEME_PROMPT_COLOR}) ${SHELL_SSH_CHAR}\u@\h ${normal}"
+ else
+ SHELL_PROMPT="${bold_white}$(set_rgb_color - ${SHELL_THEME_PROMPT_COLOR}) \u ${normal}"
+ fi
+}
+
+function powerline_virtualenv_prompt {
+ if [[ -n "$VIRTUAL_ENV" ]]; then
+ virtualenv=$(basename "$VIRTUAL_ENV")
+ VIRTUALENV_PROMPT="$(set_rgb_color - ${VIRTUALENV_THEME_PROMPT_COLOR}) ${VIRTUALENV_CHAR}$virtualenv ${normal}"
+ else
+ VIRTUALENV_PROMPT=""
+ fi
+}
+
+function powerline_scm_prompt {
+ scm_prompt_vars
+
+ if [[ "${SCM_NONE_CHAR}" != "${SCM_CHAR}" ]]; then
+ if [[ "${SCM_DIRTY}" -eq 1 ]]; then
+ SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_DIRTY_COLOR} ${SCM_THEME_PROMPT_COLOR})"
+ else
+ SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_CLEAN_COLOR} ${SCM_THEME_PROMPT_COLOR})"
+ fi
+ [[ "${SCM_GIT_CHAR}" == "${SCM_CHAR}" ]] && SCM_PROMPT+=" ${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}${SCM_GIT_BEHIND}${SCM_GIT_AHEAD}${SCM_GIT_STASH}"
+ SCM_PROMPT="${SCM_PROMPT} ${normal}"
+ else
+ SCM_PROMPT=""
+ fi
+}
+
+function powerline_cwd_prompt {
+ CWD_PROMPT="${THEME_PROMPT_SEPARATOR}${normal}$(set_rgb_color - ${CWD_THEME_PROMPT_COLOR}) \w ${normal}$(set_rgb_color ${CWD_THEME_PROMPT_COLOR} -)${normal}"
+}
+
+function powerline_last_status_prompt {
+ if [[ "$1" -eq 0 ]]; then
+ LAST_STATUS_PROMPT=""
+ else
+ LAST_STATUS_PROMPT="$(set_rgb_color - ${LAST_STATUS_THEME_PROMPT_COLOR}) ${LAST_STATUS} ${normal}$(set_rgb_color ${LAST_STATUS_THEME_PROMPT_COLOR} -)${THEME_PROMPT_SEPARATOR}${normal}"
+ fi
+}
+
+function powerline_prompt_command() {
+ local LAST_STATUS="$?"
+
+ powerline_shell_prompt
+ powerline_virtualenv_prompt
+ powerline_scm_prompt
+ powerline_cwd_prompt
+ powerline_last_status_prompt LAST_STATUS
+
+ PS1="${SHELL_PROMPT}${VIRTUALENV_PROMPT}${SCM_PROMPT}${CWD_PROMPT}${LAST_STATUS_PROMPT} "
+}
+
+PROMPT_COMMAND=powerline_prompt_command
+
diff --git a/themes/powerline/powerline.theme.bash b/themes/powerline/powerline.theme.bash
new file mode 100644
index 0000000..518f054
--- /dev/null
+++ b/themes/powerline/powerline.theme.bash
@@ -0,0 +1,112 @@
+#!/usr/bin/env bash
+
+THEME_PROMPT_SEPARATOR=""
+
+SHELL_SSH_CHAR=" "
+SHELL_THEME_PROMPT_COLOR=32
+SHELL_SSH_THEME_PROMPT_COLOR=208
+
+VIRTUALENV_CHAR="ⓔ "
+VIRTUALENV_THEME_PROMPT_COLOR=35
+
+SCM_NONE_CHAR=""
+SCM_GIT_CHAR=" "
+SCM_GIT_BEHIND_CHAR="↓"
+SCM_GIT_AHEAD_CHAR="↑"
+SCM_THEME_PROMPT_CLEAN=""
+SCM_THEME_PROMPT_DIRTY=""
+SCM_THEME_PROMPT_COLOR=238
+SCM_THEME_PROMPT_CLEAN_COLOR=231
+SCM_THEME_PROMPT_DIRTY_COLOR=196
+SCM_THEME_PROMPT_STAGED_COLOR=220
+SCM_THEME_PROMPT_UNTRACKED_COLOR=033
+
+CWD_THEME_PROMPT_COLOR=240
+
+LAST_STATUS_THEME_PROMPT_COLOR=52
+
+function set_rgb_color {
+ if [[ "${1}" != "-" ]]; then
+ fg="38;5;${1}"
+ fi
+ if [[ "${2}" != "-" ]]; then
+ bg="48;5;${2}"
+ [[ -n "${fg}" ]] && bg=";${bg}"
+ fi
+ echo -e "\[\033[${fg}${bg}m\]"
+}
+
+function powerline_shell_prompt {
+ if [[ -n "${SSH_CLIENT}" ]]; then
+ SHELL_PROMPT="${bold_white}$(set_rgb_color - ${SHELL_SSH_THEME_PROMPT_COLOR}) ${SHELL_SSH_CHAR}\u@\h ${normal}"
+ LAST_THEME_COLOR=${SHELL_SSH_THEME_PROMPT_COLOR}
+ else
+ SHELL_PROMPT="${bold_white}$(set_rgb_color - ${SHELL_THEME_PROMPT_COLOR}) \u ${normal}"
+ LAST_THEME_COLOR=${SHELL_THEME_PROMPT_COLOR}
+ fi
+}
+
+function powerline_virtualenv_prompt {
+ if [[ -n "$VIRTUAL_ENV" ]]; then
+ virtualenv=$(basename "$VIRTUAL_ENV")
+ VIRTUALENV_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} ${VIRTUALENV_THEME_PROMPT_COLOR})${THEME_PROMPT_SEPARATOR}${normal}$(set_rgb_color - ${VIRTUALENV_THEME_PROMPT_COLOR}) ${VIRTUALENV_CHAR}$virtualenv ${normal}"
+ LAST_THEME_COLOR=${VIRTUALENV_THEME_PROMPT_COLOR}
+ else
+ VIRTUALENV_PROMPT=""
+ fi
+}
+
+function powerline_scm_prompt {
+ scm_prompt_vars
+ local git_status_output
+ git_status_output=$(git status 2> /dev/null )
+
+ if [[ "${SCM_NONE_CHAR}" != "${SCM_CHAR}" ]]; then
+ if [[ "${SCM_DIRTY}" -eq 1 ]]; then
+ if [ -n "$(echo $git_status_output | grep 'Changes not staged')" ]; then
+ SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_DIRTY_COLOR} ${SCM_THEME_PROMPT_COLOR})"
+ elif [ -n "$(echo $git_status_output | grep 'Changes to be committed')" ]; then
+ SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_STAGED_COLOR} ${SCM_THEME_PROMPT_COLOR})"
+ elif [ -n "$(echo $git_status_output | grep 'Untracked files')" ]; then
+ SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_UNTRACKED_COLOR} ${SCM_THEME_PROMPT_COLOR})"
+ else
+ SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_DIRTY_COLOR} ${SCM_THEME_PROMPT_COLOR})"
+ fi
+ else
+ SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_CLEAN_COLOR} ${SCM_THEME_PROMPT_COLOR})"
+ fi
+ [[ "${SCM_GIT_CHAR}" == "${SCM_CHAR}" ]] && SCM_PROMPT+=" ${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}${SCM_GIT_BEHIND}${SCM_GIT_AHEAD}${SCM_GIT_STASH}"
+ SCM_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} ${SCM_THEME_PROMPT_COLOR})${THEME_PROMPT_SEPARATOR}${normal}${SCM_PROMPT} ${normal}"
+ LAST_THEME_COLOR=${SCM_THEME_PROMPT_COLOR}
+ else
+ SCM_PROMPT=""
+ fi
+}
+
+function powerline_cwd_prompt {
+ CWD_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} ${CWD_THEME_PROMPT_COLOR})${THEME_PROMPT_SEPARATOR}${normal}$(set_rgb_color - ${CWD_THEME_PROMPT_COLOR}) \w ${normal}$(set_rgb_color ${CWD_THEME_PROMPT_COLOR} -)${normal}"
+ LAST_THEME_COLOR=${CWD_THEME_PROMPT_COLOR}
+}
+
+function powerline_last_status_prompt {
+ if [[ "$1" -eq 0 ]]; then
+ LAST_STATUS_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} -)${THEME_PROMPT_SEPARATOR}${normal}"
+ else
+ LAST_STATUS_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} ${LAST_STATUS_THEME_PROMPT_COLOR})${THEME_PROMPT_SEPARATOR}${normal}$(set_rgb_color - ${LAST_STATUS_THEME_PROMPT_COLOR}) ${LAST_STATUS} ${normal}$(set_rgb_color ${LAST_STATUS_THEME_PROMPT_COLOR} -)${THEME_PROMPT_SEPARATOR}${normal}"
+ fi
+}
+
+function powerline_prompt_command() {
+ local LAST_STATUS="$?"
+
+ powerline_shell_prompt
+ powerline_virtualenv_prompt
+ powerline_scm_prompt
+ powerline_cwd_prompt
+ powerline_last_status_prompt LAST_STATUS
+
+ PS1="${SHELL_PROMPT}${VIRTUALENV_PROMPT}${SCM_PROMPT}${CWD_PROMPT}${LAST_STATUS_PROMPT} "
+}
+
+PROMPT_COMMAND=powerline_prompt_command
+
diff --git a/themes/pure/pure.theme.bash b/themes/pure/pure.theme.bash
new file mode 100644
index 0000000..eaeb765
--- /dev/null
+++ b/themes/pure/pure.theme.bash
@@ -0,0 +1,43 @@
+# scm theming
+SCM_THEME_PROMPT_PREFIX="|"
+SCM_THEME_PROMPT_SUFFIX=""
+
+SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}"
+SCM_THEME_PROMPT_CLEAN=" ${green}✓${normal}"
+SCM_GIT_CHAR="${green}±${normal}"
+SCM_SVN_CHAR="${bold_cyan}⑆${normal}"
+SCM_HG_CHAR="${bold_red}☿${normal}"
+
+### TODO: openSUSE has already colors enabled, check if those differs from stock
+# LS colors, made with http://geoff.greer.fm/lscolors/
+# export LSCOLORS="Gxfxcxdxbxegedabagacad"
+# export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:'
+
+scm_prompt() {
+ CHAR=$(scm_char)
+ if [ $CHAR = $SCM_NONE_CHAR ]
+ then
+ return
+ else
+ echo "[$(scm_char)$(scm_prompt_info)]"
+ fi
+}
+
+pure_prompt() {
+ ps_host="${bold_blue}\h${normal}";
+ ps_user="${green}\u${normal}";
+ ps_user_mark="${green} $ ${normal}";
+ ps_root="${red}\u${red}";
+ ps_root="${red} # ${normal}"
+ ps_path="${yellow}\w${normal}";
+
+ # make it work
+ case $(id -u) in
+ 0) PS1="$ps_root@$ps_host$(scm_prompt):$ps_path$ps_root_mark"
+ ;;
+ *) PS1="$ps_user@$ps_host$(scm_prompt):$ps_path$ps_user_mark"
+ ;;
+ esac
+}
+
+PROMPT_COMMAND=pure_prompt;
diff --git a/themes/sexy/sexy.theme.bash b/themes/sexy/sexy.theme.bash
new file mode 100644
index 0000000..15b9a97
--- /dev/null
+++ b/themes/sexy/sexy.theme.bash
@@ -0,0 +1,47 @@
+# Sexy Bash Prompt, inspired by "Extravagant Zsh Prompt"
+# Screenshot: http://cloud.gf3.ca/M5rG
+# A big thanks to \amethyst on Freenode
+
+if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then export TERM=gnome-256color
+elif [[ $TERM != dumb ]] && infocmp xterm-256color >/dev/null 2>&1; then export TERM=xterm-256color
+fi
+
+if tput setaf 1 &> /dev/null; then
+ tput sgr0
+ if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then
+ MAGENTA=$(tput setaf 9)
+ ORANGE=$(tput setaf 172)
+ GREEN=$(tput setaf 190)
+ PURPLE=$(tput setaf 141)
+ WHITE=$(tput setaf 0)
+ else
+ MAGENTA=$(tput setaf 5)
+ ORANGE=$(tput setaf 4)
+ GREEN=$(tput setaf 2)
+ PURPLE=$(tput setaf 1)
+ WHITE=$(tput setaf 7)
+ fi
+ BOLD=$(tput bold)
+ RESET=$(tput sgr0)
+else
+ MAGENTA="\033[1;31m"
+ ORANGE="\033[1;33m"
+ GREEN="\033[1;32m"
+ PURPLE="\033[1;35m"
+ WHITE="\033[1;37m"
+ BOLD=""
+ RESET="\033[m"
+fi
+
+parse_git_dirty () {
+ [[ $(git status 2> /dev/null | tail -n1 | cut -c 1-17) != "nothing to commit" ]] && echo "*"
+}
+parse_git_branch () {
+ git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/"
+}
+
+function prompt_command() {
+ PS1="\[${BOLD}${MAGENTA}\]\u \[$WHITE\]at \[$ORANGE\]\h \[$WHITE\]in \[$GREEN\]\w\[$WHITE\]\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on \")\[$PURPLE\]\$(parse_git_branch)\[$WHITE\]\n\$ \[$RESET\]"
+}
+
+PROMPT_COMMAND=prompt_command