diff --git a/aliases/available/maven.aliases.bash b/aliases/available/maven.aliases.bash new file mode 100644 index 00000000..349f9d8f --- /dev/null +++ b/aliases/available/maven.aliases.bash @@ -0,0 +1,22 @@ +alias mci="mvn clean install" +alias mi="mvn install" +alias mrprep="mvn release:prepare" +alias mrperf="mvn release:perform" +alias mrrb="mvn release:rollback" +alias mdep="mvn dependency:tree" +alias mpom="mvn help:effective-pom" +alias mcisk="mci -Dmaven.test.skip=true" + +function maven-help() { + echo "Maven Custom Aliases Usage" + echo + echo " mci = mvn clean install" + echo " mi = mvn install" + echo " mrprep = mvn release:prepare" + echo " mrperf = mvn release:perform" + echo " mrrb = mvn release:rollback" + echo " mdep = mvn dependency:tree" + echo " mpom = mvn help:effective-pom" + echo " mcisk = mvn clean install -Dmaven.test.skip=true" + echo +} diff --git a/completion/available/ssh.completion.bash b/completion/available/ssh.completion.bash index 30fd65d6..ea49026c 100644 --- a/completion/available/ssh.completion.bash +++ b/completion/available/ssh.completion.bash @@ -13,7 +13,7 @@ _sshcomplete() { # parse all hosts found in .ssh/known_hosts if [ -r $HOME/.ssh/known_hosts ]; then if grep -v -q -e '^ ssh-rsa' $HOME/.ssh/known_hosts ; then - COMPREPLY=( $COMPREPLY $(compgen -W "$( awk '{print $1}' $HOME/.ssh/known_hosts | cut -d, -f 1 | sed -e 's/\[//g' | sed -e 's/\]//g' | cut -d: -f1 | grep -v ssh-rsa)" -- ${COMP_WORDS[COMP_CWORD]} )) + COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$( awk '{print $1}' $HOME/.ssh/known_hosts | cut -d, -f 1 | sed -e 's/\[//g' | sed -e 's/\]//g' | cut -d: -f1 | grep -v ssh-rsa)" -- ${COMP_WORDS[COMP_CWORD]} )) fi fi diff --git a/lib/preexec.bash b/lib/preexec.bash new file mode 100644 index 00000000..e092d82e --- /dev/null +++ b/lib/preexec.bash @@ -0,0 +1,195 @@ +#!/bin/bash +# http://www.twistedmatrix.com/users/glyph/preexec.bash.txt +# preexec.bash -- Bash support for ZSH-like 'preexec' and 'precmd' functions. + +# The 'preexec' function is executed before each interactive command is +# executed, with the interactive command as its argument. The 'precmd' +# function is executed before each prompt is displayed. + +# To use, in order: + +# 1. source this file +# 2. define 'preexec' and/or 'precmd' functions (AFTER sourcing this file), +# 3. as near as possible to the end of your shell setup, run 'preexec_install' +# to kick everything off. + +# Note: this module requires 2 bash features which you must not otherwise be +# using: the "DEBUG" trap, and the "PROMPT_COMMAND" variable. preexec_install +# will override these and if you override one or the other this _will_ break. + +# This is known to support bash3, as well as *mostly* support bash2.05b. It +# has been tested with the default shells on MacOS X 10.4 "Tiger", Ubuntu 5.10 +# "Breezy Badger", Ubuntu 6.06 "Dapper Drake", and Ubuntu 6.10 "Edgy Eft". + + +# Copy screen-run variables from the remote host, if they're available. + +if [[ "$SCREEN_RUN_HOST" == "" ]] +then + SCREEN_RUN_HOST="$LC_SCREEN_RUN_HOST" + SCREEN_RUN_USER="$LC_SCREEN_RUN_USER" +fi + +# This variable describes whether we are currently in "interactive mode"; +# i.e. whether this shell has just executed a prompt and is waiting for user +# input. It documents whether the current command invoked by the trace hook is +# run interactively by the user; it's set immediately after the prompt hook, +# and unset as soon as the trace hook is run. +preexec_interactive_mode="" + +# Default do-nothing implementation of preexec. +function preexec () { + true +} + +# Default do-nothing implementation of precmd. +function precmd () { + true +} + +# This function is installed as the PROMPT_COMMAND; it is invoked before each +# interactive prompt display. It sets a variable to indicate that the prompt +# was just displayed, to allow the DEBUG trap, below, to know that the next +# command is likely interactive. +function preexec_invoke_cmd () { + precmd + preexec_interactive_mode="yes" +} + +# This function is installed as the DEBUG trap. It is invoked before each +# interactive prompt display. Its purpose is to inspect the current +# environment to attempt to detect if the current command is being invoked +# interactively, and invoke 'preexec' if so. +function preexec_invoke_exec () { + if [[ -n "$COMP_LINE" ]] + then + # We're in the middle of a completer. This obviously can't be + # an interactively issued command. + return + fi + if [[ -z "$preexec_interactive_mode" ]] + then + # We're doing something related to displaying the prompt. Let the + # prompt set the title instead of me. + return + else + # If we're in a subshell, then the prompt won't be re-displayed to put + # us back into interactive mode, so let's not set the variable back. + # In other words, if you have a subshell like + # (sleep 1; sleep 2) + # You want to see the 'sleep 2' as a set_command_title as well. + if [[ 0 -eq "$BASH_SUBSHELL" ]] + then + preexec_interactive_mode="" + fi + fi + if [[ "preexec_invoke_cmd" == "$BASH_COMMAND" ]] + then + # Sadly, there's no cleaner way to detect two prompts being displayed + # one after another. This makes it important that PROMPT_COMMAND + # remain set _exactly_ as below in preexec_install. Let's switch back + # out of interactive mode and not trace any of the commands run in + # precmd. + + # Given their buggy interaction between BASH_COMMAND and debug traps, + # versions of bash prior to 3.1 can't detect this at all. + preexec_interactive_mode="" + return + fi + + # In more recent versions of bash, this could be set via the "BASH_COMMAND" + # variable, but using history here is better in some ways: for example, "ps + # auxf | less" will show up with both sides of the pipe if we use history, + # but only as "ps auxf" if not. + local this_command=`history 1 | sed -e "s/^[ ]*[0-9]*[ ]*//g"`; + + # If none of the previous checks have earlied out of this function, then + # the command is in fact interactive and we should invoke the user's + # preexec hook with the running command as an argument. + preexec "$this_command" +} + +# Execute this to set up preexec and precmd execution. +function preexec_install () { + + # *BOTH* of these options need to be set for the DEBUG trap to be invoked + # in ( ) subshells. This smells like a bug in bash to me. The null stderr + # redirections are to quiet errors on bash2.05 (i.e. OSX's default shell) + # where the options can't be set, and it's impossible to inherit the trap + # into subshells. + + set -o functrace > /dev/null 2>&1 + shopt -s extdebug > /dev/null 2>&1 + + # Finally, install the actual traps. + PROMPT_COMMAND="${PROMPT_COMMAND};preexec_invoke_cmd" + trap 'preexec_invoke_exec' DEBUG +} + +# Since this is the reason that 99% of everybody is going to bother with a +# pre-exec hook anyway, we'll include it in this module. + +# Change the title of the xterm. +function preexec_xterm_title () { + local title="$1" + echo -ne "\033]0;$title\007" > /dev/stderr +} + +function preexec_screen_title () { + local title="$1" + echo -ne "\033k$1\033\\" > /dev/stderr +} + +# Abbreviate the "user@host" string as much as possible to preserve space in +# screen titles. Elide the host if the host is the same, elide the user if the +# user is the same. +function preexec_screen_user_at_host () { + local RESULT="" + if [[ "$SCREEN_RUN_HOST" == "$SCREEN_HOST" ]] + then + return + else + if [[ "$SCREEN_RUN_USER" == "$USER" ]] + then + echo -n "@${SCREEN_HOST}" + else + echo -n "${USER}@${SCREEN_HOST}" + fi + fi +} + +function preexec_xterm_title_install () { + # These functions are defined here because they only make sense with the + # preexec_install below. + function precmd () { + preexec_xterm_title "${TERM} - ${USER}@${SCREEN_HOST} `dirs -0` $PROMPTCHAR" + if [[ "${TERM}" == screen ]] + then + preexec_screen_title "`preexec_screen_user_at_host`${PROMPTCHAR}" + fi + } + + function preexec () { + preexec_xterm_title "${TERM} - $1 {`dirs -0`} (${USER}@${SCREEN_HOST})" + if [[ "${TERM}" == screen ]] + then + local cutit="$1" + local cmdtitle=`echo "$cutit" | cut -d " " -f 1` + if [[ "$cmdtitle" == "exec" ]] + then + local cmdtitle=`echo "$cutit" | cut -d " " -f 2` + fi + if [[ "$cmdtitle" == "screen" ]] + then + # Since stacked screens are quite common, it would be nice to + # just display them as '$$'. + local cmdtitle="${PROMPTCHAR}" + else + local cmdtitle=":$cmdtitle" + fi + preexec_screen_title "`preexec_screen_user_at_host`${PROMPTCHAR}$cmdtitle" + fi + } + + preexec_install +} diff --git a/plugins/available/base.plugin.bash b/plugins/available/base.plugin.bash index 7a6dc80f..0a4e0c83 100644 --- a/plugins/available/base.plugin.bash +++ b/plugins/available/base.plugin.bash @@ -12,7 +12,7 @@ function down4me() { function myip { res=$(curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+') - echo "Your public IP is: ${bold_green} $res ${normal}" + echo -e "Your public IP is: ${echo_bold_green} $res ${echo_normal}" } pass() { 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 diff --git a/plugins/available/virtualenv.plugin.bash b/plugins/available/virtualenv.plugin.bash index a0e7b3f4..bb54e701 100644 --- a/plugins/available/virtualenv.plugin.bash +++ b/plugins/available/virtualenv.plugin.bash @@ -3,3 +3,8 @@ # make sure virtualenvwrapper is enabled if availalbe [[ `which virtualenvwrapper.sh` ]] && . virtualenvwrapper.sh +# create a new virtualenv for this directory +function mkvenv { + cwd=`basename \`pwd\`` + mkvirtualenv --no-site-packages --distribute $cwd +} diff --git a/plugins/available/xterm.plugins.bash b/plugins/available/xterm.plugins.bash new file mode 100644 index 00000000..94d4c33f --- /dev/null +++ b/plugins/available/xterm.plugins.bash @@ -0,0 +1,14 @@ +set_xterm_title () { + local title="$1" + echo -ne "\e]0;$title\007" +} + +precmd () { + set_xterm_title "${USER}@${HOSTNAME} `dirs -0` $PROMPTCHAR" +} + +preexec () { + set_xterm_title "$1 {`dirs -0`} (${USER}@${HOSTNAME})" +} + +preexec_install diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 05db36e5..503fc57b 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -24,6 +24,12 @@ RVM_THEME_PROMPT_SUFFIX='|' VIRTUALENV_THEME_PROMPT_PREFIX=' |' VIRTUALENV_THEME_PROMPT_SUFFIX='|' +RBENV_THEME_PROMPT_PREFIX=' |' +RBENV_THEME_PROMPT_SUFFIX='|' + +RBFU_THEME_PROMPT_PREFIX=' |' +RBFU_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 +119,23 @@ 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 rbfu_version_prompt { + if [[ $RBFU_RUBY_VERSION ]]; then + echo -e "${RBFU_THEME_PROMPT_PREFIX}${RBFU_RUBY_VERSION}${RBFU_THEME_PROMPT_SUFFIX}" + fi +} + +function ruby_version_prompt { + echo -e "$(rbfu_version_prompt)$(rbenv_version_prompt)$(rvm_version_prompt)" +} + function virtualenv_prompt { if which virtualenv &> /dev/null; then virtualenv=$([ ! -z "$VIRTUAL_ENV" ] && echo "`basename $VIRTUAL_ENV`") || return diff --git a/themes/bobby/bobby.theme.bash b/themes/bobby/bobby.theme.bash index cb51fb85..4d150106 100644 --- a/themes/bobby/bobby.theme.bash +++ b/themes/bobby/bobby.theme.bash @@ -13,8 +13,8 @@ RVM_THEME_PROMPT_PREFIX="|" RVM_THEME_PROMPT_SUFFIX="|" function prompt_command() { - #PS1="${bold_cyan}$(scm_char)${green}$(scm_prompt_info)${purple}$(rvm_version_prompt) ${yellow}\h ${reset_color}in ${green}\w ${reset_color}\n${green}→${reset_color} " - PS1="\n${yellow}$(rvm_version_prompt) ${purple}\h ${reset_color}in ${green}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}→${reset_color} " + #PS1="${bold_cyan}$(scm_char)${green}$(scm_prompt_info)${purple}$(ruby_version_prompt) ${yellow}\h ${reset_color}in ${green}\w ${reset_color}\n${green}→${reset_color} " + PS1="\n${yellow}$(ruby_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; diff --git a/themes/colors.theme.bash b/themes/colors.theme.bash index ff8776d2..9d756ee9 100644 --- a/themes/colors.theme.bash +++ b/themes/colors.theme.bash @@ -1,44 +1,270 @@ #!/bin/bash -black="\[\e[0;30m\]" -red="\[\e[0;31m\]" -green="\[\e[0;32m\]" -yellow="\[\e[0;33m\]" -blue="\[\e[0;34m\]" -purple="\[\e[0;35m\]" -cyan="\[\e[0;36m\]" -white="\[\e[1;37m\]" -orange="\[\e[33;40m\]" +function __ { + echo "$@" +} -bold_black="\[\e[1;30m\]" -bold_red="\[\e[1;31m\]" -bold_green="\[\e[1;32m\]" -bold_yellow="\[\e[1;33m\]" -bold_blue="\[\e[1;34m\]" -bold_purple="\[\e[1;35m\]" -bold_cyan="\[\e[1;36m\]" -bold_white="\[\e[1;37m\]" -bold_orange="\[\e[1;33;40m\]" +function __make_ansi { + next=$1 && shift + echo "\[\e[$(__$next $@)m\]" +} -underline_black="\[\e[4;30m\]" -underline_red="\[\e[4;31m\]" -underline_green="\[\e[4;32m\]" -underline_yellow="\[\e[4;33m\]" -underline_blue="\[\e[4;34m\]" -underline_purple="\[\e[4;35m\]" -underline_cyan="\[\e[4;36m\]" -underline_white="\[\e[4;37m\]" -underline_orange="\[\e[4;33;40m\]" - -background_black="\[\e[40m\]" -background_red="\[\e[41m\]" -background_green="\[\e[42m\]" -background_yellow="\[\e[43m\]" -background_blue="\[\e[44m\]" -background_purple="\[\e[45m\]" -background_cyan="\[\e[46m\]" -background_white="\[\e[47m\]" +function __make_echo { + next=$1 && shift + echo "\033[$(__$next $@)m" +} -normal="\[\e[00m\]" -reset_color="\[\e[39m\]" +function __reset { + next=$1 && shift + out="$(__$next $@)" + echo "0${out:+;${out}}" +} + +function __bold { + next=$1 && shift + out="$(__$next $@)" + echo "${out:+${out};}1" +} + +function __faint { + next=$1 && shift + out="$(__$next $@)" + echo "${out:+${out};}2" +} + +function __italic { + next=$1 && shift + out="$(__$next $@)" + echo "${out:+${out};}3" +} + +function __underline { + next=$1 && shift + out="$(__$next $@)" + echo "${out:+${out};}4" +} + +function __negative { + next=$1 && shift + out="$(__$next $@)" + echo "${out:+${out};}7" +} + +function __crossed { + next=$1 && shift + out="$(__$next $@)" + echo "${out:+${out};}8" +} + + +function __color_normal_fg { + echo "3$1" +} + +function __color_normal_bg { + echo "4$1" +} + +function __color_bright_fg { + echo "9$1" +} + +function __color_bright_bg { + echo "10$1" +} + + +function __color_black { + echo "0" +} + +function __color_red { + echo "1" +} + +function __color_green { + echo "2" +} + +function __color_yellow { + echo "3" +} + +function __color_blue { + echo "4" +} + +function __color_magenta { + echo "5" +} + +function __color_cyan { + echo "6" +} + +function __color_white { + echo "7" +} + +function __color_rgb { + r=$1 && g=$2 && b=$3 + [[ r == g && g == b ]] && echo $(( $r / 11 + 232 )) && return # gray range above 232 + echo "8;5;$(( ($r * 36 + $b * 6 + $g) / 51 + 16 ))" +} + +function __color { + color=$1 && shift + case "$1" in + fg|bg) side="$1" && shift ;; + *) side=fg;; + esac + case "$1" in + normal|bright) mode="$1" && shift;; + *) mode=normal;; + esac + [[ $color == "rgb" ]] && rgb="$1 $2 $3" && shift 3 + + next=$1 && shift + out="$(__$next $@)" + echo "$(__color_${mode}_${side} $(__color_${color} $rgb))${out:+;${out}}" +} + + +function __black { + echo "$(__color black $@)" +} + +function __red { + echo "$(__color red $@)" +} + +function __green { + echo "$(__color green $@)" +} + +function __yellow { + echo "$(__color yellow $@)" +} + +function __blue { + echo "$(__color blue $@)" +} + +function __magenta { + echo "$(__color magenta $@)" +} + +function __cyan { + echo "$(__color cyan $@)" +} + +function __white { + echo "$(__color white $@)" +} + +function __rgb { + echo "$(__color rgb $@)" +} + + +function __color_parse { + next=$1 && shift + echo "$(__$next $@)" +} + +function color { + echo "$(__color_parse make_ansi $@)" +} + +function echo_color { + echo "$(__color_parse make_echo $@)" +} + + +black="$(color black)" +red="$(color red)" +green="$(color green)" +yellow="$(color yellow)" +blue="$(color blue)" +purple="$(color magenta)" +cyan="$(color cyan)" +white="$(color white bold)" +orange="$(color red fg bright)" + +bold_black="$(color black bold)" +bold_red="$(color red bold)" +bold_green="$(color green bold)" +bold_yellow="$(color yellow bold)" +bold_blue="$(color blue bold)" +bold_purple="$(color magenta bold)" +bold_cyan="$(color cyan bold)" +bold_white="$(color white bold)" +bold_orange="$(color red fg bright bold)" + +underline_black="$(color black underline)" +underline_red="$(color red underline)" +underline_green="$(color green underline)" +underline_yellow="$(color yellow underline)" +underline_blue="$(color blue underline)" +underline_purple="$(color magenta underline)" +underline_cyan="$(color cyan underline)" +underline_white="$(color white underline)" +underline_orange="$(color red fg bright underline)" + +background_black="$(color black bg)" +background_red="$(color red bg)" +background_green="$(color green bg)" +background_yellow="$(color yellow bg)" +background_blue="$(color blue bg)" +background_purple="$(color magenta bg)" +background_cyan="$(color cyan bg)" +background_white="$(color white bg bold)" +background_orange="$(color red bg bright)" + +normal="$(color reset)" +reset_color="$(__make_ansi '' 39)" + +# These colors are meant to be used with `echo -e` +echo_black="$(echo_color black)" +echo_red="$(echo_color red)" +echo_green="$(echo_color green)" +echo_yellow="$(echo_color yellow)" +echo_blue="$(echo_color blue)" +echo_purple="$(echo_color magenta)" +echo_cyan="$(echo_color cyan)" +echo_white="$(echo_color white bold)" +echo_orange="$(echo_color red fg bright)" + +echo_bold_black="$(echo_color black bold)" +echo_bold_red="$(echo_color red bold)" +echo_bold_green="$(echo_color green bold)" +echo_bold_yellow="$(echo_color yellow bold)" +echo_bold_blue="$(echo_color blue bold)" +echo_bold_purple="$(echo_color magenta bold)" +echo_bold_cyan="$(echo_color cyan bold)" +echo_bold_white="$(echo_color white bold)" +echo_bold_orange="$(echo_color red fg bright bold)" + +echo_underline_black="$(echo_color black underline)" +echo_underline_red="$(echo_color red underline)" +echo_underline_green="$(echo_color green underline)" +echo_underline_yellow="$(echo_color yellow underline)" +echo_underline_blue="$(echo_color blue underline)" +echo_underline_purple="$(echo_color magenta underline)" +echo_underline_cyan="$(echo_color cyan underline)" +echo_underline_white="$(echo_color white underline)" +echo_underline_orange="$(echo_color red fg bright underline)" + +echo_background_black="$(echo_color black bg)" +echo_background_red="$(echo_color red bg)" +echo_background_green="$(echo_color green bg)" +echo_background_yellow="$(echo_color yellow bg)" +echo_background_blue="$(echo_color blue bg)" +echo_background_purple="$(echo_color magenta bg)" +echo_background_cyan="$(echo_color cyan bg)" +echo_background_white="$(echo_color white bg bold)" +echo_background_orange="$(echo_color red bg bright)" + +echo_normal="$(echo_color reset)" +echo_reset_color="$(__make_echo '' 39)" diff --git a/themes/doubletime/doubletime.theme.bash b/themes/doubletime/doubletime.theme.bash index c3bf453d..c79ab5ec 100644 --- a/themes/doubletime/doubletime.theme.bash +++ b/themes/doubletime/doubletime.theme.bash @@ -50,7 +50,7 @@ function prompt_setter() { clock=$THEME_PROMPT_CLOCK_FORMAT fi PS1=" -$clock $(scm_char) [$THEME_PROMPT_HOST_COLOR\u@${THEME_PROMPT_HOST}$reset_color] $(virtualenv_prompt)$(rvm_version_prompt)\w +$clock $(scm_char) [$THEME_PROMPT_HOST_COLOR\u@${THEME_PROMPT_HOST}$reset_color] $(virtualenv_prompt)$(ruby_version_prompt)\w $(doubletime_scm_prompt)$reset_color $ " PS2='> ' PS4='+ ' diff --git a/themes/envy/envy.theme.bash b/themes/envy/envy.theme.bash new file mode 100644 index 00000000..d2f6a00b --- /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}$(ruby_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; diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index 93cef469..0b1fe3bd 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -98,7 +98,7 @@ function ip_prompt_info() { # Displays virtual info prompt (virtualenv/rvm) function virtual_prompt_info() { local virtual_env_info=$(virtualenv_prompt) - local rvm_info=$(rvm_version_prompt) + local rvm_info=$(ruby_version_prompt) local virtual_prompt="" local prefix=${VIRTUAL_THEME_PROMPT_PREFIX} diff --git a/themes/mbriggs/mbriggs.theme.bash b/themes/mbriggs/mbriggs.theme.bash new file mode 100644 index 00000000..674085b6 --- /dev/null +++ b/themes/mbriggs/mbriggs.theme.bash @@ -0,0 +1,34 @@ +# ------------------------------------------------------------------# +# FILE: mbriggs.zsh-theme # +# BY: Matt Briggs (matt@mattbriggs.net) # +# BASED ON: smt by Stephen Tudor (stephen@tudorstudio.com) # +# ------------------------------------------------------------------# + +SCM_THEME_PROMPT_DIRTY="${red}⚡${reset_color}" +SCM_THEME_PROMPT_AHEAD="${red}!${reset_color}" +SCM_THEME_PROMPT_CLEAN="${green}✓${reset_color}" +SCM_THEME_PROMPT_PREFIX=" " +SCM_THEME_PROMPT_SUFFIX="" +GIT_SHA_PREFIX=" ${yellow}" +GIT_SHA_SUFFIX="${reset_color}" + +function git_short_sha() { + SHA=$(git rev-parse --short HEAD 2> /dev/null) && echo "$GIT_SHA_PREFIX$SHA$GIT_SHA_SUFFIX" +} + +function prompt() { + local return_status="" + local ruby="${red}$(ruby_version_prompt)${reset_color}" + local user_host="${green}\h${reset_color}" + local current_path="\w" + local n_commands="\!" + local git_branch="$(git_short_sha)$(scm_prompt_info)" + local prompt_symbol='λ' + local open='(' + local close=')' + local prompt_char=' \$ ' + + PS1="\n${n_commands} ${user_host} ${prompt_symbol} ${ruby} ${open}${current_path}${git_branch}${close}${return_status}\n${prompt_char}" +} + +PROMPT_COMMAND=prompt \ No newline at end of file diff --git a/themes/pete/pete.theme.bash b/themes/pete/pete.theme.bash index 7b6702cf..cda451e1 100644 --- a/themes/pete/pete.theme.bash +++ b/themes/pete/pete.theme.bash @@ -5,7 +5,7 @@ prompt_setter() { 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)$(rvm_version_prompt) $reset_color " + PS1="(\t) $(scm_char) [$blue\u$reset_color@$green\H$reset_color] $yellow\w${reset_color}$(scm_prompt_info)$(ruby_version_prompt) $reset_color " PS2='> ' PS4='+ ' } diff --git a/themes/rainbowbrite/rainbowbrite.theme.bash b/themes/rainbowbrite/rainbowbrite.theme.bash index e4424bbe..11792305 100644 --- a/themes/rainbowbrite/rainbowbrite.theme.bash +++ b/themes/rainbowbrite/rainbowbrite.theme.bash @@ -11,9 +11,9 @@ prompt_setter() { history -c history -r # displays user@server in purple - # PS1="$red$(scm_char) $purple\u@\h$reset_color:$blue\w$yellow$(scm_prompt_info)$(rvm_version_prompt) $black\$$reset_color " + # PS1="$red$(scm_char) $purple\u@\h$reset_color:$blue\w$yellow$(scm_prompt_info)$(ruby_version_prompt) $black\$$reset_color " # no user@server - PS1="$red$(scm_char) $blue\w$yellow$(scm_prompt_info)$(rvm_version_prompt) $black\$$reset_color " + PS1="$red$(scm_char) $blue\w$yellow$(scm_prompt_info)$(ruby_version_prompt) $black\$$reset_color " PS2='> ' PS4='+ ' } diff --git a/themes/tylenol/tylenol.theme.bash b/themes/tylenol/tylenol.theme.bash index c915f561..d8b63efb 100644 --- a/themes/tylenol/tylenol.theme.bash +++ b/themes/tylenol/tylenol.theme.bash @@ -14,7 +14,7 @@ VIRTUALENV_THEME_PROMPT_PREFIX='|' VIRTUALENV_THEME_PROMPT_SUFFIX='|' function prompt_command() { - PS1="\n${green}$(virtualenv_prompt)${red}$(rvm_version_prompt) ${reset_color}\h ${orange}in ${reset_color}\w\n${yellow}$(scm_char)$(scm_prompt_info) ${yellow}→${white} " + PS1="\n${green}$(virtualenv_prompt)${red}$(ruby_version_prompt) ${reset_color}\h ${orange}in ${reset_color}\w\n${yellow}$(scm_char)$(scm_prompt_info) ${yellow}→${white} " } PROMPT_COMMAND=prompt_command;