From 047933378f51bf0c5ae1006f0644cd3dda2ccf7c Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Sat, 5 Feb 2011 11:49:47 -0600 Subject: [PATCH 001/151] Added titlebar PWD to modern theme --- themes/modern/modern.theme.bash | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/themes/modern/modern.theme.bash b/themes/modern/modern.theme.bash index 8688f366..9f5d47a0 100644 --- a/themes/modern/modern.theme.bash +++ b/themes/modern/modern.theme.bash @@ -7,6 +7,15 @@ SCM_GIT_CHAR='${bold_green}±${normal}' SCM_SVN_CHAR='${bold_cyan}⑆${normal}' SCM_HG_CHAR='${bold_red}☿${normal}' +case $TERM in + xterm*) + TITLEBAR="\[\033]0;\w\007\]" + ;; + *) + TITLEBAR="" + ;; +esac + PS3=">> " is_vim_shell() { @@ -32,10 +41,10 @@ prompt() { # Yes, the indenting on these is weird, but it has to be like # this otherwise it won't display properly. - PS1="${bold_red}┌─${reset_color}$(modern_scm_prompt)[${cyan}\W${normal}]$(is_vim_shell) + PS1="${TITLEBAR}${bold_red}┌─${reset_color}$(modern_scm_prompt)[${cyan}\W${normal}]$(is_vim_shell) ${bold_red}└─▪${normal} " else - PS1="┌─$(modern_scm_prompt)[${cyan}\W${normal}]$(is_vim_shell) + PS1="${TITLEBAR}┌─$(modern_scm_prompt)[${cyan}\W${normal}]$(is_vim_shell) └─▪ " fi } From 2228826861098b1270d2689ccb7ffd894202e049 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Mon, 14 Feb 2011 21:12:25 -0600 Subject: [PATCH 002/151] Added modern-t theme, theme to be used with the t (http://stevelosh.com/projects/t/) utility --- themes/modern-t/modern-t.theme.bash | 56 +++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 themes/modern-t/modern-t.theme.bash diff --git a/themes/modern-t/modern-t.theme.bash b/themes/modern-t/modern-t.theme.bash new file mode 100644 index 00000000..55da6e14 --- /dev/null +++ b/themes/modern-t/modern-t.theme.bash @@ -0,0 +1,56 @@ +SCM_THEME_PROMPT_PREFIX="" +SCM_THEME_PROMPT_SUFFIX="" + +SCM_THEME_PROMPT_DIRTY=' ${bold_red}✗${normal}' +SCM_THEME_PROMPT_CLEAN=' ${bold_green}✓${normal}' +SCM_GIT_CHAR='${bold_green}±${normal}' +SCM_SVN_CHAR='${bold_cyan}⑆${normal}' +SCM_HG_CHAR='${bold_red}☿${normal}' + +case $TERM in + xterm*) + TITLEBAR="\[\033]0;\w\007\]" + ;; + *) + TITLEBAR="" + ;; +esac + +PS3=">> " + +is_vim_shell() { + if [ ! -z "$VIMRUNTIME" ] + then + echo "[${cyan}vim shell${normal}]" + fi +} + +modern_scm_prompt() { + CHAR=$(scm_char) + if [ $CHAR = $SCM_NONE_CHAR ] + then + return + else + echo "[$(scm_char)][$(scm_prompt_info)]" + fi +} + +prompt() { + if [ $? -ne 0 ] + then + # Yes, the indenting on these is weird, but it has to be like + # this otherwise it won't display properly. + + PS1="${TITLEBAR}${bold_red}┌─[${cyan}$(t | wc -l | sed -e's/ *//')${reset_color}]${reset_color}$(modern_scm_prompt)[${cyan}\W${normal}]$(is_vim_shell) +${bold_red}└─▪${normal} " + else + PS1="${TITLEBAR}┌─[${cyan}$(t | wc -l | sed -e's/ *//')${reset_color}]$(modern_scm_prompt)[${cyan}\W${normal}]$(is_vim_shell) +└─▪ " + fi +} + +PS2="└─▪ " + + + +PROMPT_COMMAND=prompt From 9a6e84180517a6d36d4a4c9caf6c5ac1ca1ef37f Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Sat, 19 Feb 2011 20:48:03 -0600 Subject: [PATCH 003/151] Added alias, ripped off from oh-my-zsh --- aliases/general.aliases.bash | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aliases/general.aliases.bash b/aliases/general.aliases.bash index 0e05eb02..9d71a339 100644 --- a/aliases/general.aliases.bash +++ b/aliases/general.aliases.bash @@ -8,6 +8,8 @@ alias ll='ls -al' alias l='ls -a' alias l1='ls -1' +alias _="sudo" + if [ $(uname) = "Linux" ] then alias ls="ls --color=always" From e787f2653ea7a78bdcb4f8268d07fb2c789e99d0 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Sun, 27 Feb 2011 09:49:51 -0600 Subject: [PATCH 004/151] Added lsgrep() function and comments for mkcd() function --- plugins/base.plugin.bash | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/base.plugin.bash b/plugins/base.plugin.bash index 02c0104b..7f4ba2fa 100644 --- a/plugins/base.plugin.bash +++ b/plugins/base.plugin.bash @@ -11,11 +11,19 @@ function myip { echo "Your public IP is: ${bold_green} $res ${normal}" } +# Make a directory and immediately 'cd' into it + function mkcd(){ mkdir -p "$*" cd "$*" } +# Search through directory contents with grep + +function lsgrep(){ + ls | grep "$*" +} + # View man documentation in Preview pman () { man -t "${1}" | open -f -a $PREVIEW From 8ac6e4414e2e7cf555ca81750b4058ed1abdc4e6 Mon Sep 17 00:00:00 2001 From: Karl Swedberg Date: Sun, 27 Feb 2011 17:54:35 -0500 Subject: [PATCH 005/151] new "doubletime" theme with more granular git status markers and two-line prompt --- themes/doubletime/doubletime.theme.bash | 66 +++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 themes/doubletime/doubletime.theme.bash diff --git a/themes/doubletime/doubletime.theme.bash b/themes/doubletime/doubletime.theme.bash new file mode 100644 index 00000000..e1f91f5b --- /dev/null +++ b/themes/doubletime/doubletime.theme.bash @@ -0,0 +1,66 @@ +#!/bin/bash +SCM_THEME_PROMPT_DIRTY='' +SCM_THEME_PROMPT_CLEAN='' +SCM_GIT_CHAR='${bold_cyan}±${normal}' +SCM_SVN_CHAR='${bold_cyan}⑆${normal}' +SCM_HG_CHAR='${bold_red}☿${normal}' +SCM_THEME_PROMPT_PREFIX="" +SCM_THEME_PROMPT_SUFFIX="" +RVM_THEME_PROMPT_PREFIX=" (" +RVM_THEME_PROMPT_SUFFIX=")" + +doubletime_scm_prompt() { + CHAR=$(scm_char) + if [ $CHAR = $SCM_NONE_CHAR ] + then + return + else + echo "$(git_prompt_status)" + fi +} + +prompt_setter() { + # Save history + history -a + history -c + history -r + PS1=" +\t $(scm_char) [\[$blue\]\u@local\[$reset_color\]] \w +$(doubletime_scm_prompt)\[$reset_color\] $ " + PS2='> ' + PS4='+ ' +} + +PROMPT_COMMAND=prompt_setter + +git_prompt_status() { + + if [ -n "$(git status | grep 'Changes not staged' 2> /dev/null)" ]; then + git_status="${bold_red}$(scm_prompt_info) ✗" + elif [ -n "$(git status | grep 'Changes to be committed' 2> /dev/null)" ]; then + git_status="${bold_yellow}$(scm_prompt_info) ^" + elif [ -n "$(git status | grep 'Untracked files' 2> /dev/null)" ]; then + git_status="${bold_cyan}$(scm_prompt_info) +" + elif [ -n "$(git status | grep 'nothing to commit' 2> /dev/null)" ]; then + git_status="${bold_green}$(scm_prompt_info) ${green}✓" + else + git_status="$(scm_prompt_info)" + fi + echo "[$git_status${normal}]" + +} + +# git_prompt_color() { +# +# if [ -n "$(git status | grep 'Changes not staged' 2> /dev/null)" ]; then +# git_status='${bold_red} ✗' +# elif [ -n "$(git status | grep 'Changes to be committed' 2> /dev/null)" ]; then +# git_status='${bold_yellow} ^' +# elif [ -n "$(git status | grep 'Untracked files' 2> /dev/null)" ]; then +# git_status='${bold_cyan} +' +# else +# git_status='${bold_green} ✓' +# fi +# echo $git_status +# +# } From 0c2f3093a0ed950571ae6106ad37121a625bba80 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Mon, 28 Feb 2011 13:46:22 -0600 Subject: [PATCH 006/151] Add THEME_PROMPT_HOST for use in prompts This switches the doubletime theme over to using a variable for determining what to display in the prompt. The original version's use of a hard-coded `@local` means you would have that suffix displayed even on remote machines. --- themes/base.theme.bash | 1 + themes/doubletime/doubletime.theme.bash | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index e77d1d23..56629b9d 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -1,5 +1,6 @@ #!/bin/bash +THEME_PROMPT_HOST='\H' SCM_THEME_PROMPT_DIRTY=' ✗' SCM_THEME_PROMPT_CLEAN=' ✓' SCM_THEME_PROMPT_PREFIX=' |' diff --git a/themes/doubletime/doubletime.theme.bash b/themes/doubletime/doubletime.theme.bash index e1f91f5b..55df6935 100644 --- a/themes/doubletime/doubletime.theme.bash +++ b/themes/doubletime/doubletime.theme.bash @@ -25,7 +25,7 @@ prompt_setter() { history -c history -r PS1=" -\t $(scm_char) [\[$blue\]\u@local\[$reset_color\]] \w +\t $(scm_char) [\[$blue\]\u@${THEME_PROMPT_HOST}\[$reset_color\]] \w $(doubletime_scm_prompt)\[$reset_color\] $ " PS2='> ' PS4='+ ' From 1638a1a4351aa987284e7a7a42fd2e6ff1119b01 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Mon, 28 Feb 2011 14:18:46 -0600 Subject: [PATCH 007/151] Allow setting a custom host color This change allows someone to change their host color by adding the following to their `.bash_profile`: # change to red THEME_PROMPT_HOST_COLOR="red" # change to green THEME_PROMPT_HOST_COLOR="green" Any variable inside the `colors.theme.bash` can be used and it will be evaluated at the last minute. --- themes/doubletime/doubletime.theme.bash | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/themes/doubletime/doubletime.theme.bash b/themes/doubletime/doubletime.theme.bash index 55df6935..29dfa00f 100644 --- a/themes/doubletime/doubletime.theme.bash +++ b/themes/doubletime/doubletime.theme.bash @@ -9,6 +9,12 @@ SCM_THEME_PROMPT_SUFFIX="" RVM_THEME_PROMPT_PREFIX=" (" RVM_THEME_PROMPT_SUFFIX=")" +if [ ! -z $THEME_PROMPT_HOST_COLOR ]; then + THEME_PROMPT_HOST_COLOR=$(eval echo $`echo ${THEME_PROMPT_HOST_COLOR}`); +else + THEME_PROMPT_HOST_COLOR="$blue" +fi + doubletime_scm_prompt() { CHAR=$(scm_char) if [ $CHAR = $SCM_NONE_CHAR ] @@ -25,7 +31,7 @@ prompt_setter() { history -c history -r PS1=" -\t $(scm_char) [\[$blue\]\u@${THEME_PROMPT_HOST}\[$reset_color\]] \w +\t $(scm_char) [\[$THEME_PROMPT_HOST_COLOR\]\u@${THEME_PROMPT_HOST}\[$reset_color\]] \w $(doubletime_scm_prompt)\[$reset_color\] $ " PS2='> ' PS4='+ ' From ba9b5d22dff5ccd7f9732d959a639c3e77be8762 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Wed, 2 Mar 2011 23:42:01 -0600 Subject: [PATCH 008/151] Add support for showing what virtualenv is currently active This works with virtualenvwrapper to detect when a virtualenv is activated and adds "()" before the path that's being displayed. --- themes/doubletime/doubletime.theme.bash | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/themes/doubletime/doubletime.theme.bash b/themes/doubletime/doubletime.theme.bash index 29dfa00f..c5a8a420 100644 --- a/themes/doubletime/doubletime.theme.bash +++ b/themes/doubletime/doubletime.theme.bash @@ -25,13 +25,20 @@ doubletime_scm_prompt() { fi } +virtualenv_prompt() { + if [ ! -z "$VIRTUAL_ENV" ] + then + echo "(`basename $VIRTUAL_ENV`) " + fi +} + prompt_setter() { # Save history history -a history -c history -r PS1=" -\t $(scm_char) [\[$THEME_PROMPT_HOST_COLOR\]\u@${THEME_PROMPT_HOST}\[$reset_color\]] \w +\t $(scm_char) [\[$THEME_PROMPT_HOST_COLOR\]\u@${THEME_PROMPT_HOST}\[$reset_color\]] $(virtualenv_prompt)\w $(doubletime_scm_prompt)\[$reset_color\] $ " PS2='> ' PS4='+ ' From 27baae9cb3917d9a8e28ab831bd89e3f45ef84e3 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Wed, 2 Mar 2011 23:49:30 -0600 Subject: [PATCH 009/151] Add support for virtualenvwrapper if its present --- plugins/virtualenv.plugin.bash | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 plugins/virtualenv.plugin.bash diff --git a/plugins/virtualenv.plugin.bash b/plugins/virtualenv.plugin.bash new file mode 100644 index 00000000..a0e7b3f4 --- /dev/null +++ b/plugins/virtualenv.plugin.bash @@ -0,0 +1,5 @@ +#!/bin/bash + +# make sure virtualenvwrapper is enabled if availalbe +[[ `which virtualenvwrapper.sh` ]] && . virtualenvwrapper.sh + From a38012fb1822502bed12523c68faa2e6dd3dc3bd Mon Sep 17 00:00:00 2001 From: Jesus de Mula Cano Date: Fri, 4 Mar 2011 11:44:56 +0100 Subject: [PATCH 010/151] Added demula theme --- themes/demula/demula.theme.bash | 60 +++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 themes/demula/demula.theme.bash diff --git a/themes/demula/demula.theme.bash b/themes/demula/demula.theme.bash new file mode 100644 index 00000000..33396d94 --- /dev/null +++ b/themes/demula/demula.theme.bash @@ -0,0 +1,60 @@ +# ------------------------------------------------------------------ COLOR CONF +D_DEFAULT_COLOR='${gray}' +D_USER_COLOR='${purple}' +D_SUPERUSER_COLOR='${red}' +D_MACHINE_COLOR='${cyan}' +D_DIR_COLOR='${green}' +D_SCM_COLOR='${yellow}' +D_BRANCH_COLOR='${yellow}' +D_CHANGES_COLOR='${white}' +D_CMDFAIL_COLOR='${red}' + +case $TERM in + xterm*) + TITLEBAR="\[\033]0;\w\007\]" + ;; + *) + TITLEBAR="" + ;; +esac + +PS3=">> " + +is_vim_shell() { + if [ ! -z "$VIMRUNTIME" ] + then + echo "on ${cyan}vim shell${white} " + fi +} + +mitsuhikos_lastcommandfailed() { + code=$? + if [ $code != 0 ]; then + echo -n '\[${white}\]exited \[${red}\]' + echo -n $code + echo -n '\[${white}\] ' + fi +} + +D_VCPROMPT_EXECUTABLE=~/.vcprompt/bin/vcprompt +D_VCPROMPT_FORMAT="on ${D_SCM_COLOR}%s${white}:${D_BRANCH_COLOR}%b %r ${D_CHANGES_COLOR}%m%u ${white}" +demula_vcprompt() { + $D_VCPROMPT_EXECUTABLE -f "$D_VCPROMPT_FORMAT" +} + +prompt() { + # Yes, the indenting on these is weird, but it has to be like + # this otherwise it won't display properly. + + PS1="\n${TITLEBAR}\[${D_USER_COLOR}\]\u ${white}\ +at \[${D_MACHINE_COLOR}\]\h ${white}\ +in \[${D_DIR_COLOR}\]\w ${white}\ +$(mitsuhikos_lastcommandfailed)\ +$(demula_vcprompt)\ +$(is_vim_shell) +$ ${normal}" +} + +PS2="$ " + +PROMPT_COMMAND=prompt From 5f8e0c49d67b680f30113bc58ce0bf9e658996f4 Mon Sep 17 00:00:00 2001 From: Jesus de Mula Cano Date: Fri, 4 Mar 2011 11:48:12 +0100 Subject: [PATCH 011/151] python plugin updated to work with archlinux (envvar python is python 3 not 2). --- plugins/python.plugin.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/python.plugin.bash b/plugins/python.plugin.bash index 92f50e02..280beb1a 100644 --- a/plugins/python.plugin.bash +++ b/plugins/python.plugin.bash @@ -1,4 +1,4 @@ #!/bin/bash -alias http='python -m SimpleHTTPServer' +alias http='python2 -m SimpleHTTPServer' From 6dd943a23e8b0d1ed41ffa8d784446ba27f52c1f Mon Sep 17 00:00:00 2001 From: Jeff Kolesky Date: Sat, 5 Mar 2011 18:08:03 -0500 Subject: [PATCH 012/151] adds git info to prompt below the root of a repository --- themes/base.theme.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 56629b9d..70876622 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -22,6 +22,7 @@ RVM_THEME_PROMPT_SUFFIX='|' function scm { if [[ -d .git ]]; then SCM=$GIT + elif [[ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]]; then SCM=$GIT elif [[ -d .hg ]]; then SCM=$HG elif [[ -d .svn ]]; then SCM=$SVN else SCM='NONE' From 8188b91db37759cc76edf87697913ea82a896350 Mon Sep 17 00:00:00 2001 From: Jesus de Mula Cano Date: Sun, 6 Mar 2011 18:12:24 +0100 Subject: [PATCH 013/151] new battery plugin that shows energy in a "bar" all done with acpi and bash --- plugins/battery.plugin.bash | 136 ++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 plugins/battery.plugin.bash diff --git a/plugins/battery.plugin.bash b/plugins/battery.plugin.bash new file mode 100644 index 00000000..c0ec6f4e --- /dev/null +++ b/plugins/battery.plugin.bash @@ -0,0 +1,136 @@ +#!/bin/bash + +battery_percentage(){ + local ACPI_OUTPUT=$(acpi -b) + case $ACPI_OUTPUT in + *" Unknown"*) + echo $ACPI_OUTPUT | head -c 22 | tail -c 2 + ;; + *" Discharging"*) + echo $ACPI_OUTPUT | head -c 26 | tail -c 2 + ;; + *" Charging"*) + echo $ACPI_OUTPUT | head -c 23 | tail -c 2 + ;; + *" Full"*) + echo '99' + ;; + *) + echo '-1' + ;; + esac +} + +battery_charge(){ + # Full char + local F_C='▸' + # Depleted char + local D_C='▹' + local DEPLETED_COLOR='\[${normal}\]' + local FULL_COLOR='\[${green}\]' + local HALF_COLOR='\[${yellow}\]' + local DANGER_COLOR='\[${red}\]' + local BATTERY_OUTPUT='${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${D_C}' + local BATTERY_PERC=$(battery_percentage) + + case $BATTERY_PERC in + 9*) + echo "${FULL_COLOR}${F_C}${F_C}${F_C}${F_C}${F_C}${normal}" + ;; + 8*) + echo "${FULL_COLOR}${F_C}${F_C}${F_C}${F_C}${HALF_COLOR}${F_C}${normal}" + ;; + 7*) + echo "${FULL_COLOR}${F_C}${F_C}${F_C}${F_C}${DEPLETED_COLOR}${D_C}${normal}" + ;; + 6*) + echo "${FULL_COLOR}${F_C}${F_C}${F_C}${HALF_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${normal}" + ;; + 5*) + echo "${FULL_COLOR}${F_C}${F_C}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${normal}" + ;; + 4*) + echo "${FULL_COLOR}${F_C}${F_C}${HALF_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${normal}" + ;; + 3*) + echo "${FULL_COLOR}${F_C}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${normal}" + ;; + 2*) + echo "${FULL_COLOR}${F_C}${HALF_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${normal}" + ;; + 1*) + echo "${FULL_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${normal}" + ;; + 05) + echo "${DANGER_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${normal}" + ;; + 04) + echo "${DANGER_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${normal}" + ;; + 03) + echo "${DANGER_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${normal}" + ;; + 02) + echo "${DANGER_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${normal}" + ;; + 0*) + echo "${HALF_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${normal}" + ;; + *) + echo "${DANGER_COLOR}ERROR\[${normal}\]" + ;; + esac + +# if [ $BATTERY_PERC < 0 ]; + #then + #BATTERY_OUTPUT="ERROR" + #else + #if [ $BATTERY_PERC > 90 ]; + #then + #BATTERY_OUTPUT="${FULL_COLOR}${F_C}${F_C}${F_C}${F_C}${F_C}${normal}" + #else + #if [ $BATTERY_PERC > 80 ]; + #then + #BATTERY_OUTPUT="${FULL_COLOR}${F_C}${F_C}${F_C}${F_C}${HALF_COLOR}${F_C}${normal}" + #else + #if [ $BATTERY_PERC > 70 ]; + #then + #BATTERY_OUTPUT="${FULL_COLOR}${F_C}${F_C}${F_C}${F_C}${DEPLETED_COLOR}${D_C}${normal}" + #else + #if [ $BATTERY_PERC > 60 ]; + #then + #BATTERY_OUTPUT="${FULL_COLOR}${F_C}${F_C}${F_C}${HALF_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${normal}" + #else + #if [ $BATTERY_PERC > 50 ]; + #then + #BATTERY_OUTPUT="${FULL_COLOR}${F_C}${F_C}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${normal}" + #else + #if [ $BATTERY_PERC > 40 ]; + #then + #BATTERY_OUTPUT="${FULL_COLOR}${F_C}${F_C}${HALF_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${normal}" + #else + #if [ $BATTERY_PERC > 30 ]; + #then + #BATTERY_OUTPUT="${FULL_COLOR}${F_C}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${normal}" + #else + #if [ $BATTERY_PERC > 20 ]; + #then + #BATTERY_OUTPUT="${FULL_COLOR}${F_C}${HALF_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${normal}" + #else + #if [ $BATTERY_PERC > 10 ]; + #then + #BATTERY_OUTPUT="${FULL_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${normal}" + #else + #BATTERY_OUTPUT="${DANGER_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${normal}" + #fi + #fi + #fi + #fi + #fi + #fi + #fi + #fi + #fi + #fi + #echo $BATTERY_OUTPUT +} From 9681bae6344788a65deb03738a369455db011164 Mon Sep 17 00:00:00 2001 From: Jesus de Mula Cano Date: Sun, 6 Mar 2011 18:17:17 +0100 Subject: [PATCH 014/151] Update demula theme to use battery plugin --- themes/demula/demula.theme.bash | 111 +++++++++++++++++++++----------- 1 file changed, 72 insertions(+), 39 deletions(-) diff --git a/themes/demula/demula.theme.bash b/themes/demula/demula.theme.bash index 33396d94..a0f35bf6 100644 --- a/themes/demula/demula.theme.bash +++ b/themes/demula/demula.theme.bash @@ -1,60 +1,93 @@ -# ------------------------------------------------------------------ COLOR CONF -D_DEFAULT_COLOR='${gray}' -D_USER_COLOR='${purple}' -D_SUPERUSER_COLOR='${red}' -D_MACHINE_COLOR='${cyan}' -D_DIR_COLOR='${green}' -D_SCM_COLOR='${yellow}' -D_BRANCH_COLOR='${yellow}' -D_CHANGES_COLOR='${white}' -D_CMDFAIL_COLOR='${red}' +#!/bin/bash +# Theme inspired on: +# - Ronacher's dotfiles (mitsuhikos) - http://github.com/mitsuhiko/dotfiles/tree/master/bash/ +# - Glenbot - http://theglenbot.com/custom-bash-shell-for-development/ +# - My extravagant zsh - http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/ +# - Monokai colors - http://monokai.nl/blog/2006/07/15/textmate-color-theme/ +# - Docs of Bash - http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x361.html + +# ----------------------------------------------------------------- COLOR CONF +D_DEFAULT_COLOR='\[${normal}\]' +D_INTERMEDIATE_COLOR='\[${white}\]' +D_USER_COLOR='\[${purple}\]' +D_SUPERUSER_COLOR='\[${red}\]' +D_MACHINE_COLOR='\[${cyan}\]' +D_DIR_COLOR='\[${green}\]' +D_SCM_COLOR='\[${yellow}\]' +D_BRANCH_COLOR='\[${yellow}\]' +D_CHANGES_COLOR='\[${white}\]' +D_CMDFAIL_COLOR='\[${red}\]' +D_VIMSHELL_COLOR='\[${cyan}\]' +# ------------------------------------------------------------------ FUNCTIONS case $TERM in - xterm*) - TITLEBAR="\[\033]0;\w\007\]" - ;; - *) - TITLEBAR="" - ;; + xterm*) + TITLEBAR="\[\033]0;\w\007\]" + ;; + *) + TITLEBAR="" + ;; esac -PS3=">> " - is_vim_shell() { - if [ ! -z "$VIMRUNTIME" ] - then - echo "on ${cyan}vim shell${white} " - fi + if [ ! -z "$VIMRUNTIME" ] + then + echo "${D_INTERMEDIATE_COLOR}on ${D_VIMSHELL_COLOR}\ +vim shell${D_DEFAULT_COLOR} " + fi +} + +demula_battery_charge() { + if [ ! -z "$(battery_charge)" ] + then + battery_charge + fi } mitsuhikos_lastcommandfailed() { code=$? - if [ $code != 0 ]; then - echo -n '\[${white}\]exited \[${red}\]' - echo -n $code - echo -n '\[${white}\] ' + if [ $code != 0 ]; + then + echo "${D_INTERMEDIATE_COLOR}exited ${D_CMDFAIL_COLOR}\ +$code ${D_DEFAULT_COLOR}" fi } -D_VCPROMPT_EXECUTABLE=~/.vcprompt/bin/vcprompt -D_VCPROMPT_FORMAT="on ${D_SCM_COLOR}%s${white}:${D_BRANCH_COLOR}%b %r ${D_CHANGES_COLOR}%m%u ${white}" +# vcprompt for scm instead of bash_it default +# https://github.com/xvzf/vcprompt demula_vcprompt() { - $D_VCPROMPT_EXECUTABLE -f "$D_VCPROMPT_FORMAT" + local D_VCPROMPT_EXECUTABLE=~/.vcprompt/bin/vcprompt + local D_VCPROMPT_FORMAT="on ${D_SCM_COLOR}%s${D_INTERMEDIATE_COLOR}:\ +${D_BRANCH_COLOR}%b %r ${D_CHANGES_COLOR}%m%u ${D_DEFAULT_COLOR}" + local D_VCPROMPT_OUTPUT=$($D_VCPROMPT_EXECUTABLE -f "$D_VCPROMPT_FORMAT") + + echo $D_VCPROMPT_OUTPUT } -prompt() { - # Yes, the indenting on these is weird, but it has to be like - # this otherwise it won't display properly. - PS1="\n${TITLEBAR}\[${D_USER_COLOR}\]\u ${white}\ -at \[${D_MACHINE_COLOR}\]\h ${white}\ -in \[${D_DIR_COLOR}\]\w ${white}\ +# -------------------------------------------------------------- PROMPT OUTPUT +prompt() { + local SAVE_CURSOR='\[\033[s\]' + local RESTORE_CURSOR='\[\033[u\]' + local MOVE_CURSOR_RIGHTMOST='\[\033[500C\]' + local MOVE_CURSOR_LEFTMOST='\[\033[500D\]' + local MOVE_CURSOR_5_LEFT='\[\033[5D\]' + local MOVE_CURSOR_1_DOWN='\[\033[1B\]' + + PS1="${TITLEBAR}\n\ +${SAVE_CURSOR}${MOVE_CURSOR_RIGHTMOST}${MOVE_CURSOR_5_LEFT}\ +$(demula_battery_charge)${RESTORE_CURSOR}\ +${D_USER_COLOR}\u ${D_INTERMEDIATE_COLOR}\ +at ${D_MACHINE_COLOR}\h ${D_INTERMEDIATE_COLOR}\ +in ${D_DIR_COLOR}\w ${D_INTERMEDIATE_COLOR}\ $(mitsuhikos_lastcommandfailed)\ $(demula_vcprompt)\ -$(is_vim_shell) -$ ${normal}" +$(is_vim_shell)\n\ +${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}" + + PS2="${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}" } -PS2="$ " - +# Runs prompt (this bypasses bash_it $PROMPT setting) PROMPT_COMMAND=prompt + From 0127dc2dc7dc8bc27b8d19004bcfcb9ec96fe262 Mon Sep 17 00:00:00 2001 From: Jesus de Mula Cano Date: Sun, 6 Mar 2011 18:49:08 +0100 Subject: [PATCH 015/151] Add safe vcprompt use to demula theme and monokai colors. Update default template to include vcprompt path. --- template/bash_profile.template.bash | 4 +++ themes/demula/demula.theme.bash | 41 ++++++++++++++++++++++------- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/template/bash_profile.template.bash b/template/bash_profile.template.bash index 17853b1a..6f867124 100644 --- a/template/bash_profile.template.bash +++ b/template/bash_profile.template.bash @@ -50,5 +50,9 @@ export TODO="t" # Set store directory for handmade commandline history tool export hchtstoredir="$HOME/.hcht" +# Set vcprompt executable path for scm advance info in prompt (demula theme) +# https://github.com/xvzf/vcprompt +#export VCPROMPT_EXECUTABLE=~/.vcprompt/bin/vcprompt + # Load Bash It source $BASH/bash_it.sh diff --git a/themes/demula/demula.theme.bash b/themes/demula/demula.theme.bash index a0f35bf6..2b39b955 100644 --- a/themes/demula/demula.theme.bash +++ b/themes/demula/demula.theme.bash @@ -5,7 +5,31 @@ # - Glenbot - http://theglenbot.com/custom-bash-shell-for-development/ # - My extravagant zsh - http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/ # - Monokai colors - http://monokai.nl/blog/2006/07/15/textmate-color-theme/ -# - Docs of Bash - http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x361.html +# - Bash_it modern theme +# +# by Jesus de Mula + +# For the real Monokai colors you should add these to your .XDefaults or +# terminal configuration: +#! ----------------------------------------------------------- TERMINAL COLORS +#! monokai - http://www.monokai.nl/blog/2006/07/15/textmate-color-theme/ +#*background: #272822 +#*foreground: #E2DA6E +#*color0: black +#! mild red +#*color1: #CD0000 +#! light green +#*color2: #A5E02D +#! orange (yellow) +#*color3: #FB951F +#! "dark" blue +#*color4: #076BCC +#! hot pink +#*color5: #F6266C +#! cyan +#*color6: #64D9ED +#! gray +#*color7: #E5E5E5 # ----------------------------------------------------------------- COLOR CONF D_DEFAULT_COLOR='\[${normal}\]' @@ -19,6 +43,7 @@ D_BRANCH_COLOR='\[${yellow}\]' D_CHANGES_COLOR='\[${white}\]' D_CMDFAIL_COLOR='\[${red}\]' D_VIMSHELL_COLOR='\[${cyan}\]' + # ------------------------------------------------------------------ FUNCTIONS case $TERM in xterm*) @@ -54,25 +79,21 @@ $code ${D_DEFAULT_COLOR}" } # vcprompt for scm instead of bash_it default -# https://github.com/xvzf/vcprompt demula_vcprompt() { - local D_VCPROMPT_EXECUTABLE=~/.vcprompt/bin/vcprompt - local D_VCPROMPT_FORMAT="on ${D_SCM_COLOR}%s${D_INTERMEDIATE_COLOR}:\ + if [ ! -z "$VCPROMPT_EXECUTABLE" ] + then + local D_VCPROMPT_FORMAT="on ${D_SCM_COLOR}%s${D_INTERMEDIATE_COLOR}:\ ${D_BRANCH_COLOR}%b %r ${D_CHANGES_COLOR}%m%u ${D_DEFAULT_COLOR}" - local D_VCPROMPT_OUTPUT=$($D_VCPROMPT_EXECUTABLE -f "$D_VCPROMPT_FORMAT") - - echo $D_VCPROMPT_OUTPUT + $VCPROMPT_EXECUTABLE -f "$D_VCPROMPT_FORMAT" + fi } - # -------------------------------------------------------------- PROMPT OUTPUT prompt() { local SAVE_CURSOR='\[\033[s\]' local RESTORE_CURSOR='\[\033[u\]' local MOVE_CURSOR_RIGHTMOST='\[\033[500C\]' - local MOVE_CURSOR_LEFTMOST='\[\033[500D\]' local MOVE_CURSOR_5_LEFT='\[\033[5D\]' - local MOVE_CURSOR_1_DOWN='\[\033[1B\]' PS1="${TITLEBAR}\n\ ${SAVE_CURSOR}${MOVE_CURSOR_RIGHTMOST}${MOVE_CURSOR_5_LEFT}\ From 23de53a08411965a310439f9c96db4acc7cd6e6d Mon Sep 17 00:00:00 2001 From: Jesus de Mula Cano Date: Sun, 6 Mar 2011 22:37:47 +0100 Subject: [PATCH 016/151] battery plugin code clean up --- plugins/battery.plugin.bash | 55 +-------------------------------- themes/demula/demula.theme.bash | 1 + 2 files changed, 2 insertions(+), 54 deletions(-) diff --git a/plugins/battery.plugin.bash b/plugins/battery.plugin.bash index c0ec6f4e..945a6a7a 100644 --- a/plugins/battery.plugin.bash +++ b/plugins/battery.plugin.bash @@ -77,60 +77,7 @@ battery_charge(){ echo "${HALF_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${normal}" ;; *) - echo "${DANGER_COLOR}ERROR\[${normal}\]" + echo "${DANGER_COLOR}UNPLG\[${normal}\]" ;; esac - -# if [ $BATTERY_PERC < 0 ]; - #then - #BATTERY_OUTPUT="ERROR" - #else - #if [ $BATTERY_PERC > 90 ]; - #then - #BATTERY_OUTPUT="${FULL_COLOR}${F_C}${F_C}${F_C}${F_C}${F_C}${normal}" - #else - #if [ $BATTERY_PERC > 80 ]; - #then - #BATTERY_OUTPUT="${FULL_COLOR}${F_C}${F_C}${F_C}${F_C}${HALF_COLOR}${F_C}${normal}" - #else - #if [ $BATTERY_PERC > 70 ]; - #then - #BATTERY_OUTPUT="${FULL_COLOR}${F_C}${F_C}${F_C}${F_C}${DEPLETED_COLOR}${D_C}${normal}" - #else - #if [ $BATTERY_PERC > 60 ]; - #then - #BATTERY_OUTPUT="${FULL_COLOR}${F_C}${F_C}${F_C}${HALF_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${normal}" - #else - #if [ $BATTERY_PERC > 50 ]; - #then - #BATTERY_OUTPUT="${FULL_COLOR}${F_C}${F_C}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${normal}" - #else - #if [ $BATTERY_PERC > 40 ]; - #then - #BATTERY_OUTPUT="${FULL_COLOR}${F_C}${F_C}${HALF_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${normal}" - #else - #if [ $BATTERY_PERC > 30 ]; - #then - #BATTERY_OUTPUT="${FULL_COLOR}${F_C}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${normal}" - #else - #if [ $BATTERY_PERC > 20 ]; - #then - #BATTERY_OUTPUT="${FULL_COLOR}${F_C}${HALF_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${normal}" - #else - #if [ $BATTERY_PERC > 10 ]; - #then - #BATTERY_OUTPUT="${FULL_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${normal}" - #else - #BATTERY_OUTPUT="${DANGER_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${normal}" - #fi - #fi - #fi - #fi - #fi - #fi - #fi - #fi - #fi - #fi - #echo $BATTERY_OUTPUT } diff --git a/themes/demula/demula.theme.bash b/themes/demula/demula.theme.bash index 2b39b955..e8b3bc2b 100644 --- a/themes/demula/demula.theme.bash +++ b/themes/demula/demula.theme.bash @@ -7,6 +7,7 @@ # - Monokai colors - http://monokai.nl/blog/2006/07/15/textmate-color-theme/ # - Bash_it modern theme # +# Screenshot: http://goo.gl/VCmX5 # by Jesus de Mula # For the real Monokai colors you should add these to your .XDefaults or From 229aa833a2965581f549fceddc78e28317c53e63 Mon Sep 17 00:00:00 2001 From: Jesus de Mula Cano Date: Mon, 7 Mar 2011 00:02:43 +0100 Subject: [PATCH 017/151] Add command_exists function to base.plugin from http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script: --- plugins/base.plugin.bash | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/plugins/base.plugin.bash b/plugins/base.plugin.bash index 7f4ba2fa..3a73b304 100644 --- a/plugins/base.plugin.bash +++ b/plugins/base.plugin.bash @@ -11,19 +11,11 @@ function myip { echo "Your public IP is: ${bold_green} $res ${normal}" } -# Make a directory and immediately 'cd' into it - function mkcd(){ mkdir -p "$*" cd "$*" } -# Search through directory contents with grep - -function lsgrep(){ - ls | grep "$*" -} - # View man documentation in Preview pman () { man -t "${1}" | open -f -a $PREVIEW @@ -77,6 +69,11 @@ function t() { fi } +# Checks for existence of a command +command_exists () { + type "$1" &> /dev/null ; +} + # List all plugins and functions defined by bash-it function plugins-help() { From 1080af358dce939b147e20193f7da2116eebb6dd Mon Sep 17 00:00:00 2001 From: Jesus de Mula Cano Date: Mon, 7 Mar 2011 00:05:54 +0100 Subject: [PATCH 018/151] Update battery.plugin to check for acpi existence --- plugins/battery.plugin.bash | 46 ++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/plugins/battery.plugin.bash b/plugins/battery.plugin.bash index 945a6a7a..7e77aeee 100644 --- a/plugins/battery.plugin.bash +++ b/plugins/battery.plugin.bash @@ -1,24 +1,29 @@ #!/bin/bash - +# pmset -g batt battery_percentage(){ - local ACPI_OUTPUT=$(acpi -b) - case $ACPI_OUTPUT in - *" Unknown"*) - echo $ACPI_OUTPUT | head -c 22 | tail -c 2 - ;; - *" Discharging"*) - echo $ACPI_OUTPUT | head -c 26 | tail -c 2 - ;; - *" Charging"*) - echo $ACPI_OUTPUT | head -c 23 | tail -c 2 - ;; - *" Full"*) - echo '99' - ;; - *) - echo '-1' - ;; - esac + if command_exists acpi; + then + local ACPI_OUTPUT=$(acpi -b) + case $ACPI_OUTPUT in + *" Unknown"*) + echo $ACPI_OUTPUT | head -c 22 | tail -c 2 + ;; + *" Discharging"*) + echo $ACPI_OUTPUT | head -c 26 | tail -c 2 + ;; + *" Charging"*) + echo $ACPI_OUTPUT | head -c 23 | tail -c 2 + ;; + *" Full"*) + echo '99' + ;; + *) + echo '-1' + ;; + esac + else + echo "no" + fi } battery_charge(){ @@ -34,6 +39,9 @@ battery_charge(){ local BATTERY_PERC=$(battery_percentage) case $BATTERY_PERC in + no) + echo "" + ;; 9*) echo "${FULL_COLOR}${F_C}${F_C}${F_C}${F_C}${F_C}${normal}" ;; From fe9116c8e66eae4bc42e9a07621ade0ece8aa6ce Mon Sep 17 00:00:00 2001 From: Jesus de Mula Cano Date: Mon, 7 Mar 2011 00:06:52 +0100 Subject: [PATCH 019/151] change back http alias and check for Linux to use python2 --- plugins/python.plugin.bash | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/python.plugin.bash b/plugins/python.plugin.bash index 280beb1a..3a0bf7fd 100644 --- a/plugins/python.plugin.bash +++ b/plugins/python.plugin.bash @@ -1,4 +1,9 @@ #!/bin/bash -alias http='python2 -m SimpleHTTPServer' +if [ $(uname) = "Linux" ] +then + alias http='python2 -m SimpleHTTPServer' +else + alias http='python -m SimpleHTTPServer' +fi From 8cc74becc08c9e4f2734de6f26ff67398c2ee9f2 Mon Sep 17 00:00:00 2001 From: Jesus de Mula Cano Date: Mon, 7 Mar 2011 00:08:56 +0100 Subject: [PATCH 020/151] Fix demula theme output --- themes/demula/demula.theme.bash | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/themes/demula/demula.theme.bash b/themes/demula/demula.theme.bash index e8b3bc2b..55be8246 100644 --- a/themes/demula/demula.theme.bash +++ b/themes/demula/demula.theme.bash @@ -56,20 +56,13 @@ case $TERM in esac is_vim_shell() { - if [ ! -z "$VIMRUNTIME" ] + if [ ! -z "$VIMRUNTIME" ]; then echo "${D_INTERMEDIATE_COLOR}on ${D_VIMSHELL_COLOR}\ vim shell${D_DEFAULT_COLOR} " fi } -demula_battery_charge() { - if [ ! -z "$(battery_charge)" ] - then - battery_charge - fi -} - mitsuhikos_lastcommandfailed() { code=$? if [ $code != 0 ]; @@ -81,7 +74,7 @@ $code ${D_DEFAULT_COLOR}" # vcprompt for scm instead of bash_it default demula_vcprompt() { - if [ ! -z "$VCPROMPT_EXECUTABLE" ] + if [ ! -z "$VCPROMPT_EXECUTABLE" ]; then local D_VCPROMPT_FORMAT="on ${D_SCM_COLOR}%s${D_INTERMEDIATE_COLOR}:\ ${D_BRANCH_COLOR}%b %r ${D_CHANGES_COLOR}%m%u ${D_DEFAULT_COLOR}" @@ -96,15 +89,15 @@ prompt() { local MOVE_CURSOR_RIGHTMOST='\[\033[500C\]' local MOVE_CURSOR_5_LEFT='\[\033[5D\]' - PS1="${TITLEBAR}\n\ + PS1="${TITLEBAR} ${SAVE_CURSOR}${MOVE_CURSOR_RIGHTMOST}${MOVE_CURSOR_5_LEFT}\ -$(demula_battery_charge)${RESTORE_CURSOR}\ +$(battery_charge)${RESTORE_CURSOR}\ ${D_USER_COLOR}\u ${D_INTERMEDIATE_COLOR}\ at ${D_MACHINE_COLOR}\h ${D_INTERMEDIATE_COLOR}\ in ${D_DIR_COLOR}\w ${D_INTERMEDIATE_COLOR}\ $(mitsuhikos_lastcommandfailed)\ $(demula_vcprompt)\ -$(is_vim_shell)\n\ +$(is_vim_shell) ${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}" PS2="${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}" From cced72742f7f8473fcb558f0d4fd663a8e434e1b Mon Sep 17 00:00:00 2001 From: Jesus de Mula Cano Date: Mon, 7 Mar 2011 00:18:05 +0100 Subject: [PATCH 021/151] fix deleting screw up --- plugins/base.plugin.bash | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/base.plugin.bash b/plugins/base.plugin.bash index 3a73b304..444c0f03 100644 --- a/plugins/base.plugin.bash +++ b/plugins/base.plugin.bash @@ -11,11 +11,19 @@ function myip { echo "Your public IP is: ${bold_green} $res ${normal}" } +# Make a directory and immediately 'cd' into it + function mkcd(){ mkdir -p "$*" cd "$*" } +# Search through directory contents with grep + +function lsgrep(){ + ls | grep "$*" +} + # View man documentation in Preview pman () { man -t "${1}" | open -f -a $PREVIEW From f98a728866e13520996f236b0abb4729c83a4576 Mon Sep 17 00:00:00 2001 From: Jesus de Mula Cano Date: Mon, 7 Mar 2011 01:11:20 +0100 Subject: [PATCH 022/151] Check for OS type in demula theme prompt string --- plugins/battery.plugin.bash | 7 ++++++- themes/demula/demula.theme.bash | 17 +++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/plugins/battery.plugin.bash b/plugins/battery.plugin.bash index 7e77aeee..db1d6f97 100644 --- a/plugins/battery.plugin.bash +++ b/plugins/battery.plugin.bash @@ -1,5 +1,5 @@ #!/bin/bash -# pmset -g batt + battery_percentage(){ if command_exists acpi; then @@ -21,6 +21,11 @@ battery_percentage(){ echo '-1' ;; esac + elif command_exists ioreg; + then + # http://hints.macworld.com/article.php?story=20100130123935998 + local IOREG_OUTPUT_10_6=$(ioreg -l | grep -i capacity | tr '\n' ' | ' | awk '{printf("%.2f%%", $10/$5 * 100)}') + local IOREG_OUTPUT_10_5=$(ioreg -l | grep -i capacity | grep -v Legacy| tr '\n' ' | ' | awk '{printf("%.2f%%", $14/$7 * 100)}') else echo "no" fi diff --git a/themes/demula/demula.theme.bash b/themes/demula/demula.theme.bash index 55be8246..0e6744a4 100644 --- a/themes/demula/demula.theme.bash +++ b/themes/demula/demula.theme.bash @@ -89,7 +89,9 @@ prompt() { local MOVE_CURSOR_RIGHTMOST='\[\033[500C\]' local MOVE_CURSOR_5_LEFT='\[\033[5D\]' - PS1="${TITLEBAR} + if [ $(uname) = "Linux" ]; + then + PS1="${TITLEBAR} ${SAVE_CURSOR}${MOVE_CURSOR_RIGHTMOST}${MOVE_CURSOR_5_LEFT}\ $(battery_charge)${RESTORE_CURSOR}\ ${D_USER_COLOR}\u ${D_INTERMEDIATE_COLOR}\ @@ -99,7 +101,18 @@ $(mitsuhikos_lastcommandfailed)\ $(demula_vcprompt)\ $(is_vim_shell) ${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}" - + else + PS1="${TITLEBAR} +${D_USER_COLOR}\u ${D_INTERMEDIATE_COLOR}\ +at ${D_MACHINE_COLOR}\h ${D_INTERMEDIATE_COLOR}\ +in ${D_DIR_COLOR}\w ${D_INTERMEDIATE_COLOR}\ +$(mitsuhikos_lastcommandfailed)\ +$(demula_vcprompt)\ +$(is_vim_shell)\ +$(battery_charge) +${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}" + fi + PS2="${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}" } From b79fc5d03e7aa571ba57cb228983be08bdf944b2 Mon Sep 17 00:00:00 2001 From: Jesus de Mula Cano Date: Mon, 7 Mar 2011 01:26:24 +0100 Subject: [PATCH 023/151] Add beginings of mac os support for the battery plugin --- plugins/battery.plugin.bash | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/battery.plugin.bash b/plugins/battery.plugin.bash index db1d6f97..00f283c6 100644 --- a/plugins/battery.plugin.bash +++ b/plugins/battery.plugin.bash @@ -24,8 +24,17 @@ battery_percentage(){ elif command_exists ioreg; then # http://hints.macworld.com/article.php?story=20100130123935998 - local IOREG_OUTPUT_10_6=$(ioreg -l | grep -i capacity | tr '\n' ' | ' | awk '{printf("%.2f%%", $10/$5 * 100)}') - local IOREG_OUTPUT_10_5=$(ioreg -l | grep -i capacity | grep -v Legacy| tr '\n' ' | ' | awk '{printf("%.2f%%", $14/$7 * 100)}') + #local IOREG_OUTPUT_10_6=$(ioreg -l | grep -i capacity | tr '\n' ' | ' | awk '{printf("%.2f%%", $10/$5 * 100)}') + #local IOREG_OUTPUT_10_5=$(ioreg -l | grep -i capacity | grep -v Legacy| tr '\n' ' | ' | awk '{printf("%.2f%%", $14/$7 * 100)}') + local IOREG_OUTPUT=$(ioreg -n AppleSmartBattery -r | awk '$1~/Capacity/{c[$1]=$3} END{OFMT="%.2f%%"; max=c["\"MaxCapacity\""]; print (max>0? 100*c["\"CurrentCapacity\""]/max: "?")}') + case $IOREG_OUTPUT in + 100*) + echo '99' + ;; + *) + echo $IOREG_OUTPUT | head -c 2 + ;; + esac else echo "no" fi From 8dded4fdc54b373e1908f6ecb7c174cb5ed8ad8a Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Sun, 6 Mar 2011 18:40:16 -0600 Subject: [PATCH 024/151] Added battery info for modern theme --- themes/modern/modern.theme.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/modern/modern.theme.bash b/themes/modern/modern.theme.bash index 9f5d47a0..3efe9ffe 100644 --- a/themes/modern/modern.theme.bash +++ b/themes/modern/modern.theme.bash @@ -41,10 +41,10 @@ prompt() { # Yes, the indenting on these is weird, but it has to be like # this otherwise it won't display properly. - PS1="${TITLEBAR}${bold_red}┌─${reset_color}$(modern_scm_prompt)[${cyan}\W${normal}]$(is_vim_shell) + PS1="${TITLEBAR}${bold_red}┌─${reset_color}$(modern_scm_prompt)[${cyan}\W${normal}][$(battery_charge)]$(is_vim_shell) ${bold_red}└─▪${normal} " else - PS1="${TITLEBAR}┌─$(modern_scm_prompt)[${cyan}\W${normal}]$(is_vim_shell) + PS1="${TITLEBAR}┌─$(modern_scm_prompt)[${cyan}\W${normal}][$(battery_charge)]$(is_vim_shell) └─▪ " fi } From 7ae2952b2873ab0a8de811dd4539bcff658debbe Mon Sep 17 00:00:00 2001 From: Jesus de Mula Cano Date: Mon, 7 Mar 2011 17:06:31 +0100 Subject: [PATCH 026/151] Fix bug of battery plugin not displaying right low percentages (Linux) --- plugins/battery.plugin.bash | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/plugins/battery.plugin.bash b/plugins/battery.plugin.bash index 00f283c6..4946c2c9 100644 --- a/plugins/battery.plugin.bash +++ b/plugins/battery.plugin.bash @@ -6,13 +6,37 @@ battery_percentage(){ local ACPI_OUTPUT=$(acpi -b) case $ACPI_OUTPUT in *" Unknown"*) - echo $ACPI_OUTPUT | head -c 22 | tail -c 2 + local PERC_OUTPUT=$(echo $ACPI_OUTPUT | head -c 22 | tail -c 2) + case $PERC_OUTPUT in + *%) + echo "0${PERC_OUTPUT}" | head -c 2 + ;; + *) + echo ${PERC_OUTPUT} + ;; + esac ;; *" Discharging"*) - echo $ACPI_OUTPUT | head -c 26 | tail -c 2 + local PERC_OUTPUT=$(echo $ACPI_OUTPUT | head -c 26 | tail -c 2) + case $PERC_OUTPUT in + *%) + echo "0${PERC_OUTPUT}" | head -c 2 + ;; + *) + echo ${PERC_OUTPUT} + ;; + esac ;; *" Charging"*) - echo $ACPI_OUTPUT | head -c 23 | tail -c 2 + local PERC_OUTPUT=$(echo $ACPI_OUTPUT | head -c 23 | tail -c 2) + case $PERC_OUTPUT in + *%) + echo "0${PERC_OUTPUT}" | head -c 2 + ;; + *) + echo ${PERC_OUTPUT} + ;; + esac ;; *" Full"*) echo '99' From 63a00c757d1202c71b44709eebe48560bf686b2c Mon Sep 17 00:00:00 2001 From: Robert Lowe Date: Mon, 7 Mar 2011 23:16:18 -0500 Subject: [PATCH 027/151] * 2 new functions, wmate & raw * wmate will pipe wget into textmate and tidy for you (command + z to undo tidy) * raw will pipe wget into your browser --- plugins/browser.plugin.bash | 68 +++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/plugins/browser.plugin.bash b/plugins/browser.plugin.bash index 6de184c3..fdfba4f6 100644 --- a/plugins/browser.plugin.bash +++ b/plugins/browser.plugin.bash @@ -27,3 +27,71 @@ usage open $f fi } + + +# pipe hot spicy interwebs into textmate and cleanup! +# +# Usage: wmate +# wget into a pipe into TextMate and force Tidy (you can undo in textmate) +# e.g. +# $ wmate google.com + +function wmate() { + if [ -t 0 ]; then + if [ -n "$1" ]; then + wget -qO- $1 | /usr/bin/mate + +TIDY=`/usr/bin/osascript << EOT +tell application "TextMate" + activate +end tell + +tell application "System Events" + tell process "TextMate" + tell menu bar 1 + tell menu bar item "Bundles" + tell menu "Bundles" + tell menu item "HTML" + tell menu "HTML" + click menu item "Tidy" + end tell + end tell + end tell + end tell + end tell + end tell +end tell +EOT` + + else + cat < Date: Fri, 11 Mar 2011 20:32:46 -0600 Subject: [PATCH 028/151] Added "down4me" plugin --- plugins/base.plugin.bash | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/base.plugin.bash b/plugins/base.plugin.bash index 444c0f03..94b5e572 100644 --- a/plugins/base.plugin.bash +++ b/plugins/base.plugin.bash @@ -6,6 +6,10 @@ function ips { ifconfig | grep "inet " | awk '{ print $2 }' } +function down4me() { + curl -s "http://www.downforeveryoneorjustme.com/$1" | sed '/just you/!d;s/<[^>]*>//g' +} + function myip { res=$(curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+') echo "Your public IP is: ${bold_green} $res ${normal}" @@ -13,9 +17,9 @@ function myip { # Make a directory and immediately 'cd' into it -function mkcd(){ - mkdir -p "$*" - cd "$*" +function mkcd() { + mkdir -p "$*" + cd "$*" } # Search through directory contents with grep From e56c71a00218b5b7b7b0da7a68f6abf1a4149c85 Mon Sep 17 00:00:00 2001 From: Daniel Engel Date: Mon, 14 Mar 2011 20:36:25 -0400 Subject: [PATCH 029/151] Added 'tonka' prompt, and personal color scheme. Added 'dirs' plugin, dor directory stack navigation. --- aliases/general.aliases.bash | 2 -- plugins/dirs.plugins.bash | 52 +++++++++++++++++++++++++++++++++++ themes/tonka/tonka.theme.bash | 39 ++++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 plugins/dirs.plugins.bash create mode 100644 themes/tonka/tonka.theme.bash diff --git a/aliases/general.aliases.bash b/aliases/general.aliases.bash index 9d71a339..d91fbbb6 100644 --- a/aliases/general.aliases.bash +++ b/aliases/general.aliases.bash @@ -44,7 +44,6 @@ alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'" # Directory alias md='mkdir -p' alias rd=rmdir -alias d='dirs -v' function aliases-help() { echo "Generic Alias Usage" @@ -61,7 +60,6 @@ function aliases-help() { echo " h = history" echo " md = mkdir -p" echo " rd = rmdir" - echo " d = dirs -v" echo " editor = $EDITOR" echo " pager = $PAGER" echo " piano = pianobar" diff --git a/plugins/dirs.plugins.bash b/plugins/dirs.plugins.bash new file mode 100644 index 00000000..dfa9a323 --- /dev/null +++ b/plugins/dirs.plugins.bash @@ -0,0 +1,52 @@ +#!/bin/bash + +# Directory stack navigation: +# +# Add to stack with: pu /path/to/directory +# Delete current dir from stack with: po +# Show stack with: d +# Jump to location by number. + +# Show directory stack +alias d="dirs -v -l" + +# Change to location in stack bu number +alias 1="pushd" +alias 2="pushd +2" +alias 3="pushd +3" +alias 4="pushd +4" +alias 5="pushd +5" +alias 6="pushd +6" +alias 7="pushd +7" +alias 8="pushd +8" +alias 9="pushd +9" + +# Clone this location +alias pc="pushd \`pwd\`" + +# Push new location +alias pu="pushd" + +# Pop current location +alias po="popd" + +function dirs-help() { + echo "Directory Navigation Alias Usage" + echo + echo "Use the power of directory stacking to move" + echo "between several locations with ease." + echo + echo "d : Show directory stack." + echo "po : Remove current location from stack." + echo "pc : Adds current location to stack." + echo "pu : Adds given location to stack." + echo "1 : Chance to stack location 1." + echo "2 : Chance to stack location 2." + echo "3 : Chance to stack location 3." + echo "4 : Chance to stack location 4." + echo "5 : Chance to stack location 5." + echo "6 : Chance to stack location 6." + echo "7 : Chance to stack location 7." + echo "8 : Chance to stack location 8." + echo "9 : Chance to stack location 9." +} diff --git a/themes/tonka/tonka.theme.bash b/themes/tonka/tonka.theme.bash new file mode 100644 index 00000000..2b28c968 --- /dev/null +++ b/themes/tonka/tonka.theme.bash @@ -0,0 +1,39 @@ +prompt_setter() { + +# Named "Tonka" because of the colour scheme +local WHITE="\[\033[1;37m\]" +local LIGHT_BLUE="\[\033[1;34m\]" +local YELLOW="\[\033[1;33m\]" +local NO_COLOUR="\[\033[0m\]" + +case $TERM in + xterm*|rxvt*) + TITLEBAR='\[\033]0;\u@\h:\w\007\]' + ;; + *) + TITLEBAR="" + ;; +esac + +PS1="$TITLEBAR\ +$YELLOW-$LIGHT_BLUE-(\ +$YELLOW\u$LIGHT_BLUE@$YELLOW\h\ +$LIGHT_BLUE)-(\ +$YELLOW\$PWD\ +$LIGHT_BLUE)-$YELLOW-\ +\n\ +$YELLOW-$LIGHT_BLUE-(\ +$YELLOW\$(date +%H%M)$LIGHT_BLUE:$YELLOW\$(date \"+%a,%d %b %y\")\ +$LIGHT_BLUE:$WHITE\\$ $LIGHT_BLUE)-$YELLOW-$NO_COLOUR " + +PS2="$LIGHT_BLUE-$YELLOW-$YELLOW-$NO_COLOUR " + +} + +PROMPT_COMMAND=prompt_setter + +export PS3=">> " + +LS_COLORS='no=00:fi=00:di=00;33:ln=01;36:pi=40;34:so=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.deb=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.mpg=01;37:*.avi=01;37:*.gl=01;37:*.dl=01;37:'; + +export LS_COLORS From 0798a8034a58f13e04a1b9b784a6af679019c5bc Mon Sep 17 00:00:00 2001 From: Florian Baumann Date: Sun, 27 Mar 2011 20:28:47 +0200 Subject: [PATCH 030/151] removed hcht plugin. there are several bugs which couldn't be fixed so far without rewriting the whole module --- plugins/hcht.plugin.bash | 116 ---------------------------- template/bash_profile.template.bash | 3 - 2 files changed, 119 deletions(-) delete mode 100644 plugins/hcht.plugin.bash diff --git a/plugins/hcht.plugin.bash b/plugins/hcht.plugin.bash deleted file mode 100644 index cdab44fb..00000000 --- a/plugins/hcht.plugin.bash +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/bash -# hcht.plugin.bash: the handmade commandline history tool -# Copyright: (C) 2010 Florian Baumann -# License: GPL-3 -# Date: Dienstag 2010-11-30 - -### readme -# basiclly the handmade commandline history tool was made for storing -# informations. yeah, you're right. sounds a bit boring. many other -# applications can do this much better. but storing things from commandline? -# -# hcht was fitted to work at your terminal. -# your daily stuff like notices, todos, commands or output from a command. -# all these things will be stored without complex syntax. -# -# once you defined your storing-directory you will be able to easily -# save all the stuff listed above. -# - -### create a file -# the basic feature. open a file, do stuff and save. -# -# $ hcht evilcommand.hch -# -# this will create a new file or edit a existing one. -# paste your command or notice in your favorite editor - -### show all stored informations -# to get an overview of your storedir: -# -# $ hcht - -### todo with a whole sentence -# you can give hcht a bunch of parameters -# -# $ hcht this is a long reminder about a anything - -### save last executed command -# lets say you did a great hack at your system and you -# want to save it without complicated use of coping: -# -# $ hcht !! -# -# the "!!" will repeat the _last_ command you executed at -# your terminal. after asking you about a name the hch file -# will be saved. - -### read from stdin -# hcht is also able to read anything from stdin. -# -# $ cat any_important_logfile | hcht anylog -# -# "anylog" will be the name of the saved file. - -hcht() { - # configured? - if [ -z $hchtstoredir ]; then - echo "ERROR: handmade commandline history tool isn't configured." - return 1 - else - hchtstoredir=$(echo $hchtstoredir | sed -e 's/\/$//') - fi - - # dir available? - if [ ! -d $hchtstoredir ]; then - echo "ERROR: No such directory: $hchtstoredir" - return 1 - fi - - # get favorite editor - if [ -z $EDITOR ]; then - EDITOR=$(which vim || which nano) - fi - - # check if stdin-data is present and save content - if [ "$(tty)" = "not a tty" ]; then - hchname=$(echo $1 | sed -e 's/\ //g') - if [ -z $hchname ]; then - cat < /dev/stdin >> $hchtstoredir/$(date +%Y%m%d%H%M%S).hch - else - cat < /dev/stdin >> $hchtstoredir/$hchname.hch - fi - return 0 - fi - - # list all hch files if no parameter is given - if [ $# -eq 0 ]; then - for file in $(ls $hchtstoredir); do - echo $file - done - return 0 - fi - - # if a *.hch file is given start editing or creating it - if [ "$#" -eq "1" ]; then - if echo "$1" | grep -q -e ".*.hch$" ; then - $EDITOR ${hchtstoredir}/${1} - return 0 - else - $EDITOR ${hchtstoredir}/${1}.hch - return 0 - fi - fi - - # autocreate a new hch - if [ "$#" -gt "1" ]; then - echo -n "define a name: " ; read hchname - hchname=$(echo $hchname | sed -e 's/\ /_/g') - if [ -z "$hchname" ]; then - echo "$*" > $hchtstoredir/${1}-$(date +%Y%m%d%H%M%S).hch - else - echo "$*" > ${hchtstoredir}/${hchname}.hch - fi - return 0 - fi -} diff --git a/template/bash_profile.template.bash b/template/bash_profile.template.bash index 6f867124..30ab0fc1 100644 --- a/template/bash_profile.template.bash +++ b/template/bash_profile.template.bash @@ -47,9 +47,6 @@ export IRC_CLIENT='irssi' export TODO="t" -# Set store directory for handmade commandline history tool -export hchtstoredir="$HOME/.hcht" - # Set vcprompt executable path for scm advance info in prompt (demula theme) # https://github.com/xvzf/vcprompt #export VCPROMPT_EXECUTABLE=~/.vcprompt/bin/vcprompt From b2857a37747c3da40537e3b7fca7aac7fa15f2f7 Mon Sep 17 00:00:00 2001 From: Florian Baumann Date: Sun, 27 Mar 2011 20:44:17 +0200 Subject: [PATCH 031/151] added git_stats function to git plugin collection --- plugins/git.plugins.bash | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/plugins/git.plugins.bash b/plugins/git.plugins.bash index 5f4cc51e..b0b9ce8c 100644 --- a/plugins/git.plugins.bash +++ b/plugins/git.plugins.bash @@ -54,3 +54,42 @@ function git_info() { fi } +function git_stats { +# awesome work from https://github.com/esc/git-stats +# including some modifications + +if [ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]; then + echo "Number of commits per author:" + git --no-pager shortlog -sn --all + AUTHORS=$( git shortlog -sn --all | cut -f2 | cut -f1 -d' ') + LOGOPTS="" + if [ "$1" == '-w' ]; then + LOGOPTS="$LOGOPTS -w" + shift + fi + if [ "$1" == '-M' ]; then + LOGOPTS="$LOGOPTS -M" + shift + fi + if [ "$1" == '-C' ]; then + LOGOPTS="$LOGOPTS -C --find-copies-harder" + shift + fi + for a in $AUTHORS + do + echo '-------------------' + echo "Statistics for: $a" + echo -n "Number of files changed: " + git log $LOGOPTS --all --numstat --format="%n" --author=$a | cut -f3 | sort -iu | wc -l + echo -n "Number of lines added: " + git log $LOGOPTS --all --numstat --format="%n" --author=$a | cut -f1 | awk '{s+=$1} END {print s}' + echo -n "Number of lines deleted: " + git log $LOGOPTS --all --numstat --format="%n" --author=$a | cut -f2 | awk '{s+=$1} END {print s}' + echo -n "Number of merges: " + git log $LOGOPTS --all --merges --author=$a | grep -c '^commit' + done +else + echo "you're currently not in a git repository" +fi +} + From 97e73f44dc345555008fba8c400dd860ee2cf084 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Thu, 31 Mar 2011 17:01:33 -0500 Subject: [PATCH 032/151] add support for mactex if its present --- plugins/latex.plugin.bash | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 plugins/latex.plugin.bash diff --git a/plugins/latex.plugin.bash b/plugins/latex.plugin.bash new file mode 100644 index 00000000..b8a4baa0 --- /dev/null +++ b/plugins/latex.plugin.bash @@ -0,0 +1,7 @@ +#!/bin/bash + +# add mactex to the path if its present +MACTEX_PATH=/usr/local/texlive/2009/bin/universal-darwin +if [[ -d $MACTEX_PATH ]]; then + export PATH=$PATH:$MACTEX_PATH +fi From ad502d9483565e5ca973cf512bce43e7fe101b4e Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Thu, 31 Mar 2011 17:01:52 -0500 Subject: [PATCH 033/151] make sure tmux is launched in 256 color mode --- plugins/tmux.plugin.bash | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 plugins/tmux.plugin.bash diff --git a/plugins/tmux.plugin.bash b/plugins/tmux.plugin.bash new file mode 100644 index 00000000..ff353364 --- /dev/null +++ b/plugins/tmux.plugin.bash @@ -0,0 +1,2 @@ +# make sure that tmux is launched in 256 color mode +alias tmux="TERM=xterm-256color tmux" From 8392f29250b03abdf1864d6642136a502dabaa83 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Fri, 1 Apr 2011 08:07:14 -0500 Subject: [PATCH 034/151] Unset the MACTEXT_PATH var so it doesn't leak through to env Thought this variable wasn't making it to the session, but it does even without the `export`. This corrects that by explicitly unsetting it before we continue. --- plugins/latex.plugin.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/latex.plugin.bash b/plugins/latex.plugin.bash index b8a4baa0..95592556 100644 --- a/plugins/latex.plugin.bash +++ b/plugins/latex.plugin.bash @@ -5,3 +5,4 @@ MACTEX_PATH=/usr/local/texlive/2009/bin/universal-darwin if [[ -d $MACTEX_PATH ]]; then export PATH=$PATH:$MACTEX_PATH fi +unset MACTEX_PATH From c517a74a394478d404194f8a04a006a2b734da4b Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Fri, 29 Apr 2011 17:56:04 -0500 Subject: [PATCH 035/151] Added dos theme --- themes/dos/dos.theme.bash | 1 + 1 file changed, 1 insertion(+) create mode 100644 themes/dos/dos.theme.bash diff --git a/themes/dos/dos.theme.bash b/themes/dos/dos.theme.bash new file mode 100644 index 00000000..17f0cff6 --- /dev/null +++ b/themes/dos/dos.theme.bash @@ -0,0 +1 @@ +PROMPT="\w>>" From 1aedbd6350df7d53e19ef6b31ac4f113362e4e0d Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Mon, 2 May 2011 23:00:08 -0500 Subject: [PATCH 036/151] remove symbolic link to self --- .bash_it | 1 - 1 file changed, 1 deletion(-) delete mode 120000 .bash_it diff --git a/.bash_it b/.bash_it deleted file mode 120000 index dee1f0d3..00000000 --- a/.bash_it +++ /dev/null @@ -1 +0,0 @@ -.bash_it \ No newline at end of file From ffa45b03914c261d8b95f29d581c9fcfa6e5282e Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Mon, 2 May 2011 23:05:59 -0500 Subject: [PATCH 037/151] Create the concept of enabled plugins This allows users to disable a plugin without completely removing it. Instead, they simply remove the `plugins/enabled/*.bash` file for the plugin they want to disable. This continues the concept of "everything on" while providing greater flexibility to future users. It might be a good idea to allow turning these off by default in the future and allowing not only the `plugins/enabled/*.bash` files but also an array of `` values that would search for `plugins/available/.plugin.bash` to enable them. That method would make it easier for people custom tune their plugins from within their `.bash_profile` script. --- bash_it.sh | 2 +- plugins/{ => available}/base.plugin.bash | 0 plugins/{ => available}/battery.plugin.bash | 0 plugins/{ => available}/browser.plugin.bash | 0 plugins/{ => available}/dirs.plugins.bash | 0 plugins/{ => available}/git.plugins.bash | 0 plugins/{ => available}/hg.plugins.bash | 0 plugins/{ => available}/javascript.plugins.bash | 0 plugins/{ => available}/jekyll.plugins.bash | 0 plugins/{ => available}/latex.plugin.bash | 0 plugins/{ => available}/nginx.plugins.bash | 0 plugins/{ => available}/osx.plugin.bash | 0 plugins/{ => available}/python.plugin.bash | 0 plugins/{ => available}/ruby.plugin.bash | 0 plugins/{ => available}/rvm.plugin.bash | 0 plugins/{ => available}/ssh.plugins.bash | 0 plugins/{ => available}/subversion.plugin.bash | 0 plugins/{ => available}/tmux.plugin.bash | 0 plugins/{ => available}/vagrant.plugins.bash | 0 plugins/{ => available}/virtualenv.plugin.bash | 0 plugins/{ => available}/z.bash | 0 plugins/enabled/base.plugin.bash | 1 + plugins/enabled/battery.plugin.bash | 1 + plugins/enabled/browser.plugin.bash | 1 + plugins/enabled/dirs.plugins.bash | 1 + plugins/enabled/git.plugins.bash | 1 + plugins/enabled/hg.plugins.bash | 1 + plugins/enabled/javascript.plugins.bash | 1 + plugins/enabled/jekyll.plugins.bash | 1 + plugins/enabled/latex.plugin.bash | 1 + plugins/enabled/nginx.plugins.bash | 1 + plugins/enabled/osx.plugin.bash | 1 + plugins/enabled/python.plugin.bash | 1 + plugins/enabled/ruby.plugin.bash | 1 + plugins/enabled/rvm.plugin.bash | 1 + plugins/enabled/ssh.plugins.bash | 1 + plugins/enabled/subversion.plugin.bash | 1 + plugins/enabled/tmux.plugin.bash | 1 + plugins/enabled/vagrant.plugins.bash | 1 + plugins/enabled/virtualenv.plugin.bash | 1 + plugins/enabled/z.bash | 1 + 41 files changed, 21 insertions(+), 1 deletion(-) rename plugins/{ => available}/base.plugin.bash (100%) rename plugins/{ => available}/battery.plugin.bash (100%) rename plugins/{ => available}/browser.plugin.bash (100%) rename plugins/{ => available}/dirs.plugins.bash (100%) rename plugins/{ => available}/git.plugins.bash (100%) rename plugins/{ => available}/hg.plugins.bash (100%) rename plugins/{ => available}/javascript.plugins.bash (100%) rename plugins/{ => available}/jekyll.plugins.bash (100%) rename plugins/{ => available}/latex.plugin.bash (100%) rename plugins/{ => available}/nginx.plugins.bash (100%) rename plugins/{ => available}/osx.plugin.bash (100%) rename plugins/{ => available}/python.plugin.bash (100%) rename plugins/{ => available}/ruby.plugin.bash (100%) rename plugins/{ => available}/rvm.plugin.bash (100%) rename plugins/{ => available}/ssh.plugins.bash (100%) rename plugins/{ => available}/subversion.plugin.bash (100%) rename plugins/{ => available}/tmux.plugin.bash (100%) rename plugins/{ => available}/vagrant.plugins.bash (100%) rename plugins/{ => available}/virtualenv.plugin.bash (100%) rename plugins/{ => available}/z.bash (100%) create mode 120000 plugins/enabled/base.plugin.bash create mode 120000 plugins/enabled/battery.plugin.bash create mode 120000 plugins/enabled/browser.plugin.bash create mode 120000 plugins/enabled/dirs.plugins.bash create mode 120000 plugins/enabled/git.plugins.bash create mode 120000 plugins/enabled/hg.plugins.bash create mode 120000 plugins/enabled/javascript.plugins.bash create mode 120000 plugins/enabled/jekyll.plugins.bash create mode 120000 plugins/enabled/latex.plugin.bash create mode 120000 plugins/enabled/nginx.plugins.bash create mode 120000 plugins/enabled/osx.plugin.bash create mode 120000 plugins/enabled/python.plugin.bash create mode 120000 plugins/enabled/ruby.plugin.bash create mode 120000 plugins/enabled/rvm.plugin.bash create mode 120000 plugins/enabled/ssh.plugins.bash create mode 120000 plugins/enabled/subversion.plugin.bash create mode 120000 plugins/enabled/tmux.plugin.bash create mode 120000 plugins/enabled/vagrant.plugins.bash create mode 120000 plugins/enabled/virtualenv.plugin.bash create mode 120000 plugins/enabled/z.bash diff --git a/bash_it.sh b/bash_it.sh index 60bef802..e0cc579c 100644 --- a/bash_it.sh +++ b/bash_it.sh @@ -25,7 +25,7 @@ do done # Plugins -PLUGINS="${BASH}/plugins/*.bash" +PLUGINS="${BASH}/plugins/enabled/*.bash" for config_file in $PLUGINS do source $config_file diff --git a/plugins/base.plugin.bash b/plugins/available/base.plugin.bash similarity index 100% rename from plugins/base.plugin.bash rename to plugins/available/base.plugin.bash diff --git a/plugins/battery.plugin.bash b/plugins/available/battery.plugin.bash similarity index 100% rename from plugins/battery.plugin.bash rename to plugins/available/battery.plugin.bash diff --git a/plugins/browser.plugin.bash b/plugins/available/browser.plugin.bash similarity index 100% rename from plugins/browser.plugin.bash rename to plugins/available/browser.plugin.bash diff --git a/plugins/dirs.plugins.bash b/plugins/available/dirs.plugins.bash similarity index 100% rename from plugins/dirs.plugins.bash rename to plugins/available/dirs.plugins.bash diff --git a/plugins/git.plugins.bash b/plugins/available/git.plugins.bash similarity index 100% rename from plugins/git.plugins.bash rename to plugins/available/git.plugins.bash diff --git a/plugins/hg.plugins.bash b/plugins/available/hg.plugins.bash similarity index 100% rename from plugins/hg.plugins.bash rename to plugins/available/hg.plugins.bash diff --git a/plugins/javascript.plugins.bash b/plugins/available/javascript.plugins.bash similarity index 100% rename from plugins/javascript.plugins.bash rename to plugins/available/javascript.plugins.bash diff --git a/plugins/jekyll.plugins.bash b/plugins/available/jekyll.plugins.bash similarity index 100% rename from plugins/jekyll.plugins.bash rename to plugins/available/jekyll.plugins.bash diff --git a/plugins/latex.plugin.bash b/plugins/available/latex.plugin.bash similarity index 100% rename from plugins/latex.plugin.bash rename to plugins/available/latex.plugin.bash diff --git a/plugins/nginx.plugins.bash b/plugins/available/nginx.plugins.bash similarity index 100% rename from plugins/nginx.plugins.bash rename to plugins/available/nginx.plugins.bash diff --git a/plugins/osx.plugin.bash b/plugins/available/osx.plugin.bash similarity index 100% rename from plugins/osx.plugin.bash rename to plugins/available/osx.plugin.bash diff --git a/plugins/python.plugin.bash b/plugins/available/python.plugin.bash similarity index 100% rename from plugins/python.plugin.bash rename to plugins/available/python.plugin.bash diff --git a/plugins/ruby.plugin.bash b/plugins/available/ruby.plugin.bash similarity index 100% rename from plugins/ruby.plugin.bash rename to plugins/available/ruby.plugin.bash diff --git a/plugins/rvm.plugin.bash b/plugins/available/rvm.plugin.bash similarity index 100% rename from plugins/rvm.plugin.bash rename to plugins/available/rvm.plugin.bash diff --git a/plugins/ssh.plugins.bash b/plugins/available/ssh.plugins.bash similarity index 100% rename from plugins/ssh.plugins.bash rename to plugins/available/ssh.plugins.bash diff --git a/plugins/subversion.plugin.bash b/plugins/available/subversion.plugin.bash similarity index 100% rename from plugins/subversion.plugin.bash rename to plugins/available/subversion.plugin.bash diff --git a/plugins/tmux.plugin.bash b/plugins/available/tmux.plugin.bash similarity index 100% rename from plugins/tmux.plugin.bash rename to plugins/available/tmux.plugin.bash diff --git a/plugins/vagrant.plugins.bash b/plugins/available/vagrant.plugins.bash similarity index 100% rename from plugins/vagrant.plugins.bash rename to plugins/available/vagrant.plugins.bash diff --git a/plugins/virtualenv.plugin.bash b/plugins/available/virtualenv.plugin.bash similarity index 100% rename from plugins/virtualenv.plugin.bash rename to plugins/available/virtualenv.plugin.bash diff --git a/plugins/z.bash b/plugins/available/z.bash similarity index 100% rename from plugins/z.bash rename to plugins/available/z.bash diff --git a/plugins/enabled/base.plugin.bash b/plugins/enabled/base.plugin.bash new file mode 120000 index 00000000..4911573b --- /dev/null +++ b/plugins/enabled/base.plugin.bash @@ -0,0 +1 @@ +../available/base.plugin.bash \ No newline at end of file diff --git a/plugins/enabled/battery.plugin.bash b/plugins/enabled/battery.plugin.bash new file mode 120000 index 00000000..2479ed98 --- /dev/null +++ b/plugins/enabled/battery.plugin.bash @@ -0,0 +1 @@ +../available/battery.plugin.bash \ No newline at end of file diff --git a/plugins/enabled/browser.plugin.bash b/plugins/enabled/browser.plugin.bash new file mode 120000 index 00000000..956f432d --- /dev/null +++ b/plugins/enabled/browser.plugin.bash @@ -0,0 +1 @@ +../available/browser.plugin.bash \ No newline at end of file diff --git a/plugins/enabled/dirs.plugins.bash b/plugins/enabled/dirs.plugins.bash new file mode 120000 index 00000000..9b352d5f --- /dev/null +++ b/plugins/enabled/dirs.plugins.bash @@ -0,0 +1 @@ +../available/dirs.plugins.bash \ No newline at end of file diff --git a/plugins/enabled/git.plugins.bash b/plugins/enabled/git.plugins.bash new file mode 120000 index 00000000..369848b3 --- /dev/null +++ b/plugins/enabled/git.plugins.bash @@ -0,0 +1 @@ +../available/git.plugins.bash \ No newline at end of file diff --git a/plugins/enabled/hg.plugins.bash b/plugins/enabled/hg.plugins.bash new file mode 120000 index 00000000..496dac32 --- /dev/null +++ b/plugins/enabled/hg.plugins.bash @@ -0,0 +1 @@ +../available/hg.plugins.bash \ No newline at end of file diff --git a/plugins/enabled/javascript.plugins.bash b/plugins/enabled/javascript.plugins.bash new file mode 120000 index 00000000..3fe79b65 --- /dev/null +++ b/plugins/enabled/javascript.plugins.bash @@ -0,0 +1 @@ +../available/javascript.plugins.bash \ No newline at end of file diff --git a/plugins/enabled/jekyll.plugins.bash b/plugins/enabled/jekyll.plugins.bash new file mode 120000 index 00000000..95aa2718 --- /dev/null +++ b/plugins/enabled/jekyll.plugins.bash @@ -0,0 +1 @@ +../available/jekyll.plugins.bash \ No newline at end of file diff --git a/plugins/enabled/latex.plugin.bash b/plugins/enabled/latex.plugin.bash new file mode 120000 index 00000000..f42846d1 --- /dev/null +++ b/plugins/enabled/latex.plugin.bash @@ -0,0 +1 @@ +../available/latex.plugin.bash \ No newline at end of file diff --git a/plugins/enabled/nginx.plugins.bash b/plugins/enabled/nginx.plugins.bash new file mode 120000 index 00000000..00e14643 --- /dev/null +++ b/plugins/enabled/nginx.plugins.bash @@ -0,0 +1 @@ +../available/nginx.plugins.bash \ No newline at end of file diff --git a/plugins/enabled/osx.plugin.bash b/plugins/enabled/osx.plugin.bash new file mode 120000 index 00000000..74ecbe31 --- /dev/null +++ b/plugins/enabled/osx.plugin.bash @@ -0,0 +1 @@ +../available/osx.plugin.bash \ No newline at end of file diff --git a/plugins/enabled/python.plugin.bash b/plugins/enabled/python.plugin.bash new file mode 120000 index 00000000..00b46444 --- /dev/null +++ b/plugins/enabled/python.plugin.bash @@ -0,0 +1 @@ +../available/python.plugin.bash \ No newline at end of file diff --git a/plugins/enabled/ruby.plugin.bash b/plugins/enabled/ruby.plugin.bash new file mode 120000 index 00000000..5c1b3640 --- /dev/null +++ b/plugins/enabled/ruby.plugin.bash @@ -0,0 +1 @@ +../available/ruby.plugin.bash \ No newline at end of file diff --git a/plugins/enabled/rvm.plugin.bash b/plugins/enabled/rvm.plugin.bash new file mode 120000 index 00000000..3909f281 --- /dev/null +++ b/plugins/enabled/rvm.plugin.bash @@ -0,0 +1 @@ +../available/rvm.plugin.bash \ No newline at end of file diff --git a/plugins/enabled/ssh.plugins.bash b/plugins/enabled/ssh.plugins.bash new file mode 120000 index 00000000..9b57b125 --- /dev/null +++ b/plugins/enabled/ssh.plugins.bash @@ -0,0 +1 @@ +../available/ssh.plugins.bash \ No newline at end of file diff --git a/plugins/enabled/subversion.plugin.bash b/plugins/enabled/subversion.plugin.bash new file mode 120000 index 00000000..d2a8de2a --- /dev/null +++ b/plugins/enabled/subversion.plugin.bash @@ -0,0 +1 @@ +../available/subversion.plugin.bash \ No newline at end of file diff --git a/plugins/enabled/tmux.plugin.bash b/plugins/enabled/tmux.plugin.bash new file mode 120000 index 00000000..bd310446 --- /dev/null +++ b/plugins/enabled/tmux.plugin.bash @@ -0,0 +1 @@ +../available/tmux.plugin.bash \ No newline at end of file diff --git a/plugins/enabled/vagrant.plugins.bash b/plugins/enabled/vagrant.plugins.bash new file mode 120000 index 00000000..4a93ac1c --- /dev/null +++ b/plugins/enabled/vagrant.plugins.bash @@ -0,0 +1 @@ +../available/vagrant.plugins.bash \ No newline at end of file diff --git a/plugins/enabled/virtualenv.plugin.bash b/plugins/enabled/virtualenv.plugin.bash new file mode 120000 index 00000000..94a6cf4f --- /dev/null +++ b/plugins/enabled/virtualenv.plugin.bash @@ -0,0 +1 @@ +../available/virtualenv.plugin.bash \ No newline at end of file diff --git a/plugins/enabled/z.bash b/plugins/enabled/z.bash new file mode 120000 index 00000000..e7f25a58 --- /dev/null +++ b/plugins/enabled/z.bash @@ -0,0 +1 @@ +../available/z.bash \ No newline at end of file From b1e19cfe3e0d975d4d9079d8513b801158ce929e Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Mon, 16 May 2011 22:03:57 -0500 Subject: [PATCH 038/151] Changed up minimal theme Removed Vim prompt stuff and made the prompt cyan --- themes/minimal/minimal.theme.bash | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/themes/minimal/minimal.theme.bash b/themes/minimal/minimal.theme.bash index a94c4536..8de4a6c7 100644 --- a/themes/minimal/minimal.theme.bash +++ b/themes/minimal/minimal.theme.bash @@ -1,19 +1,5 @@ prompt_setter() { - if [[ $? -eq 0 ]]; then - if [ ! $VIMRUNTIME = "" ] - then - PS1="{vim} \W " - else - PS1="\W " - fi - else - if [ ! $VIMRUNTIME = "" ] - then - PS1="{vim} ${bold_red}\W ${normal}" - else - PS1="${bold_red}\W ${normal}" - fi - fi + PS1="${cyan}\W${normal} " } PROMPT_COMMAND=prompt_setter From 8f0b38ad0e1e56ddf7e8ab5fe910cad1de4a528b Mon Sep 17 00:00:00 2001 From: Anton Shemerey Date: Thu, 26 May 2011 23:12:30 +0300 Subject: [PATCH 039/151] add zork theme --- themes/zork/zork.theme.bash | 77 +++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 themes/zork/zork.theme.bash diff --git a/themes/zork/zork.theme.bash b/themes/zork/zork.theme.bash new file mode 100644 index 00000000..54615d78 --- /dev/null +++ b/themes/zork/zork.theme.bash @@ -0,0 +1,77 @@ +SCM_THEME_PROMPT_PREFIX="" +SCM_THEME_PROMPT_SUFFIX="" + +SCM_THEME_PROMPT_DIRTY=' ${bold_red}✗${normal}' +SCM_THEME_PROMPT_CLEAN=' ${bold_green}✓${normal}' +SCM_GIT_CHAR='${bold_green}±${normal}' +SCM_SVN_CHAR='${bold_cyan}⑆${normal}' +SCM_HG_CHAR='${bold_red}☿${normal}' + +#Mysql Prompt +export MYSQL_PS1="(\u@\h) [\d]> " + +case $TERM in + xterm*) + TITLEBAR="\[\033]0;\w\007\]" + ;; + *) + TITLEBAR="" + ;; +esac + +PS3=">> " + +__my_rvm_ruby_version() { + local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}') + [ "$gemset" != "" ] && gemset="@$gemset" + local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}') + local full="$version$gemset" + [ "$full" != "" ] && echo "[$full]" +} + +is_vim_shell() { + if [ ! -z "$VIMRUNTIME" ] + then + echo "[${cyan}vim shell${normal}]" + fi +} + +modern_scm_prompt() { + CHAR=$(scm_char) + if [ $CHAR = $SCM_NONE_CHAR ] + then + return + else + echo "[$(scm_char)][$(scm_prompt_info)]" + fi +} + +prompt() { + + case $HOSTNAME in + "zork"* ) my_ps_host="${green}\h${normal}"; + ;; + "pandora") my_ps_host="${red}\h${normal}"; + ;; + esac + + my_ps_user="\[\033[01;32m\]\u\[\033[00m\]"; + my_ps_root="\[\033[01;31m\]\u\[\033[00m\]"; + my_ps_path="\[\033[01;36m\]\w\[\033[00m\]"; + + # nice prompt + case "`id -u`" in + 0) PS1="${TITLEBAR}┌─[$my_ps_root][$my_ps_host]$(modern_scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell) +└─▪ " + ;; + *) PS1="${TITLEBAR}┌─[$my_ps_user][$my_ps_host]$(modern_scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell) +└─▪ " + ;; + esac +} + +PS2="└─▪ " + + + +PROMPT_COMMAND=prompt From b64d4bc0de02c7b88d19e9a0b9d5c5940510e90b Mon Sep 17 00:00:00 2001 From: Anton Shemerey Date: Thu, 26 May 2011 23:21:34 +0300 Subject: [PATCH 040/151] add path for bash completion --- completion/brew.completion.bash | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/completion/brew.completion.bash b/completion/brew.completion.bash index 371fe77f..50f6c08d 100644 --- a/completion/brew.completion.bash +++ b/completion/brew.completion.bash @@ -1,5 +1,9 @@ if which brew >/dev/null 2>&1; then + if [ -f `brew --prefix`/etc/bash_completion ]; then + . `brew --prefix`/etc/bash_completion + fi + if [ -f `brew --prefix`/Library/Contributions/brew_bash_completion.sh ]; then . `brew --prefix`/Library/Contributions/brew_bash_completion.sh fi -fi \ No newline at end of file +fi From 0d19f1e3f51bc5ee8d75fa57c8994dd556d786c8 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Fri, 27 May 2011 11:36:07 -0500 Subject: [PATCH 041/151] Ignore the plugins/enabled directory --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fec6fae1..7aed9b0c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ custom/*.bash aliases/custom.aliases.bash lib/custom.bash plugins/custom.plugins.bash +plugins/enabled *.swp From 516ce40c4ee5e062ee600cde2350a8043dfa42c2 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Fri, 27 May 2011 11:40:39 -0500 Subject: [PATCH 042/151] Git ignore works now --- .gitignore | 2 +- plugins/enabled/base.plugin.bash | 1 - plugins/enabled/battery.plugin.bash | 1 - plugins/enabled/browser.plugin.bash | 1 - plugins/enabled/dirs.plugins.bash | 1 - plugins/enabled/git.plugins.bash | 1 - plugins/enabled/hg.plugins.bash | 1 - plugins/enabled/javascript.plugins.bash | 1 - plugins/enabled/jekyll.plugins.bash | 1 - plugins/enabled/latex.plugin.bash | 1 - plugins/enabled/nginx.plugins.bash | 1 - plugins/enabled/osx.plugin.bash | 1 - plugins/enabled/python.plugin.bash | 1 - plugins/enabled/ruby.plugin.bash | 1 - plugins/enabled/rvm.plugin.bash | 1 - plugins/enabled/ssh.plugins.bash | 1 - plugins/enabled/subversion.plugin.bash | 1 - plugins/enabled/tmux.plugin.bash | 1 - plugins/enabled/vagrant.plugins.bash | 1 - plugins/enabled/virtualenv.plugin.bash | 1 - plugins/enabled/z.bash | 1 - 21 files changed, 1 insertion(+), 21 deletions(-) delete mode 120000 plugins/enabled/base.plugin.bash delete mode 120000 plugins/enabled/battery.plugin.bash delete mode 120000 plugins/enabled/browser.plugin.bash delete mode 120000 plugins/enabled/dirs.plugins.bash delete mode 120000 plugins/enabled/git.plugins.bash delete mode 120000 plugins/enabled/hg.plugins.bash delete mode 120000 plugins/enabled/javascript.plugins.bash delete mode 120000 plugins/enabled/jekyll.plugins.bash delete mode 120000 plugins/enabled/latex.plugin.bash delete mode 120000 plugins/enabled/nginx.plugins.bash delete mode 120000 plugins/enabled/osx.plugin.bash delete mode 120000 plugins/enabled/python.plugin.bash delete mode 120000 plugins/enabled/ruby.plugin.bash delete mode 120000 plugins/enabled/rvm.plugin.bash delete mode 120000 plugins/enabled/ssh.plugins.bash delete mode 120000 plugins/enabled/subversion.plugin.bash delete mode 120000 plugins/enabled/tmux.plugin.bash delete mode 120000 plugins/enabled/vagrant.plugins.bash delete mode 120000 plugins/enabled/virtualenv.plugin.bash delete mode 120000 plugins/enabled/z.bash diff --git a/.gitignore b/.gitignore index 7aed9b0c..6be7eefe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +plugins/enabled .DS_Store custom/*.bash !custom/example.bash @@ -5,5 +6,4 @@ custom/*.bash aliases/custom.aliases.bash lib/custom.bash plugins/custom.plugins.bash -plugins/enabled *.swp diff --git a/plugins/enabled/base.plugin.bash b/plugins/enabled/base.plugin.bash deleted file mode 120000 index 4911573b..00000000 --- a/plugins/enabled/base.plugin.bash +++ /dev/null @@ -1 +0,0 @@ -../available/base.plugin.bash \ No newline at end of file diff --git a/plugins/enabled/battery.plugin.bash b/plugins/enabled/battery.plugin.bash deleted file mode 120000 index 2479ed98..00000000 --- a/plugins/enabled/battery.plugin.bash +++ /dev/null @@ -1 +0,0 @@ -../available/battery.plugin.bash \ No newline at end of file diff --git a/plugins/enabled/browser.plugin.bash b/plugins/enabled/browser.plugin.bash deleted file mode 120000 index 956f432d..00000000 --- a/plugins/enabled/browser.plugin.bash +++ /dev/null @@ -1 +0,0 @@ -../available/browser.plugin.bash \ No newline at end of file diff --git a/plugins/enabled/dirs.plugins.bash b/plugins/enabled/dirs.plugins.bash deleted file mode 120000 index 9b352d5f..00000000 --- a/plugins/enabled/dirs.plugins.bash +++ /dev/null @@ -1 +0,0 @@ -../available/dirs.plugins.bash \ No newline at end of file diff --git a/plugins/enabled/git.plugins.bash b/plugins/enabled/git.plugins.bash deleted file mode 120000 index 369848b3..00000000 --- a/plugins/enabled/git.plugins.bash +++ /dev/null @@ -1 +0,0 @@ -../available/git.plugins.bash \ No newline at end of file diff --git a/plugins/enabled/hg.plugins.bash b/plugins/enabled/hg.plugins.bash deleted file mode 120000 index 496dac32..00000000 --- a/plugins/enabled/hg.plugins.bash +++ /dev/null @@ -1 +0,0 @@ -../available/hg.plugins.bash \ No newline at end of file diff --git a/plugins/enabled/javascript.plugins.bash b/plugins/enabled/javascript.plugins.bash deleted file mode 120000 index 3fe79b65..00000000 --- a/plugins/enabled/javascript.plugins.bash +++ /dev/null @@ -1 +0,0 @@ -../available/javascript.plugins.bash \ No newline at end of file diff --git a/plugins/enabled/jekyll.plugins.bash b/plugins/enabled/jekyll.plugins.bash deleted file mode 120000 index 95aa2718..00000000 --- a/plugins/enabled/jekyll.plugins.bash +++ /dev/null @@ -1 +0,0 @@ -../available/jekyll.plugins.bash \ No newline at end of file diff --git a/plugins/enabled/latex.plugin.bash b/plugins/enabled/latex.plugin.bash deleted file mode 120000 index f42846d1..00000000 --- a/plugins/enabled/latex.plugin.bash +++ /dev/null @@ -1 +0,0 @@ -../available/latex.plugin.bash \ No newline at end of file diff --git a/plugins/enabled/nginx.plugins.bash b/plugins/enabled/nginx.plugins.bash deleted file mode 120000 index 00e14643..00000000 --- a/plugins/enabled/nginx.plugins.bash +++ /dev/null @@ -1 +0,0 @@ -../available/nginx.plugins.bash \ No newline at end of file diff --git a/plugins/enabled/osx.plugin.bash b/plugins/enabled/osx.plugin.bash deleted file mode 120000 index 74ecbe31..00000000 --- a/plugins/enabled/osx.plugin.bash +++ /dev/null @@ -1 +0,0 @@ -../available/osx.plugin.bash \ No newline at end of file diff --git a/plugins/enabled/python.plugin.bash b/plugins/enabled/python.plugin.bash deleted file mode 120000 index 00b46444..00000000 --- a/plugins/enabled/python.plugin.bash +++ /dev/null @@ -1 +0,0 @@ -../available/python.plugin.bash \ No newline at end of file diff --git a/plugins/enabled/ruby.plugin.bash b/plugins/enabled/ruby.plugin.bash deleted file mode 120000 index 5c1b3640..00000000 --- a/plugins/enabled/ruby.plugin.bash +++ /dev/null @@ -1 +0,0 @@ -../available/ruby.plugin.bash \ No newline at end of file diff --git a/plugins/enabled/rvm.plugin.bash b/plugins/enabled/rvm.plugin.bash deleted file mode 120000 index 3909f281..00000000 --- a/plugins/enabled/rvm.plugin.bash +++ /dev/null @@ -1 +0,0 @@ -../available/rvm.plugin.bash \ No newline at end of file diff --git a/plugins/enabled/ssh.plugins.bash b/plugins/enabled/ssh.plugins.bash deleted file mode 120000 index 9b57b125..00000000 --- a/plugins/enabled/ssh.plugins.bash +++ /dev/null @@ -1 +0,0 @@ -../available/ssh.plugins.bash \ No newline at end of file diff --git a/plugins/enabled/subversion.plugin.bash b/plugins/enabled/subversion.plugin.bash deleted file mode 120000 index d2a8de2a..00000000 --- a/plugins/enabled/subversion.plugin.bash +++ /dev/null @@ -1 +0,0 @@ -../available/subversion.plugin.bash \ No newline at end of file diff --git a/plugins/enabled/tmux.plugin.bash b/plugins/enabled/tmux.plugin.bash deleted file mode 120000 index bd310446..00000000 --- a/plugins/enabled/tmux.plugin.bash +++ /dev/null @@ -1 +0,0 @@ -../available/tmux.plugin.bash \ No newline at end of file diff --git a/plugins/enabled/vagrant.plugins.bash b/plugins/enabled/vagrant.plugins.bash deleted file mode 120000 index 4a93ac1c..00000000 --- a/plugins/enabled/vagrant.plugins.bash +++ /dev/null @@ -1 +0,0 @@ -../available/vagrant.plugins.bash \ No newline at end of file diff --git a/plugins/enabled/virtualenv.plugin.bash b/plugins/enabled/virtualenv.plugin.bash deleted file mode 120000 index 94a6cf4f..00000000 --- a/plugins/enabled/virtualenv.plugin.bash +++ /dev/null @@ -1 +0,0 @@ -../available/virtualenv.plugin.bash \ No newline at end of file diff --git a/plugins/enabled/z.bash b/plugins/enabled/z.bash deleted file mode 120000 index e7f25a58..00000000 --- a/plugins/enabled/z.bash +++ /dev/null @@ -1 +0,0 @@ -../available/z.bash \ No newline at end of file From 4898fa91198854e6d95b19d4258b39f54b5bc564 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Fri, 27 May 2011 11:47:55 -0500 Subject: [PATCH 043/151] Add pmdown function for previewing markdown files --- plugins/available/base.plugin.bash | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugins/available/base.plugin.bash b/plugins/available/base.plugin.bash index 94b5e572..e361e04a 100644 --- a/plugins/available/base.plugin.bash +++ b/plugins/available/base.plugin.bash @@ -15,6 +15,17 @@ function myip { echo "Your public IP is: ${bold_green} $res ${normal}" } +# Function for previewing markdown files in the browser + +function pmdown() { + if command -v markdown &>/dev/null + then + markdown $1 | browser + else + echo "You don't have a markdown command installed!" + fi +} + # Make a directory and immediately 'cd' into it function mkcd() { From 1b268e7c282e08fa084b0a3e2609c018530d37f7 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Fri, 27 May 2011 11:53:54 -0500 Subject: [PATCH 044/151] Initialize enabled directory if it doesn't exist This is to make bash_it work in a new install after the plugins/enabled directory was ignored --- bash_it.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bash_it.sh b/bash_it.sh index e0cc579c..b3cdb737 100644 --- a/bash_it.sh +++ b/bash_it.sh @@ -25,6 +25,11 @@ do done # Plugins +if [ ! -d "plugins/enabled" ] +then + mkdir "${BASH}/plugins/enabled" + ln -s ${BASH}/plugins/available/* "${BASH}/plugins/enabled" +fi PLUGINS="${BASH}/plugins/enabled/*.bash" for config_file in $PLUGINS do From 481484394886fb622f8fe3edf3774009b8b891ac Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Fri, 27 May 2011 20:57:57 -0500 Subject: [PATCH 045/151] Fix issue with plugin initalization --- bash_it.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash_it.sh b/bash_it.sh index b3cdb737..4a9b30d3 100644 --- a/bash_it.sh +++ b/bash_it.sh @@ -25,7 +25,7 @@ do done # Plugins -if [ ! -d "plugins/enabled" ] +if [ ! -d "${BASH}/plugins/enabled" ] then mkdir "${BASH}/plugins/enabled" ln -s ${BASH}/plugins/available/* "${BASH}/plugins/enabled" From ccf4951d1760a1d95bbba3e8ae84ecf2ad1553d0 Mon Sep 17 00:00:00 2001 From: Joshua Nussbaum Date: Fri, 27 May 2011 23:59:33 -0700 Subject: [PATCH 046/151] Added alias for rake db:migrate --- aliases/rails.aliases.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/aliases/rails.aliases.bash b/aliases/rails.aliases.bash index d4415f6d..6e1ca149 100644 --- a/aliases/rails.aliases.bash +++ b/aliases/rails.aliases.bash @@ -10,6 +10,7 @@ alias rd='rails dbconsole' alias rp='rails plugin' alias ra='rails application' alias rd='rails destroy' +alias dbm='rake db:migrate' alias ss='script/server' alias ts="thin start" # thin server From a694d2de9c6673bdd6791c4132a19ab8989a0f99 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Sun, 29 May 2011 15:25:26 -0500 Subject: [PATCH 047/151] Allow specifying jQuery/jQuery UI version number and update defaults --- plugins/available/javascript.plugins.bash | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/plugins/available/javascript.plugins.bash b/plugins/available/javascript.plugins.bash index 2e0b56cb..a480d9e4 100644 --- a/plugins/available/javascript.plugins.bash +++ b/plugins/available/javascript.plugins.bash @@ -3,15 +3,30 @@ # The install directory is hard-coded. TOOD: allow the directory to be specified on the command line. # +[[ -z "$JQUERY_VERSION_NUMBER" ]] && JQUERY_VERSION_NUMBER="1.6.1" +[[ -z "$JQUERY_UI_VERSION_NUMBER" ]] && JQUERY_UI_VERSION_NUMBER="1.8.13" function rails_jquery { curl -o public/javascripts/rails.js http://github.com/rails/jquery-ujs/raw/master/src/rails.js } function jquery_install { - curl -o public/javascripts/jquery.js http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js + if [ -z "$1" ] + then + version=$JQUERY_VERSION_NUMBER + else + version="$1" + fi + curl -o public/javascripts/jquery.js "http://ajax.googleapis.com/ajax/libs/jquery/$version/jquery.min.js" } -function jquery_ui_install { - curl -o public/javascripts/jquery_ui.js http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js -} \ No newline at end of file +function jquery_ui_install { + if [ -z "$1" ] + then + version=$JQUERY_UI_VERSION_NUMBER + else + version="$1" + fi + + curl -o public/javascripts/jquery_ui.js "http://ajax.googleapis.com/ajax/libs/jqueryui/$version/jquery-ui.min.js" +} From 20d5f97f3e14545a120c1ade2c0404943fec8e41 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Mon, 30 May 2011 09:46:22 -0500 Subject: [PATCH 048/151] Load RVM and auto-completion is available No reason not to turn on RVM if it's present and the autocompletion is a huge benefit. --- plugins/available/rvm.plugin.bash | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/available/rvm.plugin.bash b/plugins/available/rvm.plugin.bash index d3c81ed4..97f02146 100644 --- a/plugins/available/rvm.plugin.bash +++ b/plugins/available/rvm.plugin.bash @@ -1,4 +1,14 @@ #!/bin/bash + +# Load RVM, if you are using it +[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm + +# Load the auto-completion script if RVM was loaded. +if [ "$rvm_path" ] +then + [[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion +fi + switch () { rvm $1 local v=$(rvm_version) From b740d7f0f731e9029720d012c289dd00056120f1 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Mon, 30 May 2011 09:52:30 -0500 Subject: [PATCH 049/151] Make sure that RVM is loaded before defining extras --- plugins/available/rvm.plugin.bash | 37 +++++++++++++++++-------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/plugins/available/rvm.plugin.bash b/plugins/available/rvm.plugin.bash index 97f02146..e158a800 100644 --- a/plugins/available/rvm.plugin.bash +++ b/plugins/available/rvm.plugin.bash @@ -3,24 +3,27 @@ # Load RVM, if you are using it [[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm -# Load the auto-completion script if RVM was loaded. +# 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 RVM was loaded. [[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion + + switch () { + rvm $1 + local v=$(rvm_version) + rvm wrapper $1 textmate + echo "Switch to Ruby version: "$v + } + + rvm_default () { + rvm --default $1 + rvm wrapper $1 textmate + } + + function rvm_version () { + ruby --version + } + fi - -switch () { - rvm $1 - local v=$(rvm_version) - rvm wrapper $1 textmate - echo "Switch to Ruby version: "$v -} - -rvm_default () { - rvm --default $1 - rvm wrapper $1 textmate -} - -function rvm_version () { - ruby --version -} \ No newline at end of file From 9623fd442fabd8f6e9df569900b91abaed63403e Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Mon, 30 May 2011 10:12:51 -0500 Subject: [PATCH 050/151] Allow clock to be formatted --- themes/doubletime/doubletime.theme.bash | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/themes/doubletime/doubletime.theme.bash b/themes/doubletime/doubletime.theme.bash index c5a8a420..91844f0e 100644 --- a/themes/doubletime/doubletime.theme.bash +++ b/themes/doubletime/doubletime.theme.bash @@ -37,8 +37,14 @@ prompt_setter() { history -a history -c history -r + if [[ -z "$THEME_PROMPT_CLOCK_FORMAT" ]] + then + clock="\t" + else + clock=$THEME_PROMPT_CLOCK_FORMAT + fi PS1=" -\t $(scm_char) [\[$THEME_PROMPT_HOST_COLOR\]\u@${THEME_PROMPT_HOST}\[$reset_color\]] $(virtualenv_prompt)\w +$clock $(scm_char) [\[$THEME_PROMPT_HOST_COLOR\]\u@${THEME_PROMPT_HOST}\[$reset_color\]] $(virtualenv_prompt)\w $(doubletime_scm_prompt)\[$reset_color\] $ " PS2='> ' PS4='+ ' From 1a83a4d1939a6e182664bd78dac6f6296103f5d4 Mon Sep 17 00:00:00 2001 From: Ryan Date: Tue, 31 May 2011 13:19:20 -1000 Subject: [PATCH 051/151] Added hawaii50 theme --- themes/hawaii50/hawaii50.theme.bash | 118 ++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 themes/hawaii50/hawaii50.theme.bash diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash new file mode 100644 index 00000000..a81cc0b9 --- /dev/null +++ b/themes/hawaii50/hawaii50.theme.bash @@ -0,0 +1,118 @@ +#!/bin/basORANGEh + +# Colors +ORANGE='\e[0;33m' +GREY='\e[1:37m' + +DEFAULT_COLOR='\[${white}\]' + +USER_COLOR='\[${purple}\]' +SUPERUSER_COLOR='\[${red}\]' +MACHINE_COLOR=$ORANGE +DIRECTORY_COLOR='\[${bold_green}\]' + +VE_COLOR='\[${red}\]' +RVM_COLOR='\[${purple}\]' + +# SCM prompts +SCM_THEME_PROMPT_DIRTY=' ${bold_red}✗${normal}' +SCM_THEME_PROMPT_CLEAN=' ${bold_green}✓${normal}' + +# Max length of PWD to display +MAX_PWD_LENGTH=20 + +# Max length of Git Hex to display +MAX_GIT_HEX_LENGTH=5 + +# Use http://geoff.greer.fm/lscolors/ + +# Displays the current virtualenv information +function curr_virtualenv_info() { + [ ! -z "$VIRTUAL_ENV" ] && echo "`basename $VIRTUAL_ENV`" +} + +# Displays the current rvm information w/gemset +function curr_rvm_info() { + local ruby_version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}') + local ruby_gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}') + + if [ "$ruby_version" != "" ]; then + [ "$ruby_gemset" != "" ] && ruby_gemset="@$ruby_gemset" + echo "$ruby_version$ruby_gemset" + fi +} + +# Displays using ... +function virtual_info() { + local virtual_env_info=$(curr_virtualenv_info) + local rvm_info=$(curr_rvm_info) + local prompt="using" + + # If no virtual info, just return + [ "$virtual_env_info" == "" -a "$rvm_info" == "" ] && return + + # If virtual_env info present, append to prompt + [ "$virtual_env_info" != "" ] && prompt="$prompt virtualenv: ${VE_COLOR}$virtual_env_info${DEFAULT_COLOR}" + + if [ "$rvm_info" != "" ] + then + [ "$virtual_env_info" != "" ] && prompt="$prompt," + prompt="$prompt rvm: ${RVM_COLOR}$rvm_info${DEFAULT_COLOR}" + fi + echo $prompt +} + + +# SCM information +function scm_info() { + SCM_CHAR=$(scm_char) + [ "$SCM_CHAR" == "$SCM_NONE_CHAR" ] && return + local prompt="on" + [ "$SCM_CHAR" == "$SCM_GIT_CHAR" ] && echo "$prompt$(parse_git_info)" && return +} + +# Parse git info +function parse_git_info() { + if [[ -n $(git status -s 2> /dev/null |grep -v ^# |grep -v "working directory clean") ]]; then + state=${GIT_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} + else + state=${GIT_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} + fi + prefix=${GIT_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} + suffix=${GIT_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} + ref=$(git symbolic-ref HEAD 2> /dev/null) || return + rawhex=$(git rev-parse HEAD 2>/dev/null) || return + + echo -e "$prefix${ref#refs/heads/} (${rawhex:0:$MAX_GIT_HEX_LENGTH})$state$suffix" +} + +# Displays last X characters of pwd +function limited_pwd() { + + # Replace $HOME with ~ if possible + RELATIVE_PWD=${PWD/#$HOME/\~} + + local offset=$((${#RELATIVE_PWD}-$MAX_PWD_LENGTH)) + + if [ $offset -gt "0" ] + then + local truncated_symbol="..." + TRUNCATED_PWD=${RELATIVE_PWD:$offset:$MAX_PWD_LENGTH} + echo "${truncated_symbol}/${TRUNCATED_PWD#*/}" + else + echo "${RELATIVE_PWD}" + fi +} + +# Displays the current prompt +function prompt() { + + local UC=$USER_COLOR + [ $UID -eq "0" ] && UC=$SUPERUSER_COLOR + + PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h${DEFAULT_COLOR} in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR} $(virtual_info) $(scm_info) \$ " + PS2='> ' + PS4='+ ' +} + +PROMPT_COMMAND=prompt From 06d71ab59141b536a9a0bdd22791a002fa98def5 Mon Sep 17 00:00:00 2001 From: Ryan Date: Tue, 31 May 2011 16:10:30 -1000 Subject: [PATCH 052/151] Updated git prompt Started hg prompt --- themes/hawaii50/hawaii50.theme.bash | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index a81cc0b9..987153b3 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -24,6 +24,12 @@ MAX_PWD_LENGTH=20 # Max length of Git Hex to display MAX_GIT_HEX_LENGTH=5 +GIT_THEME_PROMPT_PREFIX=' |git:' +GIT_THEME_PROMPT_SUFFIX='|' + +HG_THEME_PROMPT_PREFIX=' |hg:' +HG_THEME_PROMPT_SUFFIX='|' + # Use http://geoff.greer.fm/lscolors/ # Displays the current virtualenv information @@ -62,13 +68,14 @@ function virtual_info() { echo $prompt } - # SCM information function scm_info() { SCM_CHAR=$(scm_char) [ "$SCM_CHAR" == "$SCM_NONE_CHAR" ] && return local prompt="on" [ "$SCM_CHAR" == "$SCM_GIT_CHAR" ] && echo "$prompt$(parse_git_info)" && return + [ "$SCM_CHAR" == "$SCM_SVN_CHAR" ] && echo "$prompt$(parse_svn_info)" && return + [ "$SCM_CHAR" == "$SCM_HG_CHAR" ] && echo "$prompt$(parse_hg_info)" && return } # Parse git info @@ -83,9 +90,24 @@ function parse_git_info() { ref=$(git symbolic-ref HEAD 2> /dev/null) || return rawhex=$(git rev-parse HEAD 2>/dev/null) || return - echo -e "$prefix${ref#refs/heads/} (${rawhex:0:$MAX_GIT_HEX_LENGTH})$state$suffix" + echo "$prefix${ref#refs/heads/}=#${rawhex:0:$MAX_GIT_HEX_LENGTH}$state$suffix" } +# Parse hg info +function parse_hg_info() { + if [[ -n $(hg status --no-color 2> /dev/null| awk '$1 == "?" { print "?" } $1 = "?" { print "!" }' | sort | uniq | head -c1) ]]; then + state=${HG_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} + else + state=${HG_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} + fi + prefix=${HG_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} + suffix=${HG_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} + branch=$(hg branch 2> /dev/null | awk '{print $1}') + + echo "$prefix$branch$state$suffix" +} + + # Displays last X characters of pwd function limited_pwd() { From aa2f1cbeb7141a24d154de15b35f3f51914f285a Mon Sep 17 00:00:00 2001 From: Ryan Date: Tue, 31 May 2011 18:41:07 -1000 Subject: [PATCH 053/151] Added hg dirty/clean modifier --- themes/hawaii50/hawaii50.theme.bash | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index 987153b3..656649b4 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -32,6 +32,16 @@ HG_THEME_PROMPT_SUFFIX='|' # Use http://geoff.greer.fm/lscolors/ +# Override function scm +function scm { + if [[ -d .git ]]; then SCM=$GIT + elif [[ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]]; then SCM=$GIT + elif [[ -n "$(hg summary 2> /dev/null)" ]]; then SCM=$HG + elif [[ -d .svn ]]; then SCM=$SVN + else SCM='NONE' + fi +} + # Displays the current virtualenv information function curr_virtualenv_info() { [ ! -z "$VIRTUAL_ENV" ] && echo "`basename $VIRTUAL_ENV`" @@ -90,21 +100,22 @@ function parse_git_info() { ref=$(git symbolic-ref HEAD 2> /dev/null) || return rawhex=$(git rev-parse HEAD 2>/dev/null) || return - echo "$prefix${ref#refs/heads/}=#${rawhex:0:$MAX_GIT_HEX_LENGTH}$state$suffix" + echo "$prefix${ref#refs/heads/}:${rawhex:0:$MAX_GIT_HEX_LENGTH}$state$suffix" } # Parse hg info function parse_hg_info() { - if [[ -n $(hg status --no-color 2> /dev/null| awk '$1 == "?" { print "?" } $1 = "?" { print "!" }' | sort | uniq | head -c1) ]]; then + if [[ -n $(hg status 2> /dev/null) ]]; then state=${HG_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} else state=${HG_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} fi prefix=${HG_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} suffix=${HG_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} - branch=$(hg branch 2> /dev/null | awk '{print $1}') + branch=$(hg summary 2> /dev/null | grep branch | awk '{print $2}') + changeset=$(hg summary 2> /dev/null | grep parent | awk '{print $2}') - echo "$prefix$branch$state$suffix" + echo "$prefix${branch}:${changeset#*:}$state$suffix" } From 2a6d1da317e4aafab8cfcd2ca8702379d9a8ac06 Mon Sep 17 00:00:00 2001 From: Ryan Date: Tue, 31 May 2011 19:03:28 -1000 Subject: [PATCH 054/151] Updated parse_svn_info --- themes/hawaii50/hawaii50.theme.bash | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index 656649b4..16ecf07c 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -30,6 +30,9 @@ GIT_THEME_PROMPT_SUFFIX='|' HG_THEME_PROMPT_PREFIX=' |hg:' HG_THEME_PROMPT_SUFFIX='|' +SVN_THEME_PROMPT_PREFIX=' |svn:' +SVN_THEME_PROMPT_SUFFIX='|' + # Use http://geoff.greer.fm/lscolors/ # Override function scm @@ -118,6 +121,20 @@ function parse_hg_info() { echo "$prefix${branch}:${changeset#*:}$state$suffix" } +# Parse svn info +function parse_svn_info() { + if [[ -n $(svn status --ignore-externals -q 2> /dev/null) ]]; then + state=${SVN_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} + else + state=${SVN_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} + fi + prefix=${SVN_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} + suffix=${SVN_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} + ref=$(svn info 2> /dev/null | awk -F/ '/^URL:/ { for (i=0; i<=NF; i++) { if ($i == "branches" || $i == "tags" ) { print $(i+1); break }; if ($i == "trunk") { print $i; break } } }') || return + revision=$(svn info 2> /dev/null | sed -ne 's#^Revision: ##p' ) + [[ -z $ref ]] && return + echo -e "$prefix$ref:$revision$state$suffix" +} # Displays last X characters of pwd function limited_pwd() { From 09dfe7552c4b9538df85fabef855a5c7e941f5f2 Mon Sep 17 00:00:00 2001 From: Ryan Date: Tue, 31 May 2011 19:17:10 -1000 Subject: [PATCH 055/151] Added ip address (only good for a mac) :D ) --- themes/hawaii50/hawaii50.theme.bash | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index 16ecf07c..1a9281df 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -9,6 +9,7 @@ DEFAULT_COLOR='\[${white}\]' USER_COLOR='\[${purple}\]' SUPERUSER_COLOR='\[${red}\]' MACHINE_COLOR=$ORANGE +IP_COLOR=$MACHINE_COLOR DIRECTORY_COLOR='\[${bold_green}\]' VE_COLOR='\[${red}\]' @@ -35,6 +36,10 @@ SVN_THEME_PROMPT_SUFFIX='|' # Use http://geoff.greer.fm/lscolors/ +function ip { + echo $(ifconfig en1 | grep "inet " | awk '{ print $2 }') +} + # Override function scm function scm { if [[ -d .git ]]; then SCM=$GIT @@ -160,7 +165,7 @@ function prompt() { local UC=$USER_COLOR [ $UID -eq "0" ] && UC=$SUPERUSER_COLOR - PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h${DEFAULT_COLOR} in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR} $(virtual_info) $(scm_info) \$ " + PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR})${DEFAULT_COLOR} in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR} $(virtual_info) $(scm_info) \$ " PS2='> ' PS4='+ ' } From 9bd5b5498498f2623ede326fde33afdf87456f86 Mon Sep 17 00:00:00 2001 From: Ryan Kanno Date: Tue, 31 May 2011 21:23:33 -1000 Subject: [PATCH 056/151] Added color to the scm prompt --- themes/hawaii50/hawaii50.theme.bash | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index 1a9281df..bf493efc 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -15,6 +15,9 @@ DIRECTORY_COLOR='\[${bold_green}\]' VE_COLOR='\[${red}\]' RVM_COLOR='\[${purple}\]' +SCM_COLOR=$ORANGE +REF_COLOR='\[${purple}\]' + # SCM prompts SCM_THEME_PROMPT_DIRTY=' ${bold_red}✗${normal}' SCM_THEME_PROMPT_CLEAN=' ${bold_green}✓${normal}' @@ -25,13 +28,13 @@ MAX_PWD_LENGTH=20 # Max length of Git Hex to display MAX_GIT_HEX_LENGTH=5 -GIT_THEME_PROMPT_PREFIX=' |git:' +GIT_THEME_PROMPT_PREFIX=" |${SCM_COLOR}git${DEFAULT_COLOR}:" GIT_THEME_PROMPT_SUFFIX='|' -HG_THEME_PROMPT_PREFIX=' |hg:' +HG_THEME_PROMPT_PREFIX=" |${SCM_COLOR}hg${DEFAULT_COLOR}:" HG_THEME_PROMPT_SUFFIX='|' -SVN_THEME_PROMPT_PREFIX=' |svn:' +SVN_THEME_PROMPT_PREFIX=" |${SCM_COLOR}svn${DEFAULT_COLOR}:" SVN_THEME_PROMPT_SUFFIX='|' # Use http://geoff.greer.fm/lscolors/ @@ -108,7 +111,7 @@ function parse_git_info() { ref=$(git symbolic-ref HEAD 2> /dev/null) || return rawhex=$(git rev-parse HEAD 2>/dev/null) || return - echo "$prefix${ref#refs/heads/}:${rawhex:0:$MAX_GIT_HEX_LENGTH}$state$suffix" + echo "$prefix${REF_COLOR}${ref#refs/heads/}${DEFAULT_COLOR}:${rawhex:0:$MAX_GIT_HEX_LENGTH}$state$suffix" } # Parse hg info @@ -123,7 +126,7 @@ function parse_hg_info() { branch=$(hg summary 2> /dev/null | grep branch | awk '{print $2}') changeset=$(hg summary 2> /dev/null | grep parent | awk '{print $2}') - echo "$prefix${branch}:${changeset#*:}$state$suffix" + echo "$prefix${REF_COLOR}${branch}${DEFAULT_COLOR}:${changeset#*:}$state$suffix" } # Parse svn info @@ -138,7 +141,7 @@ function parse_svn_info() { ref=$(svn info 2> /dev/null | awk -F/ '/^URL:/ { for (i=0; i<=NF; i++) { if ($i == "branches" || $i == "tags" ) { print $(i+1); break }; if ($i == "trunk") { print $i; break } } }') || return revision=$(svn info 2> /dev/null | sed -ne 's#^Revision: ##p' ) [[ -z $ref ]] && return - echo -e "$prefix$ref:$revision$state$suffix" + echo -e "$prefix${REF_COLOR}$ref${DEFAULT_COLOR}:$revision$state$suffix" } # Displays last X characters of pwd From 0611f861bc15752e3d5c407ce6bb1a7cef180355 Mon Sep 17 00:00:00 2001 From: Ryan Kanno Date: Tue, 31 May 2011 21:38:41 -1000 Subject: [PATCH 057/151] Changed color schemes Completely removed prefix/suffix for scm --- themes/hawaii50/hawaii50.theme.bash | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index bf493efc..378512fa 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -10,10 +10,10 @@ USER_COLOR='\[${purple}\]' SUPERUSER_COLOR='\[${red}\]' MACHINE_COLOR=$ORANGE IP_COLOR=$MACHINE_COLOR -DIRECTORY_COLOR='\[${bold_green}\]' +DIRECTORY_COLOR='\[${green}\]' -VE_COLOR='\[${red}\]' -RVM_COLOR='\[${purple}\]' +VE_COLOR='\[${cyan}\]' +RVM_COLOR='\[${cyan}\]' SCM_COLOR=$ORANGE REF_COLOR='\[${purple}\]' @@ -28,16 +28,9 @@ MAX_PWD_LENGTH=20 # Max length of Git Hex to display MAX_GIT_HEX_LENGTH=5 -GIT_THEME_PROMPT_PREFIX=" |${SCM_COLOR}git${DEFAULT_COLOR}:" -GIT_THEME_PROMPT_SUFFIX='|' - -HG_THEME_PROMPT_PREFIX=" |${SCM_COLOR}hg${DEFAULT_COLOR}:" -HG_THEME_PROMPT_SUFFIX='|' - -SVN_THEME_PROMPT_PREFIX=" |${SCM_COLOR}svn${DEFAULT_COLOR}:" -SVN_THEME_PROMPT_SUFFIX='|' - -# Use http://geoff.greer.fm/lscolors/ +# Removed prefix/suffix +SCM_THEME_PROMPT_PREFIX=" " +SCM_THEME_PROMPT_SUFFIX="" function ip { echo $(ifconfig en1 | grep "inet " | awk '{ print $2 }') @@ -73,11 +66,12 @@ function curr_rvm_info() { function virtual_info() { local virtual_env_info=$(curr_virtualenv_info) local rvm_info=$(curr_rvm_info) - local prompt="using" # If no virtual info, just return [ "$virtual_env_info" == "" -a "$rvm_info" == "" ] && return + local prompt=" using" + # If virtual_env info present, append to prompt [ "$virtual_env_info" != "" ] && prompt="$prompt virtualenv: ${VE_COLOR}$virtual_env_info${DEFAULT_COLOR}" @@ -86,14 +80,14 @@ function virtual_info() { [ "$virtual_env_info" != "" ] && prompt="$prompt," prompt="$prompt rvm: ${RVM_COLOR}$rvm_info${DEFAULT_COLOR}" fi - echo $prompt + echo "$prompt" } # SCM information function scm_info() { SCM_CHAR=$(scm_char) [ "$SCM_CHAR" == "$SCM_NONE_CHAR" ] && return - local prompt="on" + local prompt=" on" [ "$SCM_CHAR" == "$SCM_GIT_CHAR" ] && echo "$prompt$(parse_git_info)" && return [ "$SCM_CHAR" == "$SCM_SVN_CHAR" ] && echo "$prompt$(parse_svn_info)" && return [ "$SCM_CHAR" == "$SCM_HG_CHAR" ] && echo "$prompt$(parse_hg_info)" && return @@ -168,7 +162,7 @@ function prompt() { local UC=$USER_COLOR [ $UID -eq "0" ] && UC=$SUPERUSER_COLOR - PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR})${DEFAULT_COLOR} in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR} $(virtual_info) $(scm_info) \$ " + PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR})${DEFAULT_COLOR} in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(virtual_info)$(scm_info) \$ " PS2='> ' PS4='+ ' } From 0df98ca8e915910b3b17fbafdb3726ee8acc0f87 Mon Sep 17 00:00:00 2001 From: Ryan Date: Wed, 1 Jun 2011 11:22:22 -1000 Subject: [PATCH 058/151] Various theme cleanup (removing vars, extras) --- themes/hawaii50/hawaii50.theme.bash | 40 +++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index 378512fa..4933123c 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -1,6 +1,32 @@ -#!/bin/basORANGEh +#!/bin/bash -# Colors +# This theme was obviously inspired a lot by +# - Demula theme +# +# which in itself was inspired by : +# +# - Ronacher's dotfiles (mitsuhikos) - http://github.com/mitsuhiko/dotfiles/tree/master/bash/ +# - Glenbot - http://theglenbot.com/custom-bash-shell-for-development/ +# - My extravagant zsh - http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/ +# - Monokai colors - http://monokai.nl/blog/2006/07/15/textmate-color-theme/ +# - Bash_it modern theme +# +# Things theme supports: +# - shortended directory +# - hg, svn detection +# - virtualenv, rvm +# +# Screenshot: +# +# by Ryan Kanno +# +# And yes, we code out in Hawaii. :D +# +# Note: I also am really new to this bash scripting game, so if you see things +# that are flat out wrong, or if you think of something neat, just send a pull +# request. + +# COLORS ====================================================================== ORANGE='\e[0;33m' GREY='\e[1:37m' @@ -9,18 +35,19 @@ DEFAULT_COLOR='\[${white}\]' USER_COLOR='\[${purple}\]' SUPERUSER_COLOR='\[${red}\]' MACHINE_COLOR=$ORANGE -IP_COLOR=$MACHINE_COLOR +IP_COLOR=$ORANGE DIRECTORY_COLOR='\[${green}\]' VE_COLOR='\[${cyan}\]' RVM_COLOR='\[${cyan}\]' -SCM_COLOR=$ORANGE REF_COLOR='\[${purple}\]' # SCM prompts SCM_THEME_PROMPT_DIRTY=' ${bold_red}✗${normal}' SCM_THEME_PROMPT_CLEAN=' ${bold_green}✓${normal}' +SCM_THEME_PROMPT_PREFIX=" " +SCM_THEME_PROMPT_SUFFIX="" # Max length of PWD to display MAX_PWD_LENGTH=20 @@ -28,10 +55,7 @@ MAX_PWD_LENGTH=20 # Max length of Git Hex to display MAX_GIT_HEX_LENGTH=5 -# Removed prefix/suffix -SCM_THEME_PROMPT_PREFIX=" " -SCM_THEME_PROMPT_SUFFIX="" - +# FUNCS ======================================================================= function ip { echo $(ifconfig en1 | grep "inet " | awk '{ print $2 }') } From f3787fdc2e6faa3aa9b670c77f3ab57154efd931 Mon Sep 17 00:00:00 2001 From: Ryan Date: Wed, 1 Jun 2011 11:33:41 -1000 Subject: [PATCH 059/151] Added comments to theme --- themes/hawaii50/hawaii50.theme.bash | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index 4933123c..a0343a04 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -1,6 +1,7 @@ #!/bin/bash - +# # This theme was obviously inspired a lot by +# # - Demula theme # # which in itself was inspired by : @@ -11,10 +12,11 @@ # - Monokai colors - http://monokai.nl/blog/2006/07/15/textmate-color-theme/ # - Bash_it modern theme # -# Things theme supports: -# - shortended directory -# - hg, svn detection -# - virtualenv, rvm +# Hawaii50 theme supports : +# +# - configurable directory length +# - hg, svn, git detection (I work in all of them) +# - virtualenv, rvm + gemsets # # Screenshot: # @@ -24,7 +26,9 @@ # # Note: I also am really new to this bash scripting game, so if you see things # that are flat out wrong, or if you think of something neat, just send a pull -# request. +# request. This probably only works on a Mac - as some functions are OS +# specific like getting ip, etc. +# # COLORS ====================================================================== ORANGE='\e[0;33m' From 5e95755a19facc2527cf4c008f0a3458493c1a98 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Thu, 2 Jun 2011 20:29:16 -0500 Subject: [PATCH 060/151] Add another alias for clear and add some more aliases to alias-help --- aliases/general.aliases.bash | 64 +++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/aliases/general.aliases.bash b/aliases/general.aliases.bash index d91fbbb6..1e7d4458 100644 --- a/aliases/general.aliases.bash +++ b/aliases/general.aliases.bash @@ -15,31 +15,32 @@ then alias ls="ls --color=always" fi -alias c='clear' -alias k='clear' +alias c = 'clear' +alias k = 'clear' +alias cls = 'clear' -alias edit="$EDITOR" -alias page="$PAGER" +alias edit = "$EDITOR" +alias page = "$PAGER" -alias q="exit" +alias q = "exit" -alias irc="$IRC_CLIENT" +alias irc = "$IRC_CLIENT" -alias rb="ruby" +alias rb = "ruby" # Pianobar can be found here: http://github.com/PromyLOPh/pianobar/ alias piano="pianobar" -alias ..='cd ..' # Go up one directory -alias ...='cd ../..' # Go up two directories -alias -- -="cd -" # Go back +alias .. = 'cd ..' # Go up one directory +alias ... = 'cd ../..' # Go up two directories +alias -- - = "cd -" # Go back # Shell History -alias h='history' +alias h = 'history' # Tree -alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'" +alias tree = "find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'" # Directory alias md='mkdir -p' @@ -48,22 +49,25 @@ alias rd=rmdir function aliases-help() { echo "Generic Alias Usage" echo - echo " sl = ls" - echo " ls = ls -G" - echo " la = ls -AF" - echo " ll = ls -al" - echo " l = ls -a" - echo " c/k = clear" - echo " .. = cd .." - echo " ... = cd ../.." - echo " - = cd -" - echo " h = history" - echo " md = mkdir -p" - echo " rd = rmdir" - echo " editor = $EDITOR" - echo " pager = $PAGER" - echo " piano = pianobar" - echo " q = exit" - echo " irc = $IRC_CLIENT" - echo + echo " sl = ls" + echo " ls = ls -G" + echo " la = ls -AF" + echo " ll = ls -al" + echo " l = ls -a" + echo " c/k/cls = clear" + echo " .. = cd .." + echo " ... = cd ../.." + echo " - = cd -" + echo " h = history" + echo " md = mkdir -p" + echo " rd = rmdir" + echo " editor = $EDITOR" + echo " pager = $PAGER" + echo " piano = pianobar" + echo " q = exit" + echo " irc = $IRC_CLIENT" + echo " md = mkdir -p" + echo " rd = rmdir" + echo " rb = ruby" + echo } From 81b82a80d279e5578c6720d72e3c8986722e2840 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Fri, 3 Jun 2011 07:36:31 -0500 Subject: [PATCH 061/151] Fix an idiot mistake I made --- aliases/general.aliases.bash | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/aliases/general.aliases.bash b/aliases/general.aliases.bash index 1e7d4458..79bd7aa0 100644 --- a/aliases/general.aliases.bash +++ b/aliases/general.aliases.bash @@ -15,32 +15,32 @@ then alias ls="ls --color=always" fi -alias c = 'clear' -alias k = 'clear' -alias cls = 'clear' +alias c='clear' +alias k='clear' +alias cls='clear' -alias edit = "$EDITOR" -alias page = "$PAGER" +alias edit="$EDITOR" +alias pager="$PAGER" -alias q = "exit" +alias q="exit" -alias irc = "$IRC_CLIENT" +alias irc="$IRC_CLIENT" -alias rb = "ruby" +alias rb="ruby" # Pianobar can be found here: http://github.com/PromyLOPh/pianobar/ alias piano="pianobar" -alias .. = 'cd ..' # Go up one directory -alias ... = 'cd ../..' # Go up two directories -alias -- - = "cd -" # Go back +alias ..='cd ..' # Go up one directory +alias ...='cd ../..' # Go up two directories +alias -- -="cd -" # Go back # Shell History -alias h = 'history' +alias h='history' # Tree -alias tree = "find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'" +alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'" # Directory alias md='mkdir -p' From b7a0cb6133bfde63deff59e90a614f55028735f4 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Sun, 5 Jun 2011 20:45:53 -0500 Subject: [PATCH 062/151] Added Homebrew aliases --- aliases/homebrew.aliases.bash | 24 ++++++++++++++++++++++++ bash_it.sh | 1 + 2 files changed, 25 insertions(+) create mode 100644 aliases/homebrew.aliases.bash diff --git a/aliases/homebrew.aliases.bash b/aliases/homebrew.aliases.bash new file mode 100644 index 00000000..051081d9 --- /dev/null +++ b/aliases/homebrew.aliases.bash @@ -0,0 +1,24 @@ +# Some aliases for Homebrew + +alias bup="brew update && brew upgrade" +alias bout="brew outdated" +alias bin="brew install" +alias brm="brew uninstall" +alias bls="brew list" +alias bsr="brew search" +alias binf="brew info" +alias bdr="brew doctor" + +function brew-help() { + echo "Homebrew Alias Usage" + echo + echo "bup = brew update && brew upgrade" + echo "bout = brew outdated" + echo "bin = brew install" + echo "brm = brew uninstall" + echo "bls = brew list" + echo "bsr = brew search" + echo "binf = brew info" + echo "bdr = brew doctor" + echo +} diff --git a/bash_it.sh b/bash_it.sh index 4a9b30d3..d63458a0 100644 --- a/bash_it.sh +++ b/bash_it.sh @@ -73,6 +73,7 @@ function bash-it() { echo " rails-help This will list out all the aliases you can use with rails." echo " git-help This will list out all the aliases you can use with git." echo " todo-help This will list out all the aliases you can use with todo.txt-cli" + echo " brew-help This will list out all the aliases you can use with Homebrew" echo " aliases-help Generic list of aliases." echo " plugins-help This will list out all the plugins and functions you can use with bash-it" echo From dcb0ddec2f343f8a685b0cd2795454abb5853555 Mon Sep 17 00:00:00 2001 From: Ryan Kanno Date: Tue, 7 Jun 2011 08:25:45 -1000 Subject: [PATCH 063/151] Added comments Added imgur screenshot --- themes/hawaii50/hawaii50.theme.bash | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index a0343a04..ac3bb592 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -18,7 +18,7 @@ # - hg, svn, git detection (I work in all of them) # - virtualenv, rvm + gemsets # -# Screenshot: +# Screenshot: http://i.imgur.com/4IAMJ.png # # by Ryan Kanno # @@ -60,6 +60,8 @@ MAX_PWD_LENGTH=20 MAX_GIT_HEX_LENGTH=5 # FUNCS ======================================================================= + +# TODO: Should check with `uname` and use ip addr function ip { echo $(ifconfig en1 | grep "inet " | awk '{ print $2 }') } From c7fcf206480046d4cc9e0f031ea9826b91a0adbf Mon Sep 17 00:00:00 2001 From: Ryan Date: Wed, 8 Jun 2011 10:20:04 -1000 Subject: [PATCH 064/151] Updated scm function to include `hg root` to check for Mercurial Removed scm function from hawaii50.theme.bash --- themes/base.theme.bash | 1 + themes/hawaii50/hawaii50.theme.bash | 10 ---------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 70876622..948427ac 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -24,6 +24,7 @@ function scm { if [[ -d .git ]]; then SCM=$GIT elif [[ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]]; then SCM=$GIT elif [[ -d .hg ]]; then SCM=$HG + elif [[ -n "$(hg root 2> /dev/null)" ]]; then SCM=$HG elif [[ -d .svn ]]; then SCM=$SVN else SCM='NONE' fi diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index ac3bb592..4fb8b1db 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -66,16 +66,6 @@ function ip { echo $(ifconfig en1 | grep "inet " | awk '{ print $2 }') } -# Override function scm -function scm { - if [[ -d .git ]]; then SCM=$GIT - elif [[ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]]; then SCM=$GIT - elif [[ -n "$(hg summary 2> /dev/null)" ]]; then SCM=$HG - elif [[ -d .svn ]]; then SCM=$SVN - else SCM='NONE' - fi -} - # Displays the current virtualenv information function curr_virtualenv_info() { [ ! -z "$VIRTUAL_ENV" ] && echo "`basename $VIRTUAL_ENV`" From 0713fdc031012899bdb02d7e49fd7362af2a3d97 Mon Sep 17 00:00:00 2001 From: Ryan Date: Wed, 8 Jun 2011 11:32:50 -1000 Subject: [PATCH 065/151] Added virtualenv_prompt to base.theme.bash (modeled after rvm_prompt) Removed virtualenv/rvm from hawaii50 theme --- themes/base.theme.bash | 10 ++++++++++ themes/hawaii50/hawaii50.theme.bash | 30 ++++++++++------------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 948427ac..d6be1544 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -20,6 +20,9 @@ SCM_NONE_CHAR='○' RVM_THEME_PROMPT_PREFIX=' |' RVM_THEME_PROMPT_SUFFIX='|' +VIRTUALENV_THEME_PROMPT_PREFIX=' |' +VIRTUALENV_THEME_PROMPT_SUFFIX='|' + function scm { if [[ -d .git ]]; then SCM=$GIT elif [[ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]]; then SCM=$GIT @@ -85,3 +88,10 @@ function rvm_version_prompt { echo -e "$RVM_THEME_PROMPT_PREFIX$rvm$RVM_THEME_PROMPT_SUFFIX" fi } + +function virtualenv_prompt { + if which virtualenv &> /dev/null; then + virtualenv=$([ ! -z "$VIRTUAL_ENV" ] && echo "`basename $VIRTUAL_ENV`") || return + echo -e "$VIRTUALENV_THEME_PROMPT_PREFIX$virtualenv$VIRTUALENV_THEME_PROMPT_SUFFIX" + fi +} diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index 4fb8b1db..a8e1de27 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -50,8 +50,14 @@ REF_COLOR='\[${purple}\]' # SCM prompts SCM_THEME_PROMPT_DIRTY=' ${bold_red}✗${normal}' SCM_THEME_PROMPT_CLEAN=' ${bold_green}✓${normal}' -SCM_THEME_PROMPT_PREFIX=" " -SCM_THEME_PROMPT_SUFFIX="" +SCM_THEME_PROMPT_PREFIX=' ' +SCM_THEME_PROMPT_SUFFIX='' + +RVM_THEME_PROMPT_PREFIX='' +RVM_THEME_PROMPT_SUFFIX='' + +VIRTUALENV_THEME_PROMPT_PREFIX='' +VIRTUALENV_THEME_PROMPT_SUFFIX='' # Max length of PWD to display MAX_PWD_LENGTH=20 @@ -66,26 +72,10 @@ function ip { echo $(ifconfig en1 | grep "inet " | awk '{ print $2 }') } -# Displays the current virtualenv information -function curr_virtualenv_info() { - [ ! -z "$VIRTUAL_ENV" ] && echo "`basename $VIRTUAL_ENV`" -} - -# Displays the current rvm information w/gemset -function curr_rvm_info() { - local ruby_version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}') - local ruby_gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}') - - if [ "$ruby_version" != "" ]; then - [ "$ruby_gemset" != "" ] && ruby_gemset="@$ruby_gemset" - echo "$ruby_version$ruby_gemset" - fi -} - # Displays using ... function virtual_info() { - local virtual_env_info=$(curr_virtualenv_info) - local rvm_info=$(curr_rvm_info) + local virtual_env_info=$(virtualenv_prompt) + local rvm_info=$(rvm_version_prompt) # If no virtual info, just return [ "$virtual_env_info" == "" -a "$rvm_info" == "" ] && return From 28e2aeda4db35bfa58b9ccdcff87cf2c5d1eb5a1 Mon Sep 17 00:00:00 2001 From: Ryan Date: Wed, 8 Jun 2011 11:57:16 -1000 Subject: [PATCH 066/151] Refactored theme to remove scm_info and rename overridden functions --- themes/hawaii50/hawaii50.theme.bash | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index a8e1de27..3dc77bc6 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -59,6 +59,9 @@ RVM_THEME_PROMPT_SUFFIX='' VIRTUALENV_THEME_PROMPT_PREFIX='' VIRTUALENV_THEME_PROMPT_SUFFIX='' +SCM_PROMPT_PREFIX=' on' +SCM_PROMPT_SUFFIX='' + # Max length of PWD to display MAX_PWD_LENGTH=20 @@ -94,17 +97,13 @@ function virtual_info() { } # SCM information -function scm_info() { - SCM_CHAR=$(scm_char) - [ "$SCM_CHAR" == "$SCM_NONE_CHAR" ] && return - local prompt=" on" - [ "$SCM_CHAR" == "$SCM_GIT_CHAR" ] && echo "$prompt$(parse_git_info)" && return - [ "$SCM_CHAR" == "$SCM_SVN_CHAR" ] && echo "$prompt$(parse_svn_info)" && return - [ "$SCM_CHAR" == "$SCM_HG_CHAR" ] && echo "$prompt$(parse_hg_info)" && return +function h50_scm_prompt_info() { + local scm_prompt=$(scm_prompt_info) + [[ -n "$scm_prompt" ]] && echo -e "$SCM_PROMPT_PREFIX$scm_prompt$SCM_PROMPT_SUFFIX" } # Parse git info -function parse_git_info() { +function git_prompt_info() { if [[ -n $(git status -s 2> /dev/null |grep -v ^# |grep -v "working directory clean") ]]; then state=${GIT_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} else @@ -119,7 +118,7 @@ function parse_git_info() { } # Parse hg info -function parse_hg_info() { +function hg_prompt_info() { if [[ -n $(hg status 2> /dev/null) ]]; then state=${HG_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} else @@ -134,7 +133,7 @@ function parse_hg_info() { } # Parse svn info -function parse_svn_info() { +function svn_prompt_info() { if [[ -n $(svn status --ignore-externals -q 2> /dev/null) ]]; then state=${SVN_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} else @@ -172,7 +171,7 @@ function prompt() { local UC=$USER_COLOR [ $UID -eq "0" ] && UC=$SUPERUSER_COLOR - PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR})${DEFAULT_COLOR} in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(virtual_info)$(scm_info) \$ " + PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR})${DEFAULT_COLOR} in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(virtual_info)$(h50_scm_prompt_info) \$ " PS2='> ' PS4='+ ' } From 09bd0ef5d04660b33aa76ba96c916b3efe0032e8 Mon Sep 17 00:00:00 2001 From: Ryan Date: Wed, 8 Jun 2011 13:34:27 -1000 Subject: [PATCH 067/151] Um, what was I thinking. Removed SCM_PROMPT_PREFIX and custom scm_info. (No need for it). --- themes/hawaii50/hawaii50.theme.bash | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index 3dc77bc6..946b808c 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -50,7 +50,7 @@ REF_COLOR='\[${purple}\]' # SCM prompts SCM_THEME_PROMPT_DIRTY=' ${bold_red}✗${normal}' SCM_THEME_PROMPT_CLEAN=' ${bold_green}✓${normal}' -SCM_THEME_PROMPT_PREFIX=' ' +SCM_THEME_PROMPT_PREFIX=' on ' SCM_THEME_PROMPT_SUFFIX='' RVM_THEME_PROMPT_PREFIX='' @@ -59,9 +59,6 @@ RVM_THEME_PROMPT_SUFFIX='' VIRTUALENV_THEME_PROMPT_PREFIX='' VIRTUALENV_THEME_PROMPT_SUFFIX='' -SCM_PROMPT_PREFIX=' on' -SCM_PROMPT_SUFFIX='' - # Max length of PWD to display MAX_PWD_LENGTH=20 @@ -96,12 +93,6 @@ function virtual_info() { echo "$prompt" } -# SCM information -function h50_scm_prompt_info() { - local scm_prompt=$(scm_prompt_info) - [[ -n "$scm_prompt" ]] && echo -e "$SCM_PROMPT_PREFIX$scm_prompt$SCM_PROMPT_SUFFIX" -} - # Parse git info function git_prompt_info() { if [[ -n $(git status -s 2> /dev/null |grep -v ^# |grep -v "working directory clean") ]]; then @@ -171,7 +162,7 @@ function prompt() { local UC=$USER_COLOR [ $UID -eq "0" ] && UC=$SUPERUSER_COLOR - PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR})${DEFAULT_COLOR} in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(virtual_info)$(h50_scm_prompt_info) \$ " + PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR})${DEFAULT_COLOR} in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(virtual_info)$(scm_prompt_info) \$ " PS2='> ' PS4='+ ' } From b96345e00c64dc2be94275f3d1b6f298bf6af378 Mon Sep 17 00:00:00 2001 From: Ryan Kanno Date: Thu, 9 Jun 2011 12:18:11 -1000 Subject: [PATCH 068/151] Added VIRTUAL_PROMPT_ENABLED FLAG Added -e to echo to interpret \ Updated bash conditionals to use [[]] --- themes/hawaii50/hawaii50.theme.bash | 73 +++++++++++++++++------------ 1 file changed, 44 insertions(+), 29 deletions(-) diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index 946b808c..6202eb4d 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -53,12 +53,20 @@ SCM_THEME_PROMPT_CLEAN=' ${bold_green}✓${normal}' SCM_THEME_PROMPT_PREFIX=' on ' SCM_THEME_PROMPT_SUFFIX='' +# rvm prompts RVM_THEME_PROMPT_PREFIX='' RVM_THEME_PROMPT_SUFFIX='' +# virtualenv prompts VIRTUALENV_THEME_PROMPT_PREFIX='' VIRTUALENV_THEME_PROMPT_SUFFIX='' +# virtual prompts +VIRTUAL_PROMPT_ENABLED=1 + +VIRTUAL_THEME_PROMPT_PREFIX=' using ' +VIRTUAL_THEME_PROMPT_SUFFIX='' + # Max length of PWD to display MAX_PWD_LENGTH=20 @@ -69,72 +77,76 @@ MAX_GIT_HEX_LENGTH=5 # TODO: Should check with `uname` and use ip addr function ip { - echo $(ifconfig en1 | grep "inet " | awk '{ print $2 }') + echo -e $(ifconfig en1 | grep "inet " | awk '{ print $2 }') } -# Displays using ... -function virtual_info() { +# Displays virtual info prompt (virtualenv/rvm) +function virtual_prompt_info() { local virtual_env_info=$(virtualenv_prompt) local rvm_info=$(rvm_version_prompt) + local virtual_prompt="" + + local prefix=${VIRTUAL_THEME_PROMPT_PREFIX} + local suffix=${VIRTUAL_THEME_PROMPT_SUFFIX} # If no virtual info, just return - [ "$virtual_env_info" == "" -a "$rvm_info" == "" ] && return - - local prompt=" using" + [[ -z "$virtual_env_info" && -z "$rvm_info" ]] && return # If virtual_env info present, append to prompt - [ "$virtual_env_info" != "" ] && prompt="$prompt virtualenv: ${VE_COLOR}$virtual_env_info${DEFAULT_COLOR}" + [[ -n "$virtual_env_info" ]] && virtual_prompt="virtualenv: ${VE_COLOR}$virtual_env_info${DEFAULT_COLOR}" - if [ "$rvm_info" != "" ] + if [[ -n "$rvm_info" ]] then - [ "$virtual_env_info" != "" ] && prompt="$prompt," - prompt="$prompt rvm: ${RVM_COLOR}$rvm_info${DEFAULT_COLOR}" + [[ -n "$virtual_env_info" ]] && virtual_prompt="$virtual_prompt, " + virtual_prompt="${virtual_prompt}rvm: ${RVM_COLOR}$rvm_info${DEFAULT_COLOR}" fi - echo "$prompt" + echo -e "$prefix$virtual_prompt$suffix" } # Parse git info function git_prompt_info() { if [[ -n $(git status -s 2> /dev/null |grep -v ^# |grep -v "working directory clean") ]]; then - state=${GIT_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} + state=${GIT_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} else - state=${GIT_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} + state=${GIT_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} fi prefix=${GIT_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} suffix=${GIT_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} ref=$(git symbolic-ref HEAD 2> /dev/null) || return - rawhex=$(git rev-parse HEAD 2>/dev/null) || return + commit_id=$(git rev-parse HEAD 2>/dev/null) || return - echo "$prefix${REF_COLOR}${ref#refs/heads/}${DEFAULT_COLOR}:${rawhex:0:$MAX_GIT_HEX_LENGTH}$state$suffix" + echo -e "$prefix${REF_COLOR}${ref#refs/heads/}${DEFAULT_COLOR}:${commit_id:0:$MAX_GIT_HEX_LENGTH}$state$suffix" } # Parse hg info function hg_prompt_info() { if [[ -n $(hg status 2> /dev/null) ]]; then - state=${HG_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} + state=${HG_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} else - state=${HG_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} + state=${HG_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} fi prefix=${HG_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} suffix=${HG_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} branch=$(hg summary 2> /dev/null | grep branch | awk '{print $2}') changeset=$(hg summary 2> /dev/null | grep parent | awk '{print $2}') - echo "$prefix${REF_COLOR}${branch}${DEFAULT_COLOR}:${changeset#*:}$state$suffix" + echo -e "$prefix${REF_COLOR}${branch}${DEFAULT_COLOR}:${changeset#*:}$state$suffix" } # Parse svn info function svn_prompt_info() { if [[ -n $(svn status --ignore-externals -q 2> /dev/null) ]]; then - state=${SVN_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} + state=${SVN_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} else - state=${SVN_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} + state=${SVN_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} fi prefix=${SVN_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} suffix=${SVN_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} ref=$(svn info 2> /dev/null | awk -F/ '/^URL:/ { for (i=0; i<=NF; i++) { if ($i == "branches" || $i == "tags" ) { print $(i+1); break }; if ($i == "trunk") { print $i; break } } }') || return - revision=$(svn info 2> /dev/null | sed -ne 's#^Revision: ##p' ) [[ -z $ref ]] && return + + revision=$(svn info 2> /dev/null | sed -ne 's#^Revision: ##p' ) + echo -e "$prefix${REF_COLOR}$ref${DEFAULT_COLOR}:$revision$state$suffix" } @@ -150,21 +162,24 @@ function limited_pwd() { then local truncated_symbol="..." TRUNCATED_PWD=${RELATIVE_PWD:$offset:$MAX_PWD_LENGTH} - echo "${truncated_symbol}/${TRUNCATED_PWD#*/}" + echo -e "${truncated_symbol}/${TRUNCATED_PWD#*/}" else - echo "${RELATIVE_PWD}" + echo -e "${RELATIVE_PWD}" fi } # Displays the current prompt function prompt() { + local UC=$USER_COLOR + [ $UID -eq "0" ] && UC=$SUPERUSER_COLOR - local UC=$USER_COLOR - [ $UID -eq "0" ] && UC=$SUPERUSER_COLOR - - PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR})${DEFAULT_COLOR} in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(virtual_info)$(scm_prompt_info) \$ " - PS2='> ' - PS4='+ ' + if [[ $VIRTUAL_PROMPT_ENABLED == 1 ]]; then + PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR})${DEFAULT_COLOR} in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(virtual_prompt_info)$(scm_prompt_info) \$ " + else + PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR})${DEFAULT_COLOR} in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(scm_prompt_info) \$ " + fi + PS2='> ' + PS4='+ ' } PROMPT_COMMAND=prompt From 49f897ae0def7ef26fe68570726cfb3804bb75c3 Mon Sep 17 00:00:00 2001 From: Ryan Kanno Date: Thu, 9 Jun 2011 13:20:41 -1000 Subject: [PATCH 069/151] Changed ip function to use bash-it's func, parsing out 127.0.0.1 Attached public facing ip address to list --- themes/hawaii50/hawaii50.theme.bash | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index 6202eb4d..a86821c0 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -73,11 +73,14 @@ MAX_PWD_LENGTH=20 # Max length of Git Hex to display MAX_GIT_HEX_LENGTH=5 +# IP address +IP_SEPARATOR=', ' + # FUNCS ======================================================================= -# TODO: Should check with `uname` and use ip addr function ip { - echo -e $(ifconfig en1 | grep "inet " | awk '{ print $2 }') + myip=$(curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+') + echo -e "$(ips | sed -e :a -e '$!N;s/\n/${IP_SEPARATOR}/;ta' | sed -e 's/127\.0\.0\.1\${IP_SEPARATOR}//g'), ${myip}" } # Displays virtual info prompt (virtualenv/rvm) From ef42010c7b6468c18529820cb68bcc84747d79bd Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Sun, 12 Jun 2011 19:44:27 -0500 Subject: [PATCH 070/151] Make all aliases optional (a la plugins) This continues a pattern that was introduced in ffa45b0 and refined further in later commits. This enables all aliases by default, but can be disabled by any user if they remove the appropriate aliases/enabled/*.bash file. --- .gitignore | 1 + aliases/{ => available}/emacs.aliases.bash | 0 aliases/{ => available}/general.aliases.bash | 0 aliases/{ => available}/git.aliases.bash | 0 aliases/{ => available}/heroku.aliases.bash | 0 aliases/{ => available}/hg.aliases.bash | 0 aliases/{ => available}/jekyll.aliases.bash | 0 aliases/{ => available}/osx.aliases.bash | 0 aliases/{ => available}/rails.aliases.bash | 0 aliases/{ => available}/textmate.aliases.bash | 0 aliases/{ => available}/todo.txt-cli.aliases.bash | 0 aliases/{ => available}/vim.aliases.bash | 0 bash_it.sh | 7 ++++++- 13 files changed, 7 insertions(+), 1 deletion(-) rename aliases/{ => available}/emacs.aliases.bash (100%) rename aliases/{ => available}/general.aliases.bash (100%) rename aliases/{ => available}/git.aliases.bash (100%) rename aliases/{ => available}/heroku.aliases.bash (100%) rename aliases/{ => available}/hg.aliases.bash (100%) rename aliases/{ => available}/jekyll.aliases.bash (100%) rename aliases/{ => available}/osx.aliases.bash (100%) rename aliases/{ => available}/rails.aliases.bash (100%) rename aliases/{ => available}/textmate.aliases.bash (100%) rename aliases/{ => available}/todo.txt-cli.aliases.bash (100%) rename aliases/{ => available}/vim.aliases.bash (100%) diff --git a/.gitignore b/.gitignore index 6be7eefe..33e5fca9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +aliases/enabled plugins/enabled .DS_Store custom/*.bash diff --git a/aliases/emacs.aliases.bash b/aliases/available/emacs.aliases.bash similarity index 100% rename from aliases/emacs.aliases.bash rename to aliases/available/emacs.aliases.bash diff --git a/aliases/general.aliases.bash b/aliases/available/general.aliases.bash similarity index 100% rename from aliases/general.aliases.bash rename to aliases/available/general.aliases.bash diff --git a/aliases/git.aliases.bash b/aliases/available/git.aliases.bash similarity index 100% rename from aliases/git.aliases.bash rename to aliases/available/git.aliases.bash diff --git a/aliases/heroku.aliases.bash b/aliases/available/heroku.aliases.bash similarity index 100% rename from aliases/heroku.aliases.bash rename to aliases/available/heroku.aliases.bash diff --git a/aliases/hg.aliases.bash b/aliases/available/hg.aliases.bash similarity index 100% rename from aliases/hg.aliases.bash rename to aliases/available/hg.aliases.bash diff --git a/aliases/jekyll.aliases.bash b/aliases/available/jekyll.aliases.bash similarity index 100% rename from aliases/jekyll.aliases.bash rename to aliases/available/jekyll.aliases.bash diff --git a/aliases/osx.aliases.bash b/aliases/available/osx.aliases.bash similarity index 100% rename from aliases/osx.aliases.bash rename to aliases/available/osx.aliases.bash diff --git a/aliases/rails.aliases.bash b/aliases/available/rails.aliases.bash similarity index 100% rename from aliases/rails.aliases.bash rename to aliases/available/rails.aliases.bash diff --git a/aliases/textmate.aliases.bash b/aliases/available/textmate.aliases.bash similarity index 100% rename from aliases/textmate.aliases.bash rename to aliases/available/textmate.aliases.bash diff --git a/aliases/todo.txt-cli.aliases.bash b/aliases/available/todo.txt-cli.aliases.bash similarity index 100% rename from aliases/todo.txt-cli.aliases.bash rename to aliases/available/todo.txt-cli.aliases.bash diff --git a/aliases/vim.aliases.bash b/aliases/available/vim.aliases.bash similarity index 100% rename from aliases/vim.aliases.bash rename to aliases/available/vim.aliases.bash diff --git a/bash_it.sh b/bash_it.sh index d63458a0..1dde4503 100644 --- a/bash_it.sh +++ b/bash_it.sh @@ -37,7 +37,12 @@ do done # Aliases -FUNCTIONS="${BASH}/aliases/*.bash" +if [ ! -d "${BASH}/aliases/enabled" ] +then + mkdir "${BASH}/aliases/enabled" + ln -s ${BASH}/aliases/available/* "${BASH}/aliases/enabled" +fi +FUNCTIONS="${BASH}/aliases/enabled/*.bash" for config_file in $FUNCTIONS do source $config_file From 80e734f3e0d40b68adb13b4fb7397f69af0421ce Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Mon, 13 Jun 2011 11:45:24 -0500 Subject: [PATCH 071/151] Added Homebrew aliases to the available aliases --- aliases/{ => available}/homebrew.aliases.bash | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename aliases/{ => available}/homebrew.aliases.bash (100%) diff --git a/aliases/homebrew.aliases.bash b/aliases/available/homebrew.aliases.bash similarity index 100% rename from aliases/homebrew.aliases.bash rename to aliases/available/homebrew.aliases.bash From 50179fd778081db95a5e316d401dad00af80ca79 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Mon, 13 Jun 2011 22:05:45 -0500 Subject: [PATCH 072/151] Can't forget to source the custom aliases! --- bash_it.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bash_it.sh b/bash_it.sh index 1dde4503..3dd3d7a6 100644 --- a/bash_it.sh +++ b/bash_it.sh @@ -48,6 +48,8 @@ do source $config_file done +source "${BASH}/aliases/custom.aliases.bash" + # Custom CUSTOM="${BASH}/custom/*.bash" for config_file in $CUSTOM From 1f1ab36f37a9ce3bb84ad1396bc6e3de58f9fc2b Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Fri, 17 Jun 2011 10:18:48 -0400 Subject: [PATCH 073/151] Add rainbowbrite theme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Looks like: ± ~/path/to (branch ✓) $ in glorious red / blue / yellow color scheme --- themes/rainbowbrite/rainbowbrite.theme.bash | 28 +++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 themes/rainbowbrite/rainbowbrite.theme.bash diff --git a/themes/rainbowbrite/rainbowbrite.theme.bash b/themes/rainbowbrite/rainbowbrite.theme.bash new file mode 100644 index 00000000..c9d6f7e8 --- /dev/null +++ b/themes/rainbowbrite/rainbowbrite.theme.bash @@ -0,0 +1,28 @@ +#!/bin/bash + +# based off of n0qorg +# looks like, if you're in a git repo: +# ± ~/path/to (branch ✓) $ +# in glorious red / blue / yellow color scheme + +prompt_setter() { + # Save history + history -a + 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\] " + # no user@server + PS1="\[$red\]$(scm_char) \[$blue\]\w\[$yellow\]$(scm_prompt_info)$(rvm_version_prompt) \[$black\]$\[$reset_color\] " + PS2='> ' + PS4='+ ' +} + +PROMPT_COMMAND=prompt_setter + +SCM_THEME_PROMPT_DIRTY=" ✗" +SCM_THEME_PROMPT_CLEAN=" ✓" +SCM_THEME_PROMPT_PREFIX=" (" +SCM_THEME_PROMPT_SUFFIX=")" +RVM_THEME_PROMPT_PREFIX=" (" +RVM_THEME_PROMPT_SUFFIX=")" From 3dc46203205f89195d29be5cf079f2e31669e77d Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Fri, 17 Jun 2011 10:24:04 -0400 Subject: [PATCH 074/151] SCM_NONE_CHAR='.' -> dot if no repo --- themes/base.theme.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 70876622..c80290dc 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -15,7 +15,7 @@ SCM_HG_CHAR='☿' SVN='svn' SCM_SVN_CHAR='⑆' -SCM_NONE_CHAR='○' +SCM_NONE_CHAR='·' RVM_THEME_PROMPT_PREFIX=' |' RVM_THEME_PROMPT_SUFFIX='|' From fcf358169ff91ca3f10f96161b187e1a7227b93c Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Fri, 17 Jun 2011 10:34:20 -0400 Subject: [PATCH 075/151] rainbowbrite theme : color branch status indicator --- themes/rainbowbrite/rainbowbrite.theme.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/themes/rainbowbrite/rainbowbrite.theme.bash b/themes/rainbowbrite/rainbowbrite.theme.bash index c9d6f7e8..581fca4a 100644 --- a/themes/rainbowbrite/rainbowbrite.theme.bash +++ b/themes/rainbowbrite/rainbowbrite.theme.bash @@ -20,9 +20,9 @@ prompt_setter() { PROMPT_COMMAND=prompt_setter -SCM_THEME_PROMPT_DIRTY=" ✗" -SCM_THEME_PROMPT_CLEAN=" ✓" +SCM_THEME_PROMPT_DIRTY=" ${red}✗" +SCM_THEME_PROMPT_CLEAN=" ${green}✓" SCM_THEME_PROMPT_PREFIX=" (" -SCM_THEME_PROMPT_SUFFIX=")" +SCM_THEME_PROMPT_SUFFIX="${yellow})" RVM_THEME_PROMPT_PREFIX=" (" RVM_THEME_PROMPT_SUFFIX=")" From 3ef689f29a777f8a076b4a7032ca46f4ba331106 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Fri, 17 Jun 2011 10:57:31 -0400 Subject: [PATCH 076/151] Add various aliases --- aliases/available/general.aliases.bash | 9 +++++++++ aliases/available/git.aliases.bash | 7 ++++++- aliases/available/jekyll.aliases.bash | 3 +++ aliases/available/osx.aliases.bash | 1 + 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/aliases/available/general.aliases.bash b/aliases/available/general.aliases.bash index 79bd7aa0..2ed9d134 100644 --- a/aliases/available/general.aliases.bash +++ b/aliases/available/general.aliases.bash @@ -46,6 +46,15 @@ alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'" alias md='mkdir -p' alias rd=rmdir +# show / hide hidden files +alias showhidden="defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder" +alias hidehidden="defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder" +# display IP address +alias myip="echo ethernet:; ipconfig getifaddr en0; echo wireless:; ipconfig getifaddr en1" + +# http://snippets.dzone.com/posts/show/2486 +alias killsvn="find . -name ".svn" -type d -exec rm -rf {} \;" + function aliases-help() { echo "Generic Alias Usage" echo diff --git a/aliases/available/git.aliases.bash b/aliases/available/git.aliases.bash index 45d7d05f..3a5d2a9f 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -39,7 +39,12 @@ case $OSTYPE in ;; esac - +# git add remote branch +function garb() { + echo "Adding remote branch '$1'"; + git config branch.$1.remote origin; + git config branch.$1.merge refs/heads/$1; +} function git-help() { echo "Git Custom Aliases Usage" diff --git a/aliases/available/jekyll.aliases.bash b/aliases/available/jekyll.aliases.bash index e52c0351..feaf245a 100644 --- a/aliases/available/jekyll.aliases.bash +++ b/aliases/available/jekyll.aliases.bash @@ -18,3 +18,6 @@ alias buildsite="builtin cd $JEKYLL_LOCAL_ROOT && rm -rf _site/ && jekyll" # Rsync the site to the remote server alias deploysite="builtin cd $JEKYLL_LOCAL_ROOT && rsync -rz _site/ $JEKYLL_REMOTE_ROOT" + +alias jkas="jekyll --auto --server" +alias rmjkas="rm -rf _site/* && jkas" \ No newline at end of file diff --git a/aliases/available/osx.aliases.bash b/aliases/available/osx.aliases.bash index e0746952..d25c0511 100644 --- a/aliases/available/osx.aliases.bash +++ b/aliases/available/osx.aliases.bash @@ -14,6 +14,7 @@ alias dashcode="open -a dashcode" alias f='open -a Finder ' alias textedit='open -a TextEdit' alias hex='open -a "Hex Fiend"' +alias gitx="open -a GitX" if [ -s /usr/bin/firefox ] ; then unalias firefox From d22a4cfa7058b224e37dbf07aa7cd3c583fdd188 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Fri, 17 Jun 2011 11:01:18 -0400 Subject: [PATCH 077/151] move garb into git plugins; rename newpost as jknewpost --- aliases/available/git.aliases.bash | 7 ------- plugins/available/git.plugins.bash | 8 +++++++- plugins/available/jekyll.plugins.bash | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/aliases/available/git.aliases.bash b/aliases/available/git.aliases.bash index 3a5d2a9f..7cfc9d93 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -39,13 +39,6 @@ case $OSTYPE in ;; esac -# git add remote branch -function garb() { - echo "Adding remote branch '$1'"; - git config branch.$1.remote origin; - git config branch.$1.merge refs/heads/$1; -} - function git-help() { echo "Git Custom Aliases Usage" echo diff --git a/plugins/available/git.plugins.bash b/plugins/available/git.plugins.bash index b0b9ce8c..3fbdac61 100644 --- a/plugins/available/git.plugins.bash +++ b/plugins/available/git.plugins.bash @@ -5,6 +5,13 @@ function git_remote { git remote add origin $GIT_HOSTING:$1.git } +# git add remote branch +function garb() { + echo "Adding remote branch '$1'"; + git config branch.$1.remote origin; + git config branch.$1.merge refs/heads/$1; +} + function git_first_push { echo "Running: git push origin master:refs/heads/master" git push origin master:refs/heads/master @@ -92,4 +99,3 @@ else echo "you're currently not in a git repository" fi } - diff --git a/plugins/available/jekyll.plugins.bash b/plugins/available/jekyll.plugins.bash index aebe69bc..3b96f451 100644 --- a/plugins/available/jekyll.plugins.bash +++ b/plugins/available/jekyll.plugins.bash @@ -26,7 +26,7 @@ editpost() { fi } -newpost() { +jknewpost() { # 'builtin cd' into the local jekyll root From 78270b3ab570e1806673a12a7f4f58c3eb029b09 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Fri, 17 Jun 2011 11:22:39 -0500 Subject: [PATCH 078/151] Make sure custom aliases file exists before sourcing it --- bash_it.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bash_it.sh b/bash_it.sh index 3dd3d7a6..b52ff97f 100644 --- a/bash_it.sh +++ b/bash_it.sh @@ -48,7 +48,10 @@ do source $config_file done -source "${BASH}/aliases/custom.aliases.bash" +if [ -e "${BASH}/aliases/custom.aliases.bash" ] +then + source "${BASH}/aliases/custom.aliases.bash" +fi # Custom CUSTOM="${BASH}/custom/*.bash" From 46b8d27815583c1b79ef9f0b27f9b39680baa114 Mon Sep 17 00:00:00 2001 From: JFSIII Date: Fri, 17 Jun 2011 14:58:20 -0400 Subject: [PATCH 079/151] Change color definitions so they don't require escaping in the themes. When do you ever want those unprintable characters included in the character count? --- themes/colors.theme.bash | 74 ++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/themes/colors.theme.bash b/themes/colors.theme.bash index 9aa253f5..ff8776d2 100644 --- a/themes/colors.theme.bash +++ b/themes/colors.theme.bash @@ -1,44 +1,44 @@ #!/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' +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\]" -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' +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\]" -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' +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' +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\]" -normal=$'\e[00m' -reset_color=$'\e[39m' \ No newline at end of file +normal="\[\e[00m\]" +reset_color="\[\e[39m\]" From 8e1107730dca1bf88d022782d9eacabbb4651e89 Mon Sep 17 00:00:00 2001 From: Ryan Kanno Date: Fri, 17 Jun 2011 10:31:49 -1000 Subject: [PATCH 080/151] Needed to escape colors correctly for line wrapping to occur. Removed extraneous DEFAULT_COLOR in prompt --- themes/hawaii50/hawaii50.theme.bash | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index a86821c0..ad87e787 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -31,8 +31,7 @@ # # COLORS ====================================================================== -ORANGE='\e[0;33m' -GREY='\e[1:37m' +ORANGE='\[\e[0;33m\]' DEFAULT_COLOR='\[${white}\]' @@ -48,8 +47,8 @@ RVM_COLOR='\[${cyan}\]' REF_COLOR='\[${purple}\]' # SCM prompts -SCM_THEME_PROMPT_DIRTY=' ${bold_red}✗${normal}' -SCM_THEME_PROMPT_CLEAN=' ${bold_green}✓${normal}' +SCM_THEME_PROMPT_DIRTY=' \[${bold_red}\]✗\[${normal}\]' +SCM_THEME_PROMPT_CLEAN=' \[${bold_green}\]✓\[${normal}\]' SCM_THEME_PROMPT_PREFIX=' on ' SCM_THEME_PROMPT_SUFFIX='' @@ -177,9 +176,9 @@ function prompt() { [ $UID -eq "0" ] && UC=$SUPERUSER_COLOR if [[ $VIRTUAL_PROMPT_ENABLED == 1 ]]; then - PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR})${DEFAULT_COLOR} in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(virtual_prompt_info)$(scm_prompt_info) \$ " + PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR}) in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(virtual_prompt_info)$(scm_prompt_info) \$ " else - PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR})${DEFAULT_COLOR} in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(scm_prompt_info) \$ " + PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR}) in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(scm_prompt_info) \$ " fi PS2='> ' PS4='+ ' From bb990313252a8dc95dbb5d58ca7bf5dd83ad402b Mon Sep 17 00:00:00 2001 From: Daniel Leavitt Date: Fri, 17 Jun 2011 14:38:49 -0700 Subject: [PATCH 081/151] Added "hg_prompt_info" to base theme - it is used by scm_prompt_info --- themes/base.theme.bash | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index d6be1544..71b11aeb 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -82,6 +82,20 @@ function svn_prompt_info { echo -e "$prefix$ref$state$suffix" } +function hg_prompt_info() { + if [[ -n $(hg status 2> /dev/null) ]]; then + state=${HG_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} + else + state=${HG_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} + fi + prefix=${HG_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} + suffix=${HG_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} + branch=$(hg summary 2> /dev/null | grep branch | awk '{print $2}') + changeset=$(hg summary 2> /dev/null | grep parent | awk '{print $2}') + + echo -e "$prefix${REF_COLOR}${branch}${DEFAULT_COLOR}:${changeset#*:}$state$suffix" +} + function rvm_version_prompt { if which rvm &> /dev/null; then rvm=$(rvm tools identifier) || return From 1b7c9419bf1a2474f2d819f9aa07687cb4d8fd1d Mon Sep 17 00:00:00 2001 From: JFSIII Date: Fri, 17 Jun 2011 19:45:21 -0400 Subject: [PATCH 082/151] Convert themes and plugins to use the update colors. Themes are no longer burdened with escaping the unprintable characters --- plugins/available/battery.plugin.bash | 12 +++++----- themes/bobby/bobby.theme.bash | 15 +++++------- themes/candy/candy.theme.bash | 6 ++++- themes/clean/clean.theme.bash | 18 ++++++++------ themes/demula/demula.theme.bash | 32 ++++++++++++------------- themes/doubletime/doubletime.theme.bash | 12 +++++----- themes/modern-t/modern-t.theme.bash | 10 ++++---- themes/modern/modern.theme.bash | 10 ++++---- themes/n0qorg/n0qorg.theme.bash | 6 ++++- themes/pete/pete.theme.bash | 2 +- themes/sirup/sirup.theme.bash | 8 +++++-- themes/standard/standard.theme.bash | 12 ++++++---- themes/zitron/zitron.theme.bash | 16 ++++++++----- themes/zork/zork.theme.bash | 10 ++++---- 14 files changed, 94 insertions(+), 75 deletions(-) diff --git a/plugins/available/battery.plugin.bash b/plugins/available/battery.plugin.bash index 4946c2c9..7c158122 100644 --- a/plugins/available/battery.plugin.bash +++ b/plugins/available/battery.plugin.bash @@ -69,11 +69,11 @@ battery_charge(){ local F_C='▸' # Depleted char local D_C='▹' - local DEPLETED_COLOR='\[${normal}\]' - local FULL_COLOR='\[${green}\]' - local HALF_COLOR='\[${yellow}\]' - local DANGER_COLOR='\[${red}\]' - local BATTERY_OUTPUT='${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${D_C}' + local DEPLETED_COLOR="${normal}" + local FULL_COLOR="${green}" + local HALF_COLOR="${yellow}" + local DANGER_COLOR="${red}" + local BATTERY_OUTPUT="${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${D_C}" local BATTERY_PERC=$(battery_percentage) case $BATTERY_PERC in @@ -123,7 +123,7 @@ battery_charge(){ echo "${HALF_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${normal}" ;; *) - echo "${DANGER_COLOR}UNPLG\[${normal}\]" + echo "${DANGER_COLOR}UNPLG${normal}" ;; esac } diff --git a/themes/bobby/bobby.theme.bash b/themes/bobby/bobby.theme.bash index 8b48ddd9..cb51fb85 100644 --- a/themes/bobby/bobby.theme.bash +++ b/themes/bobby/bobby.theme.bash @@ -4,15 +4,6 @@ SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓" SCM_THEME_PROMPT_PREFIX=" |" SCM_THEME_PROMPT_SUFFIX="${green}|" - -# PROMPT="\[${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}\] " - - -PROMPT="\n\[${yellow}\]\[\$(rvm_version_prompt)\] \[${purple}\]\h \[${reset_color}\]in \[${green}\]\w\n\[${bold_cyan}\]\[\$(scm_char)\]\[${green}\]\[\$(scm_prompt_info)\] \[\[${green}\]→\[${reset_color}\] " - - - -# git theming GIT_THEME_PROMPT_DIRTY=" ${red}✗" GIT_THEME_PROMPT_CLEAN=" ${bold_green}✓" GIT_THEME_PROMPT_PREFIX=" ${green}|" @@ -21,3 +12,9 @@ GIT_THEME_PROMPT_SUFFIX="${green}|" 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} " +} + +PROMPT_COMMAND=prompt_command; diff --git a/themes/candy/candy.theme.bash b/themes/candy/candy.theme.bash index ef0ba262..64d31b83 100644 --- a/themes/candy/candy.theme.bash +++ b/themes/candy/candy.theme.bash @@ -1,2 +1,6 @@ #!/bin/bash -PROMPT="${green}\u@\h ${blue}\T ${reset_color}${white}\w${reset_color}\[\$(scm_prompt_info)\]${blue} →${bold_blue} \$${reset_color} " \ No newline at end of file +function prompt_command() { + PS1="${green}\u@\h ${blue}\T ${reset_color}${white}\w${reset_color}$(scm_prompt_info)\]${blue} →${bold_blue} ${reset_color} "; +} + +PROMPT_COMMAND=prompt_command; diff --git a/themes/clean/clean.theme.bash b/themes/clean/clean.theme.bash index 2fc418f8..9998d65e 100644 --- a/themes/clean/clean.theme.bash +++ b/themes/clean/clean.theme.bash @@ -1,9 +1,3 @@ -if [ "$(whoami)" = root ]; then no_color=$red; else no_color=$white; fi - -PROMPT="${no_color}\u${reset_color}:${blue}\W/${reset_color} \[\$(scm_prompt_info)\]$ " -RPROMPT='[\t]' - - # git theming ZSH_THEME_GIT_PROMPT_PREFIX="${bold_blue}(${yellow}%B" ZSH_THEME_GIT_PROMPT_SUFFIX="%b${bold_blue})${reset_color} " @@ -13,4 +7,14 @@ ZSH_THEME_GIT_PROMPT_DIRTY="${bold_red}✗" # 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:' \ No newline at end of file +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:' + +function prompt_command() { + + if [ "$(whoami)" = root ]; then no_color=$red; else no_color=$white; fi + + PS1="${no_color}\u${reset_color}:${blue}\W/${reset_color} \[\$(scm_prompt_info)\]$ " + RPROMPT='[\t]' +} + +PROMPT_COMMAND=prompt_command; diff --git a/themes/demula/demula.theme.bash b/themes/demula/demula.theme.bash index 0e6744a4..bd48e12c 100644 --- a/themes/demula/demula.theme.bash +++ b/themes/demula/demula.theme.bash @@ -33,22 +33,22 @@ #*color7: #E5E5E5 # ----------------------------------------------------------------- COLOR CONF -D_DEFAULT_COLOR='\[${normal}\]' -D_INTERMEDIATE_COLOR='\[${white}\]' -D_USER_COLOR='\[${purple}\]' -D_SUPERUSER_COLOR='\[${red}\]' -D_MACHINE_COLOR='\[${cyan}\]' -D_DIR_COLOR='\[${green}\]' -D_SCM_COLOR='\[${yellow}\]' -D_BRANCH_COLOR='\[${yellow}\]' -D_CHANGES_COLOR='\[${white}\]' -D_CMDFAIL_COLOR='\[${red}\]' -D_VIMSHELL_COLOR='\[${cyan}\]' +D_DEFAULT_COLOR="${normal}" +D_INTERMEDIATE_COLOR="${white}" +D_USER_COLOR="${purple}" +D_SUPERUSER_COLOR="${red}" +D_MACHINE_COLOR="${cyan}" +D_DIR_COLOR="${green}" +D_SCM_COLOR="${yellow}" +D_BRANCH_COLOR="${yellow}" +D_CHANGES_COLOR="${white}" +D_CMDFAIL_COLOR="${red}" +D_VIMSHELL_COLOR="${cyan}" # ------------------------------------------------------------------ FUNCTIONS case $TERM in xterm*) - TITLEBAR="\[\033]0;\w\007\]" + TITLEBAR="\033]0;\w\007" ;; *) TITLEBAR="" @@ -84,10 +84,10 @@ ${D_BRANCH_COLOR}%b %r ${D_CHANGES_COLOR}%m%u ${D_DEFAULT_COLOR}" # -------------------------------------------------------------- PROMPT OUTPUT prompt() { - local SAVE_CURSOR='\[\033[s\]' - local RESTORE_CURSOR='\[\033[u\]' - local MOVE_CURSOR_RIGHTMOST='\[\033[500C\]' - local MOVE_CURSOR_5_LEFT='\[\033[5D\]' + local SAVE_CURSOR='\033[s' + local RESTORE_CURSOR='\033[u' + local MOVE_CURSOR_RIGHTMOST='\033[500C' + local MOVE_CURSOR_5_LEFT='\033[5D' if [ $(uname) = "Linux" ]; then diff --git a/themes/doubletime/doubletime.theme.bash b/themes/doubletime/doubletime.theme.bash index 91844f0e..1237f80f 100644 --- a/themes/doubletime/doubletime.theme.bash +++ b/themes/doubletime/doubletime.theme.bash @@ -1,9 +1,9 @@ #!/bin/bash SCM_THEME_PROMPT_DIRTY='' SCM_THEME_PROMPT_CLEAN='' -SCM_GIT_CHAR='${bold_cyan}±${normal}' -SCM_SVN_CHAR='${bold_cyan}⑆${normal}' -SCM_HG_CHAR='${bold_red}☿${normal}' +SCM_GIT_CHAR="${bold_cyan}±${normal}" +SCM_SVN_CHAR="${bold_cyan}⑆${normal}" +SCM_HG_CHAR="${bold_red}☿${normal}" SCM_THEME_PROMPT_PREFIX="" SCM_THEME_PROMPT_SUFFIX="" RVM_THEME_PROMPT_PREFIX=" (" @@ -32,7 +32,7 @@ virtualenv_prompt() { fi } -prompt_setter() { +function prompt_setter() { # Save history history -a history -c @@ -44,8 +44,8 @@ prompt_setter() { clock=$THEME_PROMPT_CLOCK_FORMAT fi PS1=" -$clock $(scm_char) [\[$THEME_PROMPT_HOST_COLOR\]\u@${THEME_PROMPT_HOST}\[$reset_color\]] $(virtualenv_prompt)\w -$(doubletime_scm_prompt)\[$reset_color\] $ " +$clock $(scm_char) [$THEME_PROMPT_HOST_COLOR\u@${THEME_PROMPT_HOST}$reset_color] $(virtualenv_prompt)\w +$(doubletime_scm_prompt)$reset_color $ " PS2='> ' PS4='+ ' } diff --git a/themes/modern-t/modern-t.theme.bash b/themes/modern-t/modern-t.theme.bash index 55da6e14..12e5b041 100644 --- a/themes/modern-t/modern-t.theme.bash +++ b/themes/modern-t/modern-t.theme.bash @@ -1,11 +1,11 @@ SCM_THEME_PROMPT_PREFIX="" SCM_THEME_PROMPT_SUFFIX="" -SCM_THEME_PROMPT_DIRTY=' ${bold_red}✗${normal}' -SCM_THEME_PROMPT_CLEAN=' ${bold_green}✓${normal}' -SCM_GIT_CHAR='${bold_green}±${normal}' -SCM_SVN_CHAR='${bold_cyan}⑆${normal}' -SCM_HG_CHAR='${bold_red}☿${normal}' +SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" +SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" +SCM_GIT_CHAR="${bold_green}±${normal}" +SCM_SVN_CHAR="${bold_cyan}⑆${normal}" +SCM_HG_CHAR="${bold_red}☿${normal}" case $TERM in xterm*) diff --git a/themes/modern/modern.theme.bash b/themes/modern/modern.theme.bash index 3efe9ffe..32c7cabb 100644 --- a/themes/modern/modern.theme.bash +++ b/themes/modern/modern.theme.bash @@ -1,11 +1,11 @@ SCM_THEME_PROMPT_PREFIX="" SCM_THEME_PROMPT_SUFFIX="" -SCM_THEME_PROMPT_DIRTY=' ${bold_red}✗${normal}' -SCM_THEME_PROMPT_CLEAN=' ${bold_green}✓${normal}' -SCM_GIT_CHAR='${bold_green}±${normal}' -SCM_SVN_CHAR='${bold_cyan}⑆${normal}' -SCM_HG_CHAR='${bold_red}☿${normal}' +SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" +SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" +SCM_GIT_CHAR="${bold_green}±${normal}" +SCM_SVN_CHAR="${bold_cyan}⑆${normal}" +SCM_HG_CHAR="${bold_red}☿${normal}" case $TERM in xterm*) diff --git a/themes/n0qorg/n0qorg.theme.bash b/themes/n0qorg/n0qorg.theme.bash index fcaca43f..2b9def6c 100644 --- a/themes/n0qorg/n0qorg.theme.bash +++ b/themes/n0qorg/n0qorg.theme.bash @@ -5,7 +5,11 @@ # host directory (branch*)» # for example: # ananas ~/Code/bash-it/themes (master*)» -PROMPT="${bold_blue}\[\$(hostname)\]${normal} \w${normal} ${bold_white}\[\$(git_prompt_info)\]${normal}» " +function prompt_command() { + PS1="${bold_blue}[$(hostname)]${normal} \w${normal} ${bold_white}[$(git_prompt_info)]${normal}» " +} + +PROMPT_COMMAND=prompt_command; ## git-theme # feel free to change git chars. diff --git a/themes/pete/pete.theme.bash b/themes/pete/pete.theme.bash index 95f243af..7b6702cf 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)$(rvm_version_prompt) $reset_color " PS2='> ' PS4='+ ' } diff --git a/themes/sirup/sirup.theme.bash b/themes/sirup/sirup.theme.bash index 50665871..146cc356 100644 --- a/themes/sirup/sirup.theme.bash +++ b/themes/sirup/sirup.theme.bash @@ -13,6 +13,10 @@ function rvm_version_prompt { [ "$full" != "" ] && echo "$full" } + +function prompt_command() { + # Check http://github.com/Sirupsen/dotfiles for screenshot + PS1="$blue\W/$bold_blue$(rvm_version_prompt)$bold_green$(__git_ps1 " (%s)") ${normal}$ " +} -# Check http://github.com/Sirupsen/dotfiles for screenshot -PS1='\[$blue\]\W/\[$bold_blue\]$(rvm_version_prompt)\[$bold_green\]$(__git_ps1 " (%s)") \[${normal}\]$ ' +PROMPT_COMMAND=prompt_command; diff --git a/themes/standard/standard.theme.bash b/themes/standard/standard.theme.bash index 5ba288c1..87402c73 100644 --- a/themes/standard/standard.theme.bash +++ b/themes/standard/standard.theme.bash @@ -1,7 +1,3 @@ -PROMPT='\[${green}\]\u\[${normal}\]@\[${green}\]\h\[${normal}\]:\[${blue}\]\w\[${normal}\]\[${red}\]$(prompt_char)$(git_prompt_info)\[${normal}\]\$ ' - - - # scm themeing SCM_THEME_PROMPT_DIRTY="×" SCM_THEME_PROMPT_CLEAN="✓" @@ -19,4 +15,10 @@ case $TERM in *) TITLEBAR="" ;; -esac \ No newline at end of file +esac + +function prompt_command() { + PROMPT='${green}\u${normal}@${green}\h${normal}:${blue}\w${normal}${red}$(prompt_char)$(git_prompt_info)${normal}\$ ' +} + +PROMPT_COMMAND=prompt_command; diff --git a/themes/zitron/zitron.theme.bash b/themes/zitron/zitron.theme.bash index c0726865..3ec4d97a 100644 --- a/themes/zitron/zitron.theme.bash +++ b/themes/zitron/zitron.theme.bash @@ -1,12 +1,6 @@ #!/bin/bash # zitron theme by Florian Baumann -## look-a-like -# user:host:pwd git-branch(*)$ -# for example: -# noqqe:deathstar:themes master*$ -PROMPT="${no_color}\u:\[\$(hostname)\]${normal}:${bold_yellow}\W/${normal} \[\$(git_prompt_info)\]${reset_color}$ " - ## git-theme # feel free to change git chars. GIT_THEME_PROMPT_DIRTY="${bold_yellow}*${normal}" @@ -18,3 +12,13 @@ GIT_THEME_PROMPT_SUFFIX="" # thanks a lot to http://geoff.greer.fm/lscolors/ export LSCOLORS="Gxfxcxdxbxegedabagacad" export LS_COLORS="no=00:fi=00:di=01;33:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.svgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;34:*.svg=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:" + +function prompt_command() { + ## look-a-like + # user:host:pwd git-branch(*)$ + # for example: + # noqqe:deathstar:themes master*$ + PS1="${no_color}\u:$(hostname)${normal}:${bold_yellow}\W/${normal} $(git_prompt_info)${reset_color}$ " +} + +PROMPT_COMMAND=prompt_command; diff --git a/themes/zork/zork.theme.bash b/themes/zork/zork.theme.bash index 54615d78..f541c0d9 100644 --- a/themes/zork/zork.theme.bash +++ b/themes/zork/zork.theme.bash @@ -1,11 +1,11 @@ SCM_THEME_PROMPT_PREFIX="" SCM_THEME_PROMPT_SUFFIX="" -SCM_THEME_PROMPT_DIRTY=' ${bold_red}✗${normal}' -SCM_THEME_PROMPT_CLEAN=' ${bold_green}✓${normal}' -SCM_GIT_CHAR='${bold_green}±${normal}' -SCM_SVN_CHAR='${bold_cyan}⑆${normal}' -SCM_HG_CHAR='${bold_red}☿${normal}' +SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" +SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" +SCM_GIT_CHAR="${bold_green}±${normal}" +SCM_SVN_CHAR="${bold_cyan}⑆${normal}" +SCM_HG_CHAR="${bold_red}☿${normal}" #Mysql Prompt export MYSQL_PS1="(\u@\h) [\d]> " From 8b380c191451afd1d2211c9c0738e5c8058899be Mon Sep 17 00:00:00 2001 From: JFSIII Date: Sat, 18 Jun 2011 10:57:59 -0400 Subject: [PATCH 083/151] Convert theme to use the already escaped colors introduced in 46b8d27815583c1b79ef9f0b27f9b39680baa114 --- themes/hawaii50/hawaii50.theme.bash | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index ad87e787..9ee1f6eb 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -33,22 +33,22 @@ # COLORS ====================================================================== ORANGE='\[\e[0;33m\]' -DEFAULT_COLOR='\[${white}\]' +DEFAULT_COLOR="${white}" -USER_COLOR='\[${purple}\]' -SUPERUSER_COLOR='\[${red}\]' +USER_COLOR="${purple}" +SUPERUSER_COLOR="${red}" MACHINE_COLOR=$ORANGE IP_COLOR=$ORANGE -DIRECTORY_COLOR='\[${green}\]' +DIRECTORY_COLOR="${green}" -VE_COLOR='\[${cyan}\]' -RVM_COLOR='\[${cyan}\]' +VE_COLOR="${cyan}" +RVM_COLOR="${cyan}" -REF_COLOR='\[${purple}\]' +REF_COLOR="${purple}" # SCM prompts -SCM_THEME_PROMPT_DIRTY=' \[${bold_red}\]✗\[${normal}\]' -SCM_THEME_PROMPT_CLEAN=' \[${bold_green}\]✓\[${normal}\]' +SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" +SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" SCM_THEME_PROMPT_PREFIX=' on ' SCM_THEME_PROMPT_SUFFIX='' From 59f7a188a7c855e5f27bb6b11f8d81a2b97c644a Mon Sep 17 00:00:00 2001 From: JFSIII Date: Sat, 18 Jun 2011 11:04:01 -0400 Subject: [PATCH 084/151] Add `${reset_color}` at the end of `PS1` to prevent color from bleeding --- themes/hawaii50/hawaii50.theme.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index 9ee1f6eb..21c0b413 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -176,9 +176,9 @@ function prompt() { [ $UID -eq "0" ] && UC=$SUPERUSER_COLOR if [[ $VIRTUAL_PROMPT_ENABLED == 1 ]]; then - PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR}) in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(virtual_prompt_info)$(scm_prompt_info) \$ " + PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR}) in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(virtual_prompt_info)$(scm_prompt_info)${reset_color} \$ " else - PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR}) in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(scm_prompt_info) \$ " + PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR}) in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(scm_prompt_info)${reset_color} \$ " fi PS2='> ' PS4='+ ' From 4219db7affac90c46de0848a6b98984147061cdb Mon Sep 17 00:00:00 2001 From: JFSIII Date: Sat, 18 Jun 2011 11:23:26 -0400 Subject: [PATCH 085/151] Update theme to use the already escaped colors added in 46b8d27815583c1b79ef9f0b27f9b39680baa114 --- themes/rainbowbrite/rainbowbrite.theme.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/rainbowbrite/rainbowbrite.theme.bash b/themes/rainbowbrite/rainbowbrite.theme.bash index 581fca4a..5f91705c 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)$(rvm_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)$(rvm_version_prompt) $black\$$reset_color " PS2='> ' PS4='+ ' } From ccab485f742536bfdf109ffd97c24d064d92d697 Mon Sep 17 00:00:00 2001 From: JFSIII Date: Sat, 18 Jun 2011 11:55:22 -0400 Subject: [PATCH 086/151] Reverting alterations introduced in 3dc46203205f89195d29be5cf079f2e31669e77d Moved SCM_NON_CHAR change to theme since it is theme-specific and shouldn't affect all themes. --- themes/base.theme.bash | 2 +- themes/rainbowbrite/rainbowbrite.theme.bash | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index bd29a424..71b11aeb 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -15,7 +15,7 @@ SCM_HG_CHAR='☿' SVN='svn' SCM_SVN_CHAR='⑆' -SCM_NONE_CHAR='·' +SCM_NONE_CHAR='○' RVM_THEME_PROMPT_PREFIX=' |' RVM_THEME_PROMPT_SUFFIX='|' diff --git a/themes/rainbowbrite/rainbowbrite.theme.bash b/themes/rainbowbrite/rainbowbrite.theme.bash index 5f91705c..e4424bbe 100644 --- a/themes/rainbowbrite/rainbowbrite.theme.bash +++ b/themes/rainbowbrite/rainbowbrite.theme.bash @@ -20,6 +20,7 @@ prompt_setter() { PROMPT_COMMAND=prompt_setter +SCM_NONE_CHAR='·' SCM_THEME_PROMPT_DIRTY=" ${red}✗" SCM_THEME_PROMPT_CLEAN=" ${green}✓" SCM_THEME_PROMPT_PREFIX=" (" From 758c57621a59f4e3b8344faaae39bf00bcee107a Mon Sep 17 00:00:00 2001 From: Ryan Kanno Date: Sat, 18 Jun 2011 10:07:26 -1000 Subject: [PATCH 087/151] Removed variables specific to hawaii50 theme :) --- themes/base.theme.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 71b11aeb..feee64e8 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -93,7 +93,7 @@ function hg_prompt_info() { branch=$(hg summary 2> /dev/null | grep branch | awk '{print $2}') changeset=$(hg summary 2> /dev/null | grep parent | awk '{print $2}') - echo -e "$prefix${REF_COLOR}${branch}${DEFAULT_COLOR}:${changeset#*:}$state$suffix" + echo -e "$prefix$branch:${changeset#*:}$state$suffix" } function rvm_version_prompt { From 5e75b130766c1fd9a7f9af549e673704b47dc26b Mon Sep 17 00:00:00 2001 From: JFSIII Date: Sat, 18 Jun 2011 16:11:53 -0400 Subject: [PATCH 088/151] reverting d22a4cfa7058b224e37dbf07aa7cd3c583fdd188 --- plugins/available/jekyll.plugins.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/available/jekyll.plugins.bash b/plugins/available/jekyll.plugins.bash index 3b96f451..aebe69bc 100644 --- a/plugins/available/jekyll.plugins.bash +++ b/plugins/available/jekyll.plugins.bash @@ -26,7 +26,7 @@ editpost() { fi } -jknewpost() { +newpost() { # 'builtin cd' into the local jekyll root From 11b595516167927b70d182ab8d38257c9e86cfc3 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Mon, 20 Jun 2011 16:13:34 -0400 Subject: [PATCH 089/151] Revert "move garb into git plugins; rename newpost as jknewpost" This reverts commit d22a4cfa7058b224e37dbf07aa7cd3c583fdd188. --- aliases/available/git.aliases.bash | 7 +++++++ plugins/available/git.plugins.bash | 8 +------- plugins/available/jekyll.plugins.bash | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/aliases/available/git.aliases.bash b/aliases/available/git.aliases.bash index 7cfc9d93..3a5d2a9f 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -39,6 +39,13 @@ case $OSTYPE in ;; esac +# git add remote branch +function garb() { + echo "Adding remote branch '$1'"; + git config branch.$1.remote origin; + git config branch.$1.merge refs/heads/$1; +} + function git-help() { echo "Git Custom Aliases Usage" echo diff --git a/plugins/available/git.plugins.bash b/plugins/available/git.plugins.bash index 3fbdac61..b0b9ce8c 100644 --- a/plugins/available/git.plugins.bash +++ b/plugins/available/git.plugins.bash @@ -5,13 +5,6 @@ function git_remote { git remote add origin $GIT_HOSTING:$1.git } -# git add remote branch -function garb() { - echo "Adding remote branch '$1'"; - git config branch.$1.remote origin; - git config branch.$1.merge refs/heads/$1; -} - function git_first_push { echo "Running: git push origin master:refs/heads/master" git push origin master:refs/heads/master @@ -99,3 +92,4 @@ else echo "you're currently not in a git repository" fi } + diff --git a/plugins/available/jekyll.plugins.bash b/plugins/available/jekyll.plugins.bash index 3b96f451..aebe69bc 100644 --- a/plugins/available/jekyll.plugins.bash +++ b/plugins/available/jekyll.plugins.bash @@ -26,7 +26,7 @@ editpost() { fi } -jknewpost() { +newpost() { # 'builtin cd' into the local jekyll root From 4a8e08e7832fe4480ca4bf9db7a7778dc0478400 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Mon, 20 Jun 2011 16:13:59 -0400 Subject: [PATCH 090/151] Revert "Add various aliases" This reverts commit 3ef689f29a777f8a076b4a7032ca46f4ba331106. --- aliases/available/general.aliases.bash | 9 --------- aliases/available/git.aliases.bash | 7 +------ aliases/available/jekyll.aliases.bash | 3 --- aliases/available/osx.aliases.bash | 1 - 4 files changed, 1 insertion(+), 19 deletions(-) diff --git a/aliases/available/general.aliases.bash b/aliases/available/general.aliases.bash index 2ed9d134..79bd7aa0 100644 --- a/aliases/available/general.aliases.bash +++ b/aliases/available/general.aliases.bash @@ -46,15 +46,6 @@ alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'" alias md='mkdir -p' alias rd=rmdir -# show / hide hidden files -alias showhidden="defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder" -alias hidehidden="defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder" -# display IP address -alias myip="echo ethernet:; ipconfig getifaddr en0; echo wireless:; ipconfig getifaddr en1" - -# http://snippets.dzone.com/posts/show/2486 -alias killsvn="find . -name ".svn" -type d -exec rm -rf {} \;" - function aliases-help() { echo "Generic Alias Usage" echo diff --git a/aliases/available/git.aliases.bash b/aliases/available/git.aliases.bash index 3a5d2a9f..45d7d05f 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -39,12 +39,7 @@ case $OSTYPE in ;; esac -# git add remote branch -function garb() { - echo "Adding remote branch '$1'"; - git config branch.$1.remote origin; - git config branch.$1.merge refs/heads/$1; -} + function git-help() { echo "Git Custom Aliases Usage" diff --git a/aliases/available/jekyll.aliases.bash b/aliases/available/jekyll.aliases.bash index feaf245a..e52c0351 100644 --- a/aliases/available/jekyll.aliases.bash +++ b/aliases/available/jekyll.aliases.bash @@ -18,6 +18,3 @@ alias buildsite="builtin cd $JEKYLL_LOCAL_ROOT && rm -rf _site/ && jekyll" # Rsync the site to the remote server alias deploysite="builtin cd $JEKYLL_LOCAL_ROOT && rsync -rz _site/ $JEKYLL_REMOTE_ROOT" - -alias jkas="jekyll --auto --server" -alias rmjkas="rm -rf _site/* && jkas" \ No newline at end of file diff --git a/aliases/available/osx.aliases.bash b/aliases/available/osx.aliases.bash index d25c0511..e0746952 100644 --- a/aliases/available/osx.aliases.bash +++ b/aliases/available/osx.aliases.bash @@ -14,7 +14,6 @@ alias dashcode="open -a dashcode" alias f='open -a Finder ' alias textedit='open -a TextEdit' alias hex='open -a "Hex Fiend"' -alias gitx="open -a GitX" if [ -s /usr/bin/firefox ] ; then unalias firefox From e115b4c5af234558e062a1ccd9c0db8d91402a60 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Tue, 21 Jun 2011 09:20:40 -0500 Subject: [PATCH 091/151] Move auto-complete code over to available -> enabled style This continues the move toward the ability to turn things off with everything turned on by default. --- bash_it.sh | 8 +++++++- completion/{ => available}/brew.completion.bash | 0 completion/{ => available}/git.completion.bash | 0 completion/{ => available}/git_flow.completion.bash | 0 completion/{ => available}/rake.completion.bash | 0 completion/{ => available}/ssh.completion.bash | 0 completion/{ => available}/todo.completion.bash | 0 7 files changed, 7 insertions(+), 1 deletion(-) rename completion/{ => available}/brew.completion.bash (100%) rename completion/{ => available}/git.completion.bash (100%) rename completion/{ => available}/git_flow.completion.bash (100%) rename completion/{ => available}/rake.completion.bash (100%) rename completion/{ => available}/ssh.completion.bash (100%) rename completion/{ => available}/todo.completion.bash (100%) diff --git a/bash_it.sh b/bash_it.sh index b52ff97f..68f3884d 100644 --- a/bash_it.sh +++ b/bash_it.sh @@ -17,8 +17,14 @@ do source $config_file done +# TODO: reduce the repetition here by combining these three into a loop # Tab Completion -COMPLETION="${BASH}/completion/*.bash" +if [ ! -d "${BASH}/completion/enabled" ] +then + mkdir "${BASH}/completion/enabled" + ln -s ${BASH}/completion/available/* "${BASH}/completion/enabled" +fi +COMPLETION="${BASH}/completion/enabled/*.bash" for config_file in $COMPLETION do source $config_file diff --git a/completion/brew.completion.bash b/completion/available/brew.completion.bash similarity index 100% rename from completion/brew.completion.bash rename to completion/available/brew.completion.bash diff --git a/completion/git.completion.bash b/completion/available/git.completion.bash similarity index 100% rename from completion/git.completion.bash rename to completion/available/git.completion.bash diff --git a/completion/git_flow.completion.bash b/completion/available/git_flow.completion.bash similarity index 100% rename from completion/git_flow.completion.bash rename to completion/available/git_flow.completion.bash diff --git a/completion/rake.completion.bash b/completion/available/rake.completion.bash similarity index 100% rename from completion/rake.completion.bash rename to completion/available/rake.completion.bash diff --git a/completion/ssh.completion.bash b/completion/available/ssh.completion.bash similarity index 100% rename from completion/ssh.completion.bash rename to completion/available/ssh.completion.bash diff --git a/completion/todo.completion.bash b/completion/available/todo.completion.bash similarity index 100% rename from completion/todo.completion.bash rename to completion/available/todo.completion.bash From 1f0594b7d1e3fb948f53e76ade95e17f729b8804 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Tue, 21 Jun 2011 09:22:24 -0500 Subject: [PATCH 092/151] update to ignore all "enabled" files --- .gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 33e5fca9..32e62dec 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ -aliases/enabled -plugins/enabled +*/enabled/* .DS_Store custom/*.bash !custom/example.bash From d7cfa8b394dcd652e6b1656e22d69ac235d104b0 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Tue, 21 Jun 2011 09:31:26 -0500 Subject: [PATCH 093/151] Switch to single loop now that all directory use the same pattern Simple refactoring -- now there's no need to source each one independently. --- bash_it.sh | 47 +++++++++++++---------------------------------- 1 file changed, 13 insertions(+), 34 deletions(-) diff --git a/bash_it.sh b/bash_it.sh index 68f3884d..a030069e 100644 --- a/bash_it.sh +++ b/bash_it.sh @@ -17,43 +17,22 @@ do source $config_file done -# TODO: reduce the repetition here by combining these three into a loop -# Tab Completion -if [ ! -d "${BASH}/completion/enabled" ] -then - mkdir "${BASH}/completion/enabled" - ln -s ${BASH}/completion/available/* "${BASH}/completion/enabled" -fi -COMPLETION="${BASH}/completion/enabled/*.bash" -for config_file in $COMPLETION +# Load enabled aliases, completion, plugins +for file_type in "aliases" "completion" "plugins" do - source $config_file -done - -# Plugins -if [ ! -d "${BASH}/plugins/enabled" ] -then - mkdir "${BASH}/plugins/enabled" - ln -s ${BASH}/plugins/available/* "${BASH}/plugins/enabled" -fi -PLUGINS="${BASH}/plugins/enabled/*.bash" -for config_file in $PLUGINS -do - source $config_file -done - -# Aliases -if [ ! -d "${BASH}/aliases/enabled" ] -then - mkdir "${BASH}/aliases/enabled" - ln -s ${BASH}/aliases/available/* "${BASH}/aliases/enabled" -fi -FUNCTIONS="${BASH}/aliases/enabled/*.bash" -for config_file in $FUNCTIONS -do - source $config_file + if [ ! -d "${BASH}/${file_type}/enabled" ] + then + mkdir "${BASH}/${file_type}/enabled" + ln -s ${BASH}/${file_type}/available/* "${BASH}/${file_type}/enabled" + fi + FILES="${BASH}/${file_type}/enabled/*.bash" + for config_file in $FILES + do + source $config_file + done done +# Load any custom aliases that the user has added if [ -e "${BASH}/aliases/custom.aliases.bash" ] then source "${BASH}/aliases/custom.aliases.bash" From b36d86ddff8f83c691e761d1f9a9789ca8d52fbd Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Fri, 24 Jun 2011 11:36:11 -0500 Subject: [PATCH 094/151] Add minimal-git theme Just like the minimal theme, but with git info --- themes/minimal-git/minimal-git.theme.bash | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 themes/minimal-git/minimal-git.theme.bash diff --git a/themes/minimal-git/minimal-git.theme.bash b/themes/minimal-git/minimal-git.theme.bash new file mode 100644 index 00000000..1862f7ff --- /dev/null +++ b/themes/minimal-git/minimal-git.theme.bash @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +SCM_THEME_PROMPT_PREFIX="${cyan}(${green}" +SCM_THEME_PROMPT_SUFFIX="${cyan})" +SCM_THEME_PROMPT_DIRTY=" ${red}✗" +SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓" + +PS1="$(scm_prompt_info)${reset_color} ${cyan}\W${reset_color} " From 989de733309ef79308b3806268ad35467f7ee9b8 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Fri, 24 Jun 2011 12:06:30 -0500 Subject: [PATCH 095/151] No more bold --- themes/minimal-git/minimal-git.theme.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/minimal-git/minimal-git.theme.bash b/themes/minimal-git/minimal-git.theme.bash index 1862f7ff..b4c34627 100644 --- a/themes/minimal-git/minimal-git.theme.bash +++ b/themes/minimal-git/minimal-git.theme.bash @@ -3,6 +3,6 @@ SCM_THEME_PROMPT_PREFIX="${cyan}(${green}" SCM_THEME_PROMPT_SUFFIX="${cyan})" SCM_THEME_PROMPT_DIRTY=" ${red}✗" -SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓" +SCM_THEME_PROMPT_CLEAN=" ${green}✓" PS1="$(scm_prompt_info)${reset_color} ${cyan}\W${reset_color} " From 4e14eefca83e7386e02aa1013b11353583c5a134 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Fri, 24 Jun 2011 12:08:36 -0500 Subject: [PATCH 096/151] Works now --- themes/minimal-git/minimal-git.theme.bash | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/themes/minimal-git/minimal-git.theme.bash b/themes/minimal-git/minimal-git.theme.bash index b4c34627..76cb24d5 100644 --- a/themes/minimal-git/minimal-git.theme.bash +++ b/themes/minimal-git/minimal-git.theme.bash @@ -5,4 +5,8 @@ SCM_THEME_PROMPT_SUFFIX="${cyan})" SCM_THEME_PROMPT_DIRTY=" ${red}✗" SCM_THEME_PROMPT_CLEAN=" ${green}✓" -PS1="$(scm_prompt_info)${reset_color} ${cyan}\W${reset_color} " +prompt() { + PS1="$(scm_prompt_info)${reset_color} ${cyan}\W${reset_color} " +} + +PROMPT_COMMAND=prompt From 5af99be158656bbcb5f4d56fb799e3313837bb53 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Fri, 24 Jun 2011 17:45:13 -0500 Subject: [PATCH 097/151] Get rid of old jekyll aliases --- aliases/available/jekyll.aliases.bash | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 aliases/available/jekyll.aliases.bash diff --git a/aliases/available/jekyll.aliases.bash b/aliases/available/jekyll.aliases.bash deleted file mode 100644 index e52c0351..00000000 --- a/aliases/available/jekyll.aliases.bash +++ /dev/null @@ -1,20 +0,0 @@ -# Open the root of your site in your vim or builtin cd to it - -if [[ $EDITOR = "vim" ]] -then - alias newentry="builtin cd $JEKYLL_LOCAL_ROOT && $EDITOR ." -else - alias newentry="builtin cd $JEKYLL_LOCAL_ROOT" -fi - -# Build and locally serve the site - -alias testsite="builtin cd $JEKYLL_LOCAL_ROOT && jekyll --server --auto" - -# Build but don't locally serve the site - -alias buildsite="builtin cd $JEKYLL_LOCAL_ROOT && rm -rf _site/ && jekyll" - -# Rsync the site to the remote server - -alias deploysite="builtin cd $JEKYLL_LOCAL_ROOT && rsync -rz _site/ $JEKYLL_REMOTE_ROOT" From 10ac7731703eaeecc9b4fb3d7e601569cbe5c980 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Fri, 24 Jun 2011 17:45:37 -0500 Subject: [PATCH 098/151] Get rid of old, unneeded jekyll config stuff --- template/bash_profile.template.bash | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/template/bash_profile.template.bash b/template/bash_profile.template.bash index 30ab0fc1..95f481e9 100644 --- a/template/bash_profile.template.bash +++ b/template/bash_profile.template.bash @@ -26,18 +26,6 @@ export NGINX_PATH='/opt/nginx' # Don't check mail when opening terminal. unset MAILCHECK -# Change this to the path of your local jekyll root to use the jekyll aliases - -export JEKYLL_LOCAL_ROOT="$HOME/Sites/jekyllsite" - -# And change this to the remote server and root - -export JEKYLL_REMOTE_ROOT="user@server:/path/to/jekyll/root" - -# And, for the last of the jekyll variables, this is the formatting you use, eg: markdown, -# textile, etc. Basically whatever you use as the extension for posts, without the preceding dot - -export JEKYLL_FORMATTING="markdown" # Change this to your console based IRC client of choice. From 56b83c76cbc1b8d257103982563a6690e36068a0 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Fri, 24 Jun 2011 17:45:55 -0500 Subject: [PATCH 099/151] Add new jekyll config stuff --- template/jekyllconfig.template.bash | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 template/jekyllconfig.template.bash diff --git a/template/jekyllconfig.template.bash b/template/jekyllconfig.template.bash new file mode 100644 index 00000000..e4705181 --- /dev/null +++ b/template/jekyllconfig.template.bash @@ -0,0 +1,17 @@ +# This is a space-delimited list of your Jekyll project paths + +SITES="$HOME/sites/project_1 $HOME/sites/project_2" + +# This is another space-delimited list. +# This one is of the remote user@host:path location of your jekyll site +# NOTE: The locations of these must correspond to the locations +# of the sites in the first list +# For instance, the host for the first Jekyll site +# must be first in this list, the second second, etc. + +REMOTES="user@host_1:path user@host_2:path" + +# list of markup syntaxes to use for the sites, +# Same rules as above. Can be HTML, textile, or markdown + +MARKUPS="markdown textile" From 9ad7964c861504d9ef030dd11742d5dc00e4320a Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Fri, 24 Jun 2011 17:49:19 -0500 Subject: [PATCH 100/151] Add support for multiple Jekyll sites --- bash_it.sh | 7 + plugins/available/jekyll.plugins.bash | 448 +++++++++++++++++--------- 2 files changed, 300 insertions(+), 155 deletions(-) diff --git a/bash_it.sh b/bash_it.sh index a030069e..7734c10c 100644 --- a/bash_it.sh +++ b/bash_it.sh @@ -56,6 +56,13 @@ PREVIEW="less" [ -s /usr/bin/gloobus-preview ] && PREVIEW="gloobus-preview" [ -s /Applications/Preview.app ] && PREVIEW="/Applications/Preview.app" +# Load all the Jekyll stuff + +if [ -e $HOME/.jekyllconfig ] +then + . $HOME/.jekyllconfig +fi + # # Custom Help diff --git a/plugins/available/jekyll.plugins.bash b/plugins/available/jekyll.plugins.bash index aebe69bc..8efdd11f 100644 --- a/plugins/available/jekyll.plugins.bash +++ b/plugins/available/jekyll.plugins.bash @@ -1,208 +1,346 @@ #!/bin/bash editpost() { - builtin cd "$JEKYLL_LOCAL_ROOT/_posts" + unset SITE + if [ -z "$1" ] + then + echo "Error: no site specified." + echo "The site is the name of the directory your project is in." + return 1 + fi - COUNTER=1 - NUMBER="$RANDOM" - TMPFILE="/tmp/editpost-$NUMBER" + for site in ${SITES[@]} + do + if [ "$(basename $site)" = "$1" ] + then + SITE=$site + break + fi + done - for POST in * - do - DATE=`echo $POST | grep -oE "[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}"` - TITLE=`cat $POST | grep -oE "title: (.+)"` - TITLE=`echo $TITLE | sed 's/title: //'` - echo "$COUNTER) $DATE $TITLE" >> "$TMPFILE" - POSTS[$COUNTER]=$POST - COUNTER=`expr $COUNTER + 1` - done - less $TMPFILE - read -p "Number of post to edit: " POST_TO_EDIT - if [ -z "$EDITOR" ] - then - nano "${POSTS[$POST_TO_EDIT]}" - else - "$EDITOR" "${POSTS[$POST_TO_EDIT]}" - fi + if [ -z "$SITE" ] + then + echo "No such site." + return 1 + fi + + builtin cd "$SITE/_posts" + + COUNTER=1 + NUMBER="$RANDOM" + TMPFILE="/tmp/editpost-$NUMBER" + + for POST in * + do + DATE=`echo $POST | grep -oE "[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}"` + TITLE=`cat $POST | grep -oE "title: (.+)"` + TITLE=`echo $TITLE | sed 's/title: //'` + echo "$COUNTER) $DATE $TITLE" >> "$TMPFILE" + POSTS[$COUNTER]=$POST + COUNTER=`expr $COUNTER + 1` + done + less $TMPFILE + read -p "Number of post to edit: " POST_TO_EDIT + if [ -z "$EDITOR" ] + then + nano "${POSTS[$POST_TO_EDIT]}" + else + "$EDITOR" "${POSTS[$POST_TO_EDIT]}" + fi } newpost() { + unset SITE + if [ -z "$1" ] + then + echo "Error: no site specified." + echo "The site is the name of the directory your project is in." + return 1 + fi - # 'builtin cd' into the local jekyll root + if [ -z "$SITE" ] + then + echo "No such site." + return 1 + fi - builtin cd "$JEKYLL_LOCAL_ROOT/_posts" + loc=0 - # Get the date for the new post's filename + for site in ${SITES[@]} + do + if [ "$(basename $site)" = "$1" ] + then + SITE=$site + JEKYLL_FORMATTING=${MARKUPS[$loc]} + break + fi + loc=$(($loc+1)) + done - FNAME_DATE=$(date "+%Y-%m-%d") + # 'builtin cd' into the local jekyll root - # If the user is using markdown formatting, let them choose what type of post they want. Sort of like Tumblr. + builtin cd "$SITE/_posts" - OPTIONS="Text Quote Image Audio Video Link" - - if [ $JEKYLL_FORMATTING = "markdown" -o $JEKYLL_FORMATTING = "textile" ] - then - select OPTION in $OPTIONS - do - if [[ $OPTION = "Text" ]] - then - POST_TYPE="Text" - break - fi + # Get the date for the new post's filename - if [[ $OPTION = "Quote" ]] - then - POST_TYPE="Quote" - break - fi - - if [[ $OPTION = "Image" ]] - then - POST_TYPE="Image" - break - fi + FNAME_DATE=$(date "+%Y-%m-%d") - if [[ $OPTION = "Audio" ]] - then - POST_TYPE="Audio" - break - fi + # If the user is using markdown or textile formatting, let them choose what type of post they want. Sort of like Tumblr. - if [[ $OPTION = "Video" ]] - then - POST_TYPE="Video" - break - fi + OPTIONS="Text Quote Image Audio Video Link" - if [[ $OPTION = "Link" ]] - then - POST_TYPE="Link" - break - fi - done - fi + if [ $JEKYLL_FORMATTING = "markdown" -o $JEKYLL_FORMATTING = "textile" ] + then + select OPTION in $OPTIONS + do + if [[ $OPTION = "Text" ]] + then + POST_TYPE="Text" + break + fi - # Get the title for the new post + if [[ $OPTION = "Quote" ]] + then + POST_TYPE="Quote" + break + fi - read -p "Enter title of the new post: " POST_TITLE + if [[ $OPTION = "Image" ]] + then + POST_TYPE="Image" + break + fi - # Convert the spaces in the title to hyphens for use in the filename + if [[ $OPTION = "Audio" ]] + then + POST_TYPE="Audio" + break + fi - FNAME_POST_TITLE=`echo $POST_TITLE | tr ' ' "-"` + if [[ $OPTION = "Video" ]] + then + POST_TYPE="Video" + break + fi - # Now, put it all together for the full filename + if [[ $OPTION = "Link" ]] + then + POST_TYPE="Link" + break + fi + done + fi - FNAME="$FNAME_DATE-$FNAME_POST_TITLE.$JEKYLL_FORMATTING" + # Get the title for the new post - # And, finally, create the actual post file. But we're not done yet... + read -p "Enter title of the new post: " POST_TITLE - touch "$FNAME" + # Convert the spaces in the title to hyphens for use in the filename - # Write a little stuff to the file for the YAML Front Matter + FNAME_POST_TITLE=`echo $POST_TITLE | tr ' ' "-"` - echo "---" >> $FNAME + # Now, put it all together for the full filename - # Now we have to get the date, again. But this time for in the header (YAML Front Matter) of - # the file + FNAME="$FNAME_DATE-$FNAME_POST_TITLE.$JEKYLL_FORMATTING" - YAML_DATE=$(date "+%B %d %Y %X") + # And, finally, create the actual post file. But we're not done yet... - # Echo the YAML Formatted date to the post file + touch "$FNAME" - echo "date: $YAML_DATE" >> $FNAME + # Write a little stuff to the file for the YAML Front Matter - # Echo the original post title to the YAML Front Matter header + echo "---" >> $FNAME - echo "title: $POST_TITLE" >> $FNAME + # Now we have to get the date, again. But this time for in the header (YAML Front Matter) of + # the file - # And, now, echo the "post" layout to the YAML Front Matter header + YAML_DATE=$(date "+%B %d %Y %X") - echo "layout: post" >> $FNAME + # Echo the YAML Formatted date to the post file - # Close the YAML Front Matter Header + echo "date: $YAML_DATE" >> $FNAME - echo "---" >> $FNAME - echo >> $FNAME + # Echo the original post title to the YAML Front Matter header - # Generate template text based on the post type + echo "title: $POST_TITLE" >> $FNAME - if [[ $JEKYLL_FORMATTING = "markdown" ]] - then - if [[ $POST_TYPE = "Text" ]] - then - true - fi + # And, now, echo the "post" layout to the YAML Front Matter header - if [[ $POST_TYPE = "Quote" ]] - then - echo "> Quote" >> $FNAME - echo >> $FNAME - echo "— Author" >> $FNAME - fi + echo "layout: post" >> $FNAME - if [[ $POST_TYPE = "Image" ]] - then - echo "![Alternate Text](/path/to/image/or/url)" >> $FNAME - fi + # Close the YAML Front Matter Header - if [[ $POST_TYPE = "Audio" ]] - then - echo "" >> $FNAME - fi + echo "---" >> $FNAME + echo >> $FNAME - if [[ $POST_TYPE = "Video" ]] - then - echo "" >> $FNAME - fi - - if [[ $POST_TYPE = "Link" ]] - then - echo "[link][1]" >> $FNAME - echo >> $FNAME - echo "> Quote" >> $FNAME - echo >> $FNAME - echo "[1]: url" >> $FNAME - fi - fi + # Generate template text based on the post type - if [[ $JEKYLL_FORMATTING = "textile" ]] - then - if [[ $POST_TYPE = "Text" ]] - then - true - fi + if [[ $JEKYLL_FORMATTING = "markdown" ]] + then + if [[ $POST_TYPE = "Text" ]] + then + true + fi - if [[ $POST_TYPE = "Quote" ]] - then - echo "bq. Quote" >> $FNAME - echo >> $FNAME - echo "— Author" >> $FNAME - fi + if [[ $POST_TYPE = "Quote" ]] + then + echo "> Quote" >> $FNAME + echo >> $FNAME + echo "— Author" >> $FNAME + fi - if [[ $POST_TYPE = "Image" ]] - then - echo "!url(alt text)" >> $FNAME - fi + if [[ $POST_TYPE = "Image" ]] + then + echo "![Alternate Text](/path/to/image/or/url)" >> $FNAME + fi - if [[ $POST_TYPE = "Audio" ]] - then - echo "" >> $FNAME - fi + if [[ $POST_TYPE = "Audio" ]] + then + echo "" >> $FNAME + fi - if [[ $POST_TYPE = "Video" ]] - then - echo "" >> $FNAME - fi + if [[ $POST_TYPE = "Video" ]] + then + echo "" >> $FNAME + fi - if [[ $POST_TYPE = "Link" ]] - then - echo "\"Site\":url" >> $FNAME - echo >> $FNAME - echo "bq. Quote" >> $FNAME - fi - fi + if [[ $POST_TYPE = "Link" ]] + then + echo "[link][1]" >> $FNAME + echo >> $FNAME + echo "> Quote" >> $FNAME + echo >> $FNAME + echo "[1]: url" >> $FNAME + fi + fi - # Open the file in your favorite editor + if [[ $JEKYLL_FORMATTING = "textile" ]] + then + if [[ $POST_TYPE = "Text" ]] + then + true + fi - "$EDITOR" $FNAME + if [[ $POST_TYPE = "Quote" ]] + then + echo "bq. Quote" >> $FNAME + echo >> $FNAME + echo "— Author" >> $FNAME + fi + + if [[ $POST_TYPE = "Image" ]] + then + echo "!url(alt text)" >> $FNAME + fi + + if [[ $POST_TYPE = "Audio" ]] + then + echo "" >> $FNAME + fi + + if [[ $POST_TYPE = "Video" ]] + then + echo "" >> $FNAME + fi + + if [[ $POST_TYPE = "Link" ]] + then + echo "\"Site\":url" >> $FNAME + echo >> $FNAME + echo "bq. Quote" >> $FNAME + fi + fi + + # Open the file in your favorite editor + + "$EDITOR" $FNAME +} + +function testsite() { + unset SITE + if [ -z "$1" ] + then + echo "Error: no site specified." + echo "The site is the name of the directory your project is in." + return 1 + fi + + for site in ${SITES[@]} + do + if [ "$(basename $site)" = "$1" ] + then + SITE=$site + break + fi + done + + if [ -z "$SITE" ] + then + echo "No such site." + return 1 + fi + + builtin cd $SITE + jekyll --server --auto +} + +function buildsite() { + unset SITE + if [ -z "$1" ] + then + echo "Error: no site specified." + echo "The site is the name of the directory your project is in." + return 1 + fi + + for site in ${SITES[@]} + do + if [ "$(basename $site)" = "$1" ] + then + SITE=$site + break + fi + done + + if [ -z "$SITE" ] + then + echo "No such site." + return 1 + fi + + builtin cd $SITE + rm -rf _site + jekyll --no-server +} + +function deploysite() { + unset SITE + if [ -z "$1" ] + then + echo "Error: no site specified." + echo "The site is the name of the directory your project is in." + return 1 + fi + + loc=0 + + for site in ${SITES[@]} + do + if [ "$(basename $site)" = "$1" ] + then + SITE=$site + REMOTE=${REMOTES[$loc]} + break + fi + loc=$(($loc+1)) + done + + if [ -z "$SITE" ] + then + echo "No such site." + return 1 + fi + + builtin cd $SITE + rsync -rz $REMOTE } From 4ac4049a7595e1d694e7283dba7714e5aff14569 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Fri, 24 Jun 2011 17:50:02 -0500 Subject: [PATCH 101/151] Add note for configuring Jekyll support --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index c8412c92..5af3056e 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,14 @@ Check a clone of this repo. You can view what a sample `~/.bash_profile` looks l cp ~/.bash_profile ~/.bash_profile_original cp /template/bash_profile.template.bash ~/.bash_profile +To configure Jekyll support for bash it, move the +jekyllconfig.template.bash to your home directory: + + cp /template/jekyllconfig.template.bash ~/.jekyllconfig + +Be sure to edit this file to your needed specifications. Please note +that this file is *not* required. Only use it if you plan on using the +jekyll plugins. ## Help Screens From 6e8733ea98d09ca5d87f07a9e4a1b696b2a6fe0e Mon Sep 17 00:00:00 2001 From: Jeff Carouth Date: Sat, 25 Jun 2011 10:05:25 -0500 Subject: [PATCH 102/151] Adding multiple SCM support to doubletime theme. The doubletime theme improves the SCM status prompt for git. However, it accomplishes this at the expense of other SCM systems. This delegates prompt to the default bash-it prompt function when the SCM is not git. --- themes/doubletime/doubletime.theme.bash | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/themes/doubletime/doubletime.theme.bash b/themes/doubletime/doubletime.theme.bash index 1237f80f..e16ba66c 100644 --- a/themes/doubletime/doubletime.theme.bash +++ b/themes/doubletime/doubletime.theme.bash @@ -17,11 +17,12 @@ fi doubletime_scm_prompt() { CHAR=$(scm_char) - if [ $CHAR = $SCM_NONE_CHAR ] - then + if [ $CHAR = $SCM_NONE_CHAR ]; then return - else + elif [ $CHAR = $SCM_GIT_CHAR ]; then echo "$(git_prompt_status)" + else + echo "[$(scm_prompt_info)]" fi } From ff0859d28966035e310277ef3e8701b1fe119d80 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Sat, 25 Jun 2011 11:50:56 -0500 Subject: [PATCH 103/151] Move minimal-git theme into minimal theme --- themes/minimal/minimal.theme.bash | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/themes/minimal/minimal.theme.bash b/themes/minimal/minimal.theme.bash index 8de4a6c7..76cb24d5 100644 --- a/themes/minimal/minimal.theme.bash +++ b/themes/minimal/minimal.theme.bash @@ -1,7 +1,12 @@ -prompt_setter() { - PS1="${cyan}\W${normal} " +#!/usr/bin/env bash + +SCM_THEME_PROMPT_PREFIX="${cyan}(${green}" +SCM_THEME_PROMPT_SUFFIX="${cyan})" +SCM_THEME_PROMPT_DIRTY=" ${red}✗" +SCM_THEME_PROMPT_CLEAN=" ${green}✓" + +prompt() { + PS1="$(scm_prompt_info)${reset_color} ${cyan}\W${reset_color} " } -PROMPT_COMMAND=prompt_setter - -export PS3=">> " +PROMPT_COMMAND=prompt From 052da726df55cf7019b08f897d3d3dc1371d2d85 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Sat, 25 Jun 2011 11:52:50 -0500 Subject: [PATCH 104/151] Get rid of old minimal-git theme --- themes/minimal-git/minimal-git.theme.bash | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 themes/minimal-git/minimal-git.theme.bash diff --git a/themes/minimal-git/minimal-git.theme.bash b/themes/minimal-git/minimal-git.theme.bash deleted file mode 100644 index 76cb24d5..00000000 --- a/themes/minimal-git/minimal-git.theme.bash +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -SCM_THEME_PROMPT_PREFIX="${cyan}(${green}" -SCM_THEME_PROMPT_SUFFIX="${cyan})" -SCM_THEME_PROMPT_DIRTY=" ${red}✗" -SCM_THEME_PROMPT_CLEAN=" ${green}✓" - -prompt() { - PS1="$(scm_prompt_info)${reset_color} ${cyan}\W${reset_color} " -} - -PROMPT_COMMAND=prompt From 93df02f19389151f9bc5f0420024605289081f63 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Sun, 26 Jun 2011 09:30:16 -0500 Subject: [PATCH 105/151] Fix irregular usage of bash it vs. bash-it --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5af3056e..e5c7aae2 100644 --- a/README.md +++ b/README.md @@ -42,13 +42,13 @@ and anything in the custom directory will be ignored with the exception of `cust ## Themes -There are a few bash-it themes, but I'm hoping the community will jump in and create their own custom prompts and share their creations with everyone else by submitting a pull request to me (revans). +There are a few bash it themes, but I'm hoping the community will jump in and create their own custom prompts and share their creations with everyone else by submitting a pull request to me (revans). ## Help out -I think all of us have our own custom scripts that we have added over time and so following in the footsteps of oh-my-zsh, bash-it was created as a framework for those who choose to use bash as their shell. As a community, I'm excited to see what everyone else has in their custom toolbox and am hoping that they'll share it with everyone by submitting a pull request to bash-it. +I think all of us have our own custom scripts that we have added over time and so following in the footsteps of oh-my-zsh, bash it was created as a framework for those who choose to use bash as their shell. As a community, I'm excited to see what everyone else has in their custom toolbox and am hoping that they'll share it with everyone by submitting a pull request to bash it. -So, if you have contributions to bash-it, please send me a pull request and I'll take a look at it and commit it to the repo as long as it looks good. If you do change an existing command, please give an explanation as to why. That will help a lot when I merge your changes in. Thanks, and happing bashing! +So, if you have contributions to bash it, please send me a pull request and I'll take a look at it and commit it to the repo as long as it looks good. If you do change an existing command, please give an explanation as to why. That will help a lot when I merge your changes in. Thanks, and happing bashing! ## Contributors From e1eb0114ed1d152d3c32dec8d8a8167817c93ed0 Mon Sep 17 00:00:00 2001 From: Adrian Rego Date: Mon, 27 Jun 2011 20:00:27 -0400 Subject: [PATCH 106/151] relieving headaches with a tylenol theme --- themes/tylenol/tylenol.theme.bash | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 themes/tylenol/tylenol.theme.bash diff --git a/themes/tylenol/tylenol.theme.bash b/themes/tylenol/tylenol.theme.bash new file mode 100644 index 00000000..c915f561 --- /dev/null +++ b/themes/tylenol/tylenol.theme.bash @@ -0,0 +1,20 @@ +#!/bin/bash +# +# Based on 'bobby' theme with the addition of virtualenv_prompt +# + +SCM_THEME_PROMPT_DIRTY=" ${red}✗" +SCM_THEME_PROMPT_CLEAN=" ${green}✓" +SCM_THEME_PROMPT_PREFIX=" ${yellow}|${reset_color}" +SCM_THEME_PROMPT_SUFFIX="${yellow}|" + +RVM_THEME_PROMPT_PREFIX="|" +RVM_THEME_PROMPT_SUFFIX="|" +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} " +} + +PROMPT_COMMAND=prompt_command; From d82d8fbbe8fe0ab67781136177684d34b79d71ca Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Tue, 28 Jun 2011 00:22:43 -0500 Subject: [PATCH 107/151] Add install script --- install.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 install.sh diff --git a/install.sh b/install.sh new file mode 100755 index 00000000..3fc647b4 --- /dev/null +++ b/install.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +cp $HOME/.bash_profile $HOME/.bash_profile.bak + +echo "Your original .bash_profile has been backed up to .bash_profile.bak" + +cp $HOME/.bash_it/template/bash_profile.template.bash $HOME/.bash_profile + +echo "Copied the template .bash_profile into ~/.bash_profile, edit this file to customize bash-it" + +while true +do + read -p "Do you use Jekyll? (If you don't know what Jekyll is, answer 'n') [Y/N] " RESP + + case $RESP + in + [yY]) + cp $HOME/.bash_it/template/jekyllconfig.template.bash $HOME/.jekyllconfig + echo "Copied the template .jekyllconfig into your home directory. Edit this file to customize bash-it for using the Jekyll plugins" + break + ;; + [nN]) + break + ;; + *) + echo "Please enter Y or N" + esac +done From b7c4b36ed247a90636200c4e9610e0a1032d85b9 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Tue, 28 Jun 2011 00:22:51 -0500 Subject: [PATCH 108/151] Add instructions for installing with the installation script --- README.md | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index e5c7aae2..89f3d0d0 100644 --- a/README.md +++ b/README.md @@ -6,21 +6,17 @@ Includes some autocompletion tools, theming support, aliases, custom functions, ## Install -Check a clone of this repo. You can view what a sample `~/.bash_profile` looks like in `template/bash_profile.template.bash`. If you wanted to use that template, make sure to make a backup of your current `~/.bash_profile` file. +Check a clone of this repo: git clone http://github.com/revans/bash-it.git bash_it - cp ~/.bash_profile ~/.bash_profile_original - cp /template/bash_profile.template.bash ~/.bash_profile +Then run the `install.sh` file, it will backup your `~/.bash_profile` +file and move the template one into it's place (the template file is at +`~/.bash_it/template/bash_profile.template.bash`). It will also prompt +you asking if you use [Jekyll](https://github.com/mojombo/jekyll). This +is to set up the `.jekyllconfig` file, the file that stores the +information needed to use the Jekyll plugin supplied with bash it. -To configure Jekyll support for bash it, move the -jekyllconfig.template.bash to your home directory: - - cp /template/jekyllconfig.template.bash ~/.jekyllconfig - -Be sure to edit this file to your needed specifications. Please note -that this file is *not* required. Only use it if you plan on using the -jekyll plugins. ## Help Screens From ed8332d8d4161ff7ffeaa21f2bfe678466f0caa3 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Tue, 28 Jun 2011 00:25:26 -0500 Subject: [PATCH 109/151] Add clarification to README --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 89f3d0d0..933b333c 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,10 @@ Check a clone of this repo: Then run the `install.sh` file, it will backup your `~/.bash_profile` file and move the template one into it's place (the template file is at -`~/.bash_it/template/bash_profile.template.bash`). It will also prompt +`~/.bash_it/template/bash_profile.template.bash`). Be sure to edit this +template file in order to customize bash-it. + +The install script will also prompt you asking if you use [Jekyll](https://github.com/mojombo/jekyll). This is to set up the `.jekyllconfig` file, the file that stores the information needed to use the Jekyll plugin supplied with bash it. From f6950f9f7bcff2b58aff995b4fddde438d1c1a1b Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Wed, 29 Jun 2011 11:33:39 -0500 Subject: [PATCH 110/151] Add gem completion --- completion/available/gem.completion.bash | 41 ++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 completion/available/gem.completion.bash diff --git a/completion/available/gem.completion.bash b/completion/available/gem.completion.bash new file mode 100644 index 00000000..7231eef0 --- /dev/null +++ b/completion/available/gem.completion.bash @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +# Completion for gem + +if [ -z "$REMOTE_GEMS" ] +then + REMOTE_GEMS=( $(gem list --remote --no-versions | tr '\n' ' ') ) +fi + +if [ -z "$LOCAL_GEMS" ] +then + LOCAL_GEMS=( $(gem list --no-versions | sed 's/\*\*\* LOCAL GEMS \*\*\*//' | tr '\n' ' ') ) +fi + +_installcomp() { + local cur=${COMP_WORDS[COMP_CWORD]} + COMPREPLY=( $(compgen -W "${REMOTE_GEMS[*]}" -- $cur) ) +} + +_uninstallcomp() { + local cur=${COMP_WORDS[COMP_CWORD]} + COMPREPLY=( $(compgen -W "${LOCAL_GEMS[*]}" -- $cur) ) +} + +_gem() { + local cur=${COMP_WORDS[COMP_CWORD]} + local prev=${COMP_WORDS[COMP_CWORD-1]} + case $prev in + install) + _installcomp + return 0 + ;; + uninstall) + _uninstallcomp + return 0 + ;; + esac + local commands=(build cert check cleanup contents dependency environment fetch generate_index help install list lock outdated owner pristine push query rdoc search server sources specification stale uninstall unpack update which) + COMPREPLY=( $(compgen -W "${commands[*]}" -- $cur) ) +} + +complete -F _gem gem From 1a969458858a5ad892ab9a6b36592cf50348d162 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Thu, 30 Jun 2011 08:30:46 -0500 Subject: [PATCH 111/151] Fix grammar on error message --- plugins/available/osx.plugin.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/available/osx.plugin.bash b/plugins/available/osx.plugin.bash index e6271bd7..76e4b9a5 100644 --- a/plugins/available/osx.plugin.bash +++ b/plugins/available/osx.plugin.bash @@ -17,7 +17,7 @@ EOF function dock-switch() { if [ $(uname) = "Darwin" ]; then - + if [ $1 = 3d ] ; then defaults write com.apple.dock no-glass -boolean NO killall Dock @@ -28,10 +28,10 @@ function dock-switch() { else echo "usage:" - echo "dock-switch 2d" + echo "dock-switch 2d" echo "dock-switch 3d." fi else - echo "sorry. you're currently not using os x" + echo "Sorry, this only works on Mac OS X" fi } From c5b5a1982f335e34bc20f644f496aa1664a0bf98 Mon Sep 17 00:00:00 2001 From: Tony Date: Thu, 30 Jun 2011 08:15:26 -0700 Subject: [PATCH 112/151] Edited README.md for punctuation, phrasing, tone, and clarity. --- README.md | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 933b333c..f5b9201b 100644 --- a/README.md +++ b/README.md @@ -1,53 +1,53 @@ # Bash it -'Bash it' is a mash up of my own bash commands and scripts, other bash stuff I have found and a shameless ripoff of [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh). :) +**Bash it** is a mash up of my own bash commands and scripts, other bash stuff I have found. -Includes some autocompletion tools, theming support, aliases, custom functions, a few stolen pieces from Steve Losh, and more. +(And a shameless ripoff of [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh). :) + +Includes autocompletion, themes, aliases, custom functions, a few stolen pieces from Steve Losh, and more. ## Install -Check a clone of this repo: +1. Check a clone of this repo: `git clone http://github.com/revans/bash-it.git bash_it` +2. Run `install.sh` (it automatically backs up your `~/.bash_profile`) +3. Move `~/.bash_it/template/bash_profile.template.bash` into its place. (Edit this template file in order to customize bash-it.) - git clone http://github.com/revans/bash-it.git bash_it - -Then run the `install.sh` file, it will backup your `~/.bash_profile` -file and move the template one into it's place (the template file is at -`~/.bash_it/template/bash_profile.template.bash`). Be sure to edit this -template file in order to customize bash-it. - -The install script will also prompt -you asking if you use [Jekyll](https://github.com/mojombo/jekyll). This -is to set up the `.jekyllconfig` file, the file that stores the -information needed to use the Jekyll plugin supplied with bash it. +**NOTE:** +The install script will also prompt you asking if you use [Jekyll](https://github.com/mojombo/jekyll). +This is to set up the `.jekyllconfig` file, which stores info necessary to use the Jekyll plugin. ## Help Screens - bash-it (will show all the help commands) - aliases-help - rails-help - git-help - plugins-help +``` +bash-it (will show all the help commands) +aliases-help +rails-help +git-help +plugins-help +``` ## Your Custom scripts, aliases, and functions -For custom scripts, and aliases, you can create the following files and they will be ignored by the git repo: +For custom scripts, and aliases, just create the following files (they'll be ignored by the git repo): * `aliases/custom.aliases.bash` * `lib/custom.bash` * `plugins/custom.plugins.bash` -and anything in the custom directory will be ignored with the exception of `custom/example.bash`. +Anything in the custom directory will be ignored, with the exception of `custom/example.bash`. ## Themes -There are a few bash it themes, but I'm hoping the community will jump in and create their own custom prompts and share their creations with everyone else by submitting a pull request to me (revans). +There are a few bash it themes. If you've created your own custom prompts, I'd love it if you shared with everyone else! Just submit a Pull Request to me (revans). ## Help out -I think all of us have our own custom scripts that we have added over time and so following in the footsteps of oh-my-zsh, bash it was created as a framework for those who choose to use bash as their shell. As a community, I'm excited to see what everyone else has in their custom toolbox and am hoping that they'll share it with everyone by submitting a pull request to bash it. +I think everyone has their own custom scripts accumulated over time. And so, following in the footsteps of oh-my-zsh, bash it is a framework for easily customizing your bash shell. Everyone's got a custom toolbox, so let's start making them even better, **as a community!** -So, if you have contributions to bash it, please send me a pull request and I'll take a look at it and commit it to the repo as long as it looks good. If you do change an existing command, please give an explanation as to why. That will help a lot when I merge your changes in. Thanks, and happing bashing! +Send me a pull request and I'll merge it as long as it looks good. If you change an existing command, please give an explanation why. That will help a lot when I merge your changes in. + +Thanks, and happing bashing! ## Contributors From a85080c8b0c2acff0190b856b62eff1db0521d58 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Thu, 30 Jun 2011 11:28:32 -0500 Subject: [PATCH 113/151] Fix extra step in install section --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f5b9201b..3a529e3a 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Includes autocompletion, themes, aliases, custom functions, a few stolen pieces 1. Check a clone of this repo: `git clone http://github.com/revans/bash-it.git bash_it` 2. Run `install.sh` (it automatically backs up your `~/.bash_profile`) -3. Move `~/.bash_it/template/bash_profile.template.bash` into its place. (Edit this template file in order to customize bash-it.) +3. Edit your `~/.bash_profile` file in order to customize bash-it. **NOTE:** The install script will also prompt you asking if you use [Jekyll](https://github.com/mojombo/jekyll). From 450a1d1090a5fdc7afc66ad752f87471d2a004d6 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Sat, 2 Jul 2011 21:44:47 -0500 Subject: [PATCH 114/151] Added JEKYLL_EDITOR variable This will replace the default $EDITOR used in the Jekyll plugin --- template/jekyllconfig.template.bash | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/template/jekyllconfig.template.bash b/template/jekyllconfig.template.bash index e4705181..291bf85e 100644 --- a/template/jekyllconfig.template.bash +++ b/template/jekyllconfig.template.bash @@ -15,3 +15,7 @@ REMOTES="user@host_1:path user@host_2:path" # Same rules as above. Can be HTML, textile, or markdown MARKUPS="markdown textile" + +# If you want to use a different editor for Jekyll, change the value of this variable + +JEKYLL_EDITOR="$EDITOR" From e1a299eafba5b6777c2f8234062fc67c8c8790f4 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Sat, 2 Jul 2011 21:44:56 -0500 Subject: [PATCH 115/151] Implement JEKYLL_EDITOR variable --- plugins/available/jekyll.plugins.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/available/jekyll.plugins.bash b/plugins/available/jekyll.plugins.bash index 8efdd11f..eff85ce3 100644 --- a/plugins/available/jekyll.plugins.bash +++ b/plugins/available/jekyll.plugins.bash @@ -41,11 +41,11 @@ editpost() { done less $TMPFILE read -p "Number of post to edit: " POST_TO_EDIT - if [ -z "$EDITOR" ] + if [ -z "$JEKYLL_EDITOR" ] then nano "${POSTS[$POST_TO_EDIT]}" else - "$EDITOR" "${POSTS[$POST_TO_EDIT]}" + "$JEKYLL_EDITOR" "${POSTS[$POST_TO_EDIT]}" fi } @@ -253,7 +253,7 @@ newpost() { # Open the file in your favorite editor - "$EDITOR" $FNAME + "$JEKYLL_EDITOR" $FNAME } function testsite() { From 3a2b525ac65fd06470cb3fed6efdac70b03d4e35 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Thu, 7 Jul 2011 11:04:27 -0500 Subject: [PATCH 116/151] Added prevcurl function Downloads a file and opens it in Preivew.app --- plugins/available/osx.plugin.bash | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugins/available/osx.plugin.bash b/plugins/available/osx.plugin.bash index 76e4b9a5..cf553777 100644 --- a/plugins/available/osx.plugin.bash +++ b/plugins/available/osx.plugin.bash @@ -35,3 +35,14 @@ function dock-switch() { echo "Sorry, this only works on Mac OS X" fi } + +# Download a file and open it in Preview + +function prevcurl() { + if [ ! $(uname) = "Darwin" ] + then + echo "This function only works with Mac OS X" + return 1 + fi + curl "$*" | open -fa "Preview" +} From 86aa9ff36a3f5e9ab3fcdf79b2da23d1b10cae75 Mon Sep 17 00:00:00 2001 From: Ryan Kanno Date: Thu, 7 Jul 2011 22:13:29 -1000 Subject: [PATCH 117/151] ip address can be enabled/disabled (default is enabled) --- themes/hawaii50/hawaii50.theme.bash | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index 21c0b413..1b0a5998 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -75,6 +75,9 @@ MAX_GIT_HEX_LENGTH=5 # IP address IP_SEPARATOR=', ' +# Show IP +IP_ENABLED=1 + # FUNCS ======================================================================= function ip { @@ -82,6 +85,13 @@ function ip { echo -e "$(ips | sed -e :a -e '$!N;s/\n/${IP_SEPARATOR}/;ta' | sed -e 's/127\.0\.0\.1\${IP_SEPARATOR}//g'), ${myip}" } +# Displays ip prompt +function ip_prompt_info() { + if [[ $IP_ENABLED == 1 ]]; then + echo -e " ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR})" + fi +} + # Displays virtual info prompt (virtualenv/rvm) function virtual_prompt_info() { local virtual_env_info=$(virtualenv_prompt) @@ -176,9 +186,9 @@ function prompt() { [ $UID -eq "0" ] && UC=$SUPERUSER_COLOR if [[ $VIRTUAL_PROMPT_ENABLED == 1 ]]; then - PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR}) in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(virtual_prompt_info)$(scm_prompt_info)${reset_color} \$ " + PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h$(ip_prompt_info) ${DEFAULT_COLOR}in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(virtual_prompt_info)$(scm_prompt_info)${reset_color} \$ " else - PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR}) in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(scm_prompt_info)${reset_color} \$ " + PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h$(ip_prompt_info) ${DEFAULT_COLOR}in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(scm_prompt_info)${reset_color} \$ " fi PS2='> ' PS4='+ ' From 3cd70de071ed3b5bf875e8c51759f218d97e802d Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Sat, 9 Jul 2011 17:38:37 -0500 Subject: [PATCH 118/151] adds a tmuxinator plugin --- plugins/available/tmuxinator.plugin.bash | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 plugins/available/tmuxinator.plugin.bash diff --git a/plugins/available/tmuxinator.plugin.bash b/plugins/available/tmuxinator.plugin.bash new file mode 100644 index 00000000..d8236fc5 --- /dev/null +++ b/plugins/available/tmuxinator.plugin.bash @@ -0,0 +1,3 @@ +#!/bin/bash + +[[ -s $HOME/.tmuxinator/scripts/tmuxinator ]] && . $HOME/.tmuxinator/scripts/tmuxinator From caa1bba1298a7dd35b5844e4b18ddb538bd52b7d Mon Sep 17 00:00:00 2001 From: Ryan Kanno Date: Sat, 9 Jul 2011 14:04:08 -1000 Subject: [PATCH 119/151] Moved IP and virtualenv variables to top of file --- themes/hawaii50/hawaii50.theme.bash | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index 1b0a5998..93cef469 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -30,6 +30,15 @@ # specific like getting ip, etc. # +# IMPORTANT THINGS TO CHANGE ================================================== + +# Show IP in prompt +# One thing to be weary about if you have slow Internets +IP_ENABLED=1 + +# virtual prompts +VIRTUAL_PROMPT_ENABLED=1 + # COLORS ====================================================================== ORANGE='\[\e[0;33m\]' @@ -60,9 +69,6 @@ RVM_THEME_PROMPT_SUFFIX='' VIRTUALENV_THEME_PROMPT_PREFIX='' VIRTUALENV_THEME_PROMPT_SUFFIX='' -# virtual prompts -VIRTUAL_PROMPT_ENABLED=1 - VIRTUAL_THEME_PROMPT_PREFIX=' using ' VIRTUAL_THEME_PROMPT_SUFFIX='' @@ -75,9 +81,6 @@ MAX_GIT_HEX_LENGTH=5 # IP address IP_SEPARATOR=', ' -# Show IP -IP_ENABLED=1 - # FUNCS ======================================================================= function ip { From 8c7b8f26c8ae77a41946c254d9a29f3f542a6d91 Mon Sep 17 00:00:00 2001 From: Antono Vasiljev Date: Sun, 17 Jul 2011 06:52:27 +0300 Subject: [PATCH 120/151] Node version manager as plugin --- plugins/available/nvm.plugin.bash | 251 ++++++++++++++++++++++++++++++ 1 file changed, 251 insertions(+) create mode 100644 plugins/available/nvm.plugin.bash diff --git a/plugins/available/nvm.plugin.bash b/plugins/available/nvm.plugin.bash new file mode 100644 index 00000000..a02722e1 --- /dev/null +++ b/plugins/available/nvm.plugin.bash @@ -0,0 +1,251 @@ +# Node Version Manager +# Implemented as a bash function +# To use source this file from your bash profile +# +# Implemented by Tim Caswell +# with much bash help from Matthew Ranney +# https://github.com/creationix/nvm + +export NVM_DIR=$HOME/.nvm + +if [ ! -d "$NVM_DIR" ]; then + mkdir $NVM_DIR +fi + +# Auto detect the NVM_DIR +if [ ! -d "$NVM_DIR" ]; then + export NVM_DIR=$(cd $(dirname ${BASH_SOURCE[0]:-$0}); pwd) +fi + +# Emulate curl with wget, if necessary +if [ ! `which curl` ]; then + if [ `which wget` ]; then + curl() { + ARGS="$* " + ARGS=${ARGS/-s /-q } + ARGS=${ARGS/-\# /} + ARGS=${ARGS/-C - /-c } + ARGS=${ARGS/-o /-O } + + wget $ARGS + } + else + NOCURL='nocurl' + curl() { echo 'Need curl or wget to proceed.' >&2; } + fi +fi + +# Expand a version using the version cache +nvm_version() +{ + PATTERN=$1 + VERSION='' + if [ -f "$NVM_DIR/alias/$PATTERN" ]; then + nvm_version `cat $NVM_DIR/alias/$PATTERN` + return + fi + # If it looks like an explicit version, don't do anything funny + if [[ "$PATTERN" == v*.*.* ]]; then + VERSION="$PATTERN" + fi + # The default version is the current one + if [ ! "$PATTERN" -o "$PATTERN" = 'current' ]; then + VERSION=`node -v 2>/dev/null` + fi + if [ "$PATTERN" = 'stable' ]; then + PATTERN='*.*[02468].' + fi + if [ "$PATTERN" = 'latest' ]; then + PATTERN='*.*.' + fi + if [ "$PATTERN" = 'all' ]; then + (cd $NVM_DIR; \ls -dG v* 2>/dev/null || echo "N/A") + return + fi + if [ ! "$VERSION" ]; then + VERSION=`(cd $NVM_DIR; \ls -d v${PATTERN}* 2>/dev/null) | sort -t. -k 2,1n -k 2,2n -k 3,3n | tail -n1` + fi + if [ ! "$VERSION" ]; then + echo "N/A" + return 13 + elif [ -e "$NVM_DIR/$VERSION" ]; then + (cd $NVM_DIR; \ls -dG "$VERSION") + else + echo "$VERSION" + fi +} + +nvm() +{ + if [ $# -lt 1 ]; then + nvm help + return + fi + case $1 in + "help" ) + echo + echo "Node Version Manager" + echo + echo "Usage:" + echo " nvm help Show this message" + echo " nvm install Download and install a " + echo " nvm use Modify PATH to use " + echo " nvm ls List versions (installed versions are blue)" + echo " nvm ls List versions matching a given description" + echo " nvm deactivate Undo effects of NVM on current shell" + echo " nvm sync Update the local cache of available versions" + echo " nvm alias [] Show all aliases beginning with " + echo " nvm alias Set an alias named pointing to " + echo + echo "Example:" + echo " nvm install v0.4.0 Install a specific version number" + echo " nvm use stable Use the stable release" + echo " nvm install latest Install the latest, possibly unstable version" + echo " nvm use 0.2 Use the latest available 0.2.x release" + echo " nvm alias default v0.4.0 Set v0.4.0 as the default" + echo + ;; + "install" ) + if [ $# -ne 2 ]; then + nvm help + return + fi + [ "$NOCURL" ] && curl && return + VERSION=`nvm_version $2` + if ( + mkdir -p "$NVM_DIR/src" && \ + cd "$NVM_DIR/src" && \ + curl -C - -# "http://nodejs.org/dist/node-$VERSION.tar.gz" -o "node-$VERSION.tar.gz" && \ + tar -xzf "node-$VERSION.tar.gz" && \ + cd "node-$VERSION" && \ + ./configure --prefix="$NVM_DIR/$VERSION" && \ + make && \ + rm -f "$NVM_DIR/$VERSION" 2>/dev/null && \ + make install + ) + then + nvm use $VERSION + if ! which npm ; then + echo "Installing npm..." + # TODO: if node version 0.2.x add npm_install=0.2.19 before sh + curl http://npmjs.org/install.sh | clean=yes sh + fi + else + echo "nvm: install $VERSION failed!" + fi + ;; + "deactivate" ) + if [[ $PATH == *$NVM_DIR/*/bin* ]]; then + export PATH=${PATH%$NVM_DIR/*/bin*}${PATH#*$NVM_DIR/*/bin:} + hash -r + echo "$NVM_DIR/*/bin removed from \$PATH" + else + echo "Could not find $NVM_DIR/*/bin in \$PATH" + fi + if [[ $MANPATH == *$NVM_DIR/*/share/man* ]]; then + export MANPATH=${MANPATH%$NVM_DIR/*/share/man*}${MANPATH#*$NVM_DIR/*/share/man:} + echo "$NVM_DIR/*/share/man removed from \$MANPATH" + else + echo "Could not find $NVM_DIR/*/share/man in \$MANPATH" + fi + ;; + "use" ) + if [ $# -ne 2 ]; then + nvm help + return + fi + VERSION=`nvm_version $2` + if [ ! -d $NVM_DIR/$VERSION ]; then + echo "$VERSION version is not installed yet" + return; + fi + if [[ $PATH == *$NVM_DIR/*/bin* ]]; then + PATH=${PATH%$NVM_DIR/*/bin*}$NVM_DIR/$VERSION/bin${PATH#*$NVM_DIR/*/bin} + else + PATH="$NVM_DIR/$VERSION/bin:$PATH" + fi + if [[ $MANPATH == *$NVM_DIR/*/share/man* ]]; then + MANPATH=${MANPATH%$NVM_DIR/*/share/man*}$NVM_DIR/$VERSION/share/man${MANPATH#*$NVM_DIR/*/share/man} + else + MANPATH="$NVM_DIR/$VERSION/share/man:$MANPATH" + fi + export PATH + hash -r + export MANPATH + export NVM_PATH="$NVM_DIR/$VERSION/lib/node" + export NVM_BIN="$NVM_DIR/$VERSION/bin" + echo "Now using node $VERSION" + ;; + "ls" ) + if [ $# -ne 1 ]; then + nvm_version $2 + return + fi + nvm_version all + for P in {stable,latest,current}; do + echo -ne "$P: \t"; nvm_version $P + done + nvm alias + echo "# use 'nvm sync' to update from nodejs.org" + ;; + "alias" ) + mkdir -p $NVM_DIR/alias + if [ $# -le 2 ]; then + (cd $NVM_DIR/alias && for ALIAS in `\ls $2* 2>/dev/null`; do + DEST=`cat $ALIAS` + VERSION=`nvm_version $DEST` + if [ "$DEST" = "$VERSION" ]; then + echo "$ALIAS -> $DEST" + else + echo "$ALIAS -> $DEST (-> $VERSION)" + fi + done) + return + fi + if [ ! "$3" ]; then + rm -f $NVM_DIR/alias/$2 + echo "$2 -> *poof*" + return + fi + mkdir -p $NVM_DIR/alias + VERSION=`nvm_version $3` + if [ $? -ne 0 ]; then + echo "! WARNING: Version '$3' does not exist." >&2 + fi + echo $3 > "$NVM_DIR/alias/$2" + if [ ! "$3" = "$VERSION" ]; then + echo "$2 -> $3 (-> $VERSION)" + echo "! WARNING: Moving target. Aliases to implicit versions may change without warning." + else + echo "$2 -> $3" + fi + ;; + "sync" ) + [ "$NOCURL" ] && curl && return + LATEST=`nvm_version latest` + STABLE=`nvm_version stable` + (cd $NVM_DIR + rm -f v* 2>/dev/null + printf "# syncing with nodejs.org..." + for VER in `curl -s http://nodejs.org/dist/ -o - | grep 'node-v.*\.tar\.gz' | sed -e 's/.*node-//' -e 's/\.tar\.gz.*//'`; do + touch $VER + done + echo " done." + ) + [ "$STABLE" = `nvm_version stable` ] || echo "NEW stable: `nvm_version stable`" + [ "$LATEST" = `nvm_version latest` ] || echo "NEW latest: `nvm_version latest`" + ;; + "clear-cache" ) + rm -f $NVM_DIR/v* 2>/dev/null + echo "Cache cleared." + ;; + "version" ) + nvm_version $2 + ;; + * ) + nvm help + ;; + esac +} + +nvm ls default >/dev/null 2>&1 && nvm use default >/dev/null From 35df3d6a579f53579d072013771d967742363419 Mon Sep 17 00:00:00 2001 From: Antono Vasiljev Date: Sun, 17 Jul 2011 07:17:56 +0300 Subject: [PATCH 121/151] Just extract() --- lib/extract.bash | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 lib/extract.bash diff --git a/lib/extract.bash b/lib/extract.bash new file mode 100644 index 00000000..1c55928a --- /dev/null +++ b/lib/extract.bash @@ -0,0 +1,20 @@ +extract () { + if [ -f $1 ] ; then + case $1 in + *.tar.bz2) tar xvjf $1 ;; + *.tar.gz) tar xvzf $1 ;; + *.bz2) bunzip2 $1 ;; + *.rar) unrar x $1 ;; + *.gz) gunzip $1 ;; + *.tar) tar xvf $1 ;; + *.tbz2) tar xvjf $1 ;; + *.tgz) tar xvzf $1 ;; + *.zip) unzip $1 ;; + *.Z) uncompress $1 ;; + *.7z) 7z x $1 ;; + *) echo "'$1' cannot be extracted via >extract<" ;; + esac + else + echo "'$1' is not a valid file" + fi +} From 561c4d60a0a149367e35aa460f09dd3035ad0abc Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Sun, 17 Jul 2011 13:21:38 -0500 Subject: [PATCH 122/151] Move extract.bash to a proper location --- lib/extract.bash => plugins/available/extract.plugin.bash | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lib/extract.bash => plugins/available/extract.plugin.bash (100%) diff --git a/lib/extract.bash b/plugins/available/extract.plugin.bash similarity index 100% rename from lib/extract.bash rename to plugins/available/extract.plugin.bash From 105172025742cf32734825c7d446250332627d55 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Sun, 17 Jul 2011 13:22:49 -0500 Subject: [PATCH 123/151] Add error throw for no file specified --- plugins/available/extract.plugin.bash | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/available/extract.plugin.bash b/plugins/available/extract.plugin.bash index 1c55928a..1c3e9b1a 100644 --- a/plugins/available/extract.plugin.bash +++ b/plugins/available/extract.plugin.bash @@ -1,4 +1,9 @@ extract () { + if [ $# -ne 1 ] + then + echo "Error: No file specified." + return 1 + fi if [ -f $1 ] ; then case $1 in *.tar.bz2) tar xvjf $1 ;; @@ -12,7 +17,7 @@ extract () { *.zip) unzip $1 ;; *.Z) uncompress $1 ;; *.7z) 7z x $1 ;; - *) echo "'$1' cannot be extracted via >extract<" ;; + *) echo "'$1' cannot be extracted via extract" ;; esac else echo "'$1' is not a valid file" From ec3158908b943ff34cdbf0eb2dfe94fb453ad070 Mon Sep 17 00:00:00 2001 From: Victor Castell Date: Tue, 19 Jul 2011 07:31:49 -0700 Subject: [PATCH 124/151] Fixed installation paths in docs. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3a529e3a..0c9c303f 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ Includes autocompletion, themes, aliases, custom functions, a few stolen pieces ## Install -1. Check a clone of this repo: `git clone http://github.com/revans/bash-it.git bash_it` -2. Run `install.sh` (it automatically backs up your `~/.bash_profile`) +1. Check a clone of this repo: `git clone http://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. **NOTE:** From aa56e2ad01977a4bf1237721a7aa089b1990e3bd Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Sat, 23 Jul 2011 21:42:02 -0500 Subject: [PATCH 125/151] ditch custom virtualenv_prompt in favor of one in base --- themes/doubletime/doubletime.theme.bash | 7 ------- 1 file changed, 7 deletions(-) diff --git a/themes/doubletime/doubletime.theme.bash b/themes/doubletime/doubletime.theme.bash index e16ba66c..997b3f24 100644 --- a/themes/doubletime/doubletime.theme.bash +++ b/themes/doubletime/doubletime.theme.bash @@ -26,13 +26,6 @@ doubletime_scm_prompt() { fi } -virtualenv_prompt() { - if [ ! -z "$VIRTUAL_ENV" ] - then - echo "(`basename $VIRTUAL_ENV`) " - fi -} - function prompt_setter() { # Save history history -a From 1251c20a5825a6fa9461a03b42ec27d2ddc8491d Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Sat, 23 Jul 2011 21:42:22 -0500 Subject: [PATCH 126/151] add rvm to prompt --- themes/doubletime/doubletime.theme.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/doubletime/doubletime.theme.bash b/themes/doubletime/doubletime.theme.bash index 997b3f24..0ec8497c 100644 --- a/themes/doubletime/doubletime.theme.bash +++ b/themes/doubletime/doubletime.theme.bash @@ -38,7 +38,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)\w +$clock $(scm_char) [$THEME_PROMPT_HOST_COLOR\u@${THEME_PROMPT_HOST}$reset_color] $(virtualenv_prompt)$(rvm_version_prompt)\w $(doubletime_scm_prompt)$reset_color $ " PS2='> ' PS4='+ ' From 11995c1c1d6623c8aabbce356988e9f7bcec5fba Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Sat, 23 Jul 2011 21:42:48 -0500 Subject: [PATCH 127/151] make sure its obvious which is ruby and which is python --- themes/doubletime/doubletime.theme.bash | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/themes/doubletime/doubletime.theme.bash b/themes/doubletime/doubletime.theme.bash index 0ec8497c..17def320 100644 --- a/themes/doubletime/doubletime.theme.bash +++ b/themes/doubletime/doubletime.theme.bash @@ -6,8 +6,10 @@ SCM_SVN_CHAR="${bold_cyan}⑆${normal}" SCM_HG_CHAR="${bold_red}☿${normal}" SCM_THEME_PROMPT_PREFIX="" SCM_THEME_PROMPT_SUFFIX="" -RVM_THEME_PROMPT_PREFIX=" (" -RVM_THEME_PROMPT_SUFFIX=")" +RVM_THEME_PROMPT_PREFIX="(rb: " +RVM_THEME_PROMPT_SUFFIX=") " +VIRTUALENV_THEME_PROMPT_PREFIX="(py: " +VIRTUALENV_THEME_PROMPT_SUFFIX=") " if [ ! -z $THEME_PROMPT_HOST_COLOR ]; then THEME_PROMPT_HOST_COLOR=$(eval echo $`echo ${THEME_PROMPT_HOST_COLOR}`); From 41ca567f95496d290b3fc3311c2220975ae47731 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Sat, 23 Jul 2011 21:48:07 -0500 Subject: [PATCH 128/151] add color to the prefix --- themes/doubletime/doubletime.theme.bash | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/themes/doubletime/doubletime.theme.bash b/themes/doubletime/doubletime.theme.bash index 17def320..c3bf453d 100644 --- a/themes/doubletime/doubletime.theme.bash +++ b/themes/doubletime/doubletime.theme.bash @@ -6,9 +6,19 @@ SCM_SVN_CHAR="${bold_cyan}⑆${normal}" SCM_HG_CHAR="${bold_red}☿${normal}" SCM_THEME_PROMPT_PREFIX="" SCM_THEME_PROMPT_SUFFIX="" -RVM_THEME_PROMPT_PREFIX="(rb: " +if [ ! -z $RVM_THEME_PROMPT_COLOR ]; then + RVM_THEME_PROMPT_COLOR=$(eval echo $`echo ${RVM_THEME_PROMPT_COLOR}`); +else + RVM_THEME_PROMPT_COLOR="${red}" +fi +RVM_THEME_PROMPT_PREFIX="(${RVM_THEME_PROMPT_COLOR}rb${normal}: " RVM_THEME_PROMPT_SUFFIX=") " -VIRTUALENV_THEME_PROMPT_PREFIX="(py: " +if [ ! -z $VIRTUALENV_THEME_PROMPT_COLOR ]; then + VIRTUALENV_THEME_PROMPT_COLOR=$(eval echo $`echo ${VIRTUALENV_THEME_PROMPT_COLOR}`); +else + VIRTUALENV_THEME_PROMPT_COLOR="${green}" +fi +VIRTUALENV_THEME_PROMPT_PREFIX="(${VIRTUALENV_THEME_PROMPT_COLOR}py${normal}: " VIRTUALENV_THEME_PROMPT_SUFFIX=") " if [ ! -z $THEME_PROMPT_HOST_COLOR ]; then From 80ec9c06bae86a0f51b155a3e7298d2c869f6acd Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Sun, 24 Jul 2011 13:35:43 -0500 Subject: [PATCH 129/151] Remove automatic creation of enabled plugins/aliases/completion --- bash_it.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bash_it.sh b/bash_it.sh index 7734c10c..c7cbaa73 100644 --- a/bash_it.sh +++ b/bash_it.sh @@ -22,8 +22,7 @@ for file_type in "aliases" "completion" "plugins" do if [ ! -d "${BASH}/${file_type}/enabled" ] then - mkdir "${BASH}/${file_type}/enabled" - ln -s ${BASH}/${file_type}/available/* "${BASH}/${file_type}/enabled" + break fi FILES="${BASH}/${file_type}/enabled/*.bash" for config_file in $FILES From 3eff6b2d3838b4b566f8e311f929f078469afba4 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Sun, 24 Jul 2011 13:36:07 -0500 Subject: [PATCH 130/151] Add ability to choose what plugins/aliases/completion to install at install time --- install.sh | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/install.sh b/install.sh index 3fc647b4..4affdbaf 100755 --- a/install.sh +++ b/install.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +BASH="$HOME/.bash_it" cp $HOME/.bash_profile $HOME/.bash_profile.bak @@ -26,3 +27,62 @@ do echo "Please enter Y or N" esac done + +function load_all() { + for file_type in "aliases" "completion" "plugins" + do + [ ! -d "$BASH/$file_type/enabled" ] && mkdir "$BASH/${file_type}/enabled" + ln -s $BASH/${file_type}/available/* "${BASH}/${file_type}/enabled" + done +} + +function load_some() { + for file_type in "aliases" "completion" "plugins" + do + for file in `ls $BASH/${file_type}/available` + do + if [ ! -d "$BASH/$file_type/enabled" ] + then + mkdir "$BASH/$file_type/enabled" + fi + while true + do + read -p "Would you like to enable the ${file%.*.*} $file_type? [Y/N] " RESP + case $RESP in + [yY]) + ln -s "$BASH/$file_type/available/$file" "$BASH/$file_type/enabled" + ;; + [nN]) + break + ;; + *) + echo "Please choose y or n." + ;; + esac + done + done + done +} + +while true +do + read -p "Would you like to enable all, some, or no plugins/aliases/tab-completion plugins? Some of these may make bash slower to start up. (all/some/none) " RESP + case $RESP + in + some) + load_some + break + ;; + all) + load_all + break + ;; + none) + break + ;; + *) + echo "Unknown choice. Please enter some, all, or none" + continue + ;; + esac +done From 159e1e42fa7019471f8763a2dc0ba5f55d82c378 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Sun, 24 Jul 2011 15:01:07 -0500 Subject: [PATCH 131/151] More granular enabling of plugins/completion/aliases --- install.sh | 55 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/install.sh b/install.sh index 4affdbaf..74ff6979 100755 --- a/install.sh +++ b/install.sh @@ -29,16 +29,13 @@ do done function load_all() { - for file_type in "aliases" "completion" "plugins" - do - [ ! -d "$BASH/$file_type/enabled" ] && mkdir "$BASH/${file_type}/enabled" - ln -s $BASH/${file_type}/available/* "${BASH}/${file_type}/enabled" - done + file_type=$1 + [ ! -d "$BASH/$file_type/enabled" ] && mkdir "$BASH/${file_type}/enabled" + ln -s $BASH/${file_type}/available/* "${BASH}/${file_type}/enabled" } function load_some() { - for file_type in "aliases" "completion" "plugins" - do + file_type=$1 for file in `ls $BASH/${file_type}/available` do if [ ! -d "$BASH/$file_type/enabled" ] @@ -61,28 +58,30 @@ function load_some() { esac done done - done } -while true +for type in "aliases" "plugins" "completion" do - read -p "Would you like to enable all, some, or no plugins/aliases/tab-completion plugins? Some of these may make bash slower to start up. (all/some/none) " RESP - case $RESP - in - some) - load_some - break - ;; - all) - load_all - break - ;; - none) - break - ;; - *) - echo "Unknown choice. Please enter some, all, or none" - continue - ;; - esac + while true + do + read -p "Would you like to enable all, some, or no $type? Some of these may make bash slower to start up (especially completion). (all/some/none) " RESP + case $RESP + in + some) + load_some $type + break + ;; + all) + load_all $type + break + ;; + none) + break + ;; + *) + echo "Unknown choice. Please enter some, all, or none" + continue + ;; + esac + done done From 55c32cc3e910022cfef08ed827b9d15f86dbbb21 Mon Sep 17 00:00:00 2001 From: Victor Castell Date: Mon, 25 Jul 2011 13:34:39 +0200 Subject: [PATCH 132/151] Break needed in load_some Y case --- install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install.sh b/install.sh index 74ff6979..f84c097b 100755 --- a/install.sh +++ b/install.sh @@ -48,6 +48,7 @@ function load_some() { case $RESP in [yY]) ln -s "$BASH/$file_type/available/$file" "$BASH/$file_type/enabled" + break ;; [nN]) break From 484c57b7d22bad8797f073951c5f0682bb1c5921 Mon Sep 17 00:00:00 2001 From: Victor Castell Date: Mon, 25 Jul 2011 13:47:03 +0200 Subject: [PATCH 133/151] Refactored gem completion to load gem lists on demand intead of on load --- completion/available/gem.completion.bash | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/completion/available/gem.completion.bash b/completion/available/gem.completion.bash index 7231eef0..de986e08 100644 --- a/completion/available/gem.completion.bash +++ b/completion/available/gem.completion.bash @@ -1,22 +1,22 @@ #!/usr/bin/env bash # Completion for gem -if [ -z "$REMOTE_GEMS" ] -then - REMOTE_GEMS=( $(gem list --remote --no-versions | tr '\n' ' ') ) -fi - -if [ -z "$LOCAL_GEMS" ] -then - LOCAL_GEMS=( $(gem list --no-versions | sed 's/\*\*\* LOCAL GEMS \*\*\*//' | tr '\n' ' ') ) -fi - _installcomp() { + if [ -z "$REMOTE_GEMS" ] + then + REMOTE_GEMS=( $(gem list --remote --no-versions | tr '\n' ' ') ) + fi + local cur=${COMP_WORDS[COMP_CWORD]} COMPREPLY=( $(compgen -W "${REMOTE_GEMS[*]}" -- $cur) ) } _uninstallcomp() { + if [ -z "$LOCAL_GEMS" ] + then + LOCAL_GEMS=( $(gem list --no-versions | sed 's/\*\*\* LOCAL GEMS \*\*\*//' | tr '\n' ' ') ) + fi + local cur=${COMP_WORDS[COMP_CWORD]} COMPREPLY=( $(compgen -W "${LOCAL_GEMS[*]}" -- $cur) ) } From c6e096e35d43fd3ecaaadad5ff92fee2d37a0922 Mon Sep 17 00:00:00 2001 From: Yakkala Yagnesh Raghava Date: Sat, 6 Aug 2011 00:14:15 +0900 Subject: [PATCH 134/151] Add BOOKMARKing functionality to dirs plugin --- plugins/available/dirs.plugins.bash | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) mode change 100644 => 100755 plugins/available/dirs.plugins.bash diff --git a/plugins/available/dirs.plugins.bash b/plugins/available/dirs.plugins.bash old mode 100644 new mode 100755 index dfa9a323..a9f59749 --- a/plugins/available/dirs.plugins.bash +++ b/plugins/available/dirs.plugins.bash @@ -50,3 +50,35 @@ function dirs-help() { echo "8 : Chance to stack location 8." echo "9 : Chance to stack location 9." } + + +# ADD BOOKMARKing functionality +# usage: + +if [ ! -f ~/.dirs ]; then # if doesn't exist, create it + touch ~/.dirs +else + source ~/.dirs +fi + +alias L='cat ~/.dirs' + +G () { # goes to distination dir otherwise , stay in the dir + cd ${1:-$(pwd)} ; +} + +S () { # SAVE a BOOKMARK + /bin/sed "/$@/d" ~/.dirs > ~/.dirs1; + \mv ~/.dirs1 ~/.dirs; + echo "$@"=\"`pwd`\" >> ~/.dirs; + source ~/.dirs ; +} + +R () { # remove a BOOKMARK + /bin/sed "/$@/d" ~/.dirs > ~/.dirs1; + \mv ~/.dirs1 ~/.dirs; +} + +alias U='source ~/.dirs' # Update BOOKMARK stack +# set the bash option so that no '$' is required when using the above facility +shopt -s cdable_vars From dcdfd66d2a566dc637f916486e5622b651cc095f Mon Sep 17 00:00:00 2001 From: Yakkala Yagnesh Raghava Date: Sat, 6 Aug 2011 01:01:17 +0900 Subject: [PATCH 135/151] BOOKMARKing:remove absolute path of sed, to make compatible with OS X --- plugins/available/dirs.plugins.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/available/dirs.plugins.bash b/plugins/available/dirs.plugins.bash index a9f59749..9353c5b5 100755 --- a/plugins/available/dirs.plugins.bash +++ b/plugins/available/dirs.plugins.bash @@ -68,14 +68,14 @@ G () { # goes to distination dir otherwise , stay in the dir } S () { # SAVE a BOOKMARK - /bin/sed "/$@/d" ~/.dirs > ~/.dirs1; + sed "/$@/d" ~/.dirs > ~/.dirs1; \mv ~/.dirs1 ~/.dirs; echo "$@"=\"`pwd`\" >> ~/.dirs; source ~/.dirs ; } R () { # remove a BOOKMARK - /bin/sed "/$@/d" ~/.dirs > ~/.dirs1; + sed "/$@/d" ~/.dirs > ~/.dirs1; \mv ~/.dirs1 ~/.dirs; } From e964c029aa5cf6a0a45a6a34eb7f8149f1feed69 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Wed, 10 Aug 2011 18:49:07 -0500 Subject: [PATCH 136/151] Add alias for shuf -> gshuf --- aliases/available/general.aliases.bash | 53 ++++++++++++++------------ 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/aliases/available/general.aliases.bash b/aliases/available/general.aliases.bash index 79bd7aa0..74f54280 100644 --- a/aliases/available/general.aliases.bash +++ b/aliases/available/general.aliases.bash @@ -12,7 +12,12 @@ alias _="sudo" if [ $(uname) = "Linux" ] then - alias ls="ls --color=always" + alias ls="ls --color=always" +fi + +if [ ! -z "$(which gshuf)" ] +then + alias shuf=gshuf fi alias c='clear' @@ -47,27 +52,27 @@ alias md='mkdir -p' alias rd=rmdir function aliases-help() { - echo "Generic Alias Usage" - echo - echo " sl = ls" - echo " ls = ls -G" - echo " la = ls -AF" - echo " ll = ls -al" - echo " l = ls -a" - echo " c/k/cls = clear" - echo " .. = cd .." - echo " ... = cd ../.." - echo " - = cd -" - echo " h = history" - echo " md = mkdir -p" - echo " rd = rmdir" - echo " editor = $EDITOR" - echo " pager = $PAGER" - echo " piano = pianobar" - echo " q = exit" - echo " irc = $IRC_CLIENT" - echo " md = mkdir -p" - echo " rd = rmdir" - echo " rb = ruby" - echo +echo "Generic Alias Usage" +echo +echo " sl = ls" +echo " ls = ls -G" +echo " la = ls -AF" +echo " ll = ls -al" +echo " l = ls -a" +echo " c/k/cls = clear" +echo " .. = cd .." +echo " ... = cd ../.." +echo " - = cd -" +echo " h = history" +echo " md = mkdir -p" +echo " rd = rmdir" +echo " editor = $EDITOR" +echo " pager = $PAGER" +echo " piano = pianobar" +echo " q = exit" +echo " irc = $IRC_CLIENT" +echo " md = mkdir -p" +echo " rd = rmdir" +echo " rb = ruby" +echo } From 576434048bf58bbab1c527d08e8eb3b6dfbe29c0 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Wed, 10 Aug 2011 18:49:20 -0500 Subject: [PATCH 137/151] Add simple password generator --- plugins/available/base.plugin.bash | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugins/available/base.plugin.bash b/plugins/available/base.plugin.bash index e361e04a..cccd956c 100644 --- a/plugins/available/base.plugin.bash +++ b/plugins/available/base.plugin.bash @@ -15,6 +15,18 @@ function myip { echo "Your public IP is: ${bold_green} $res ${normal}" } +pass() { + if [ -z "$(which gshuf)" ] + then + echo "Error: shuf isn't installed!" + return 1 + fi + + pass=$(shuf -n4 /usr/share/dict/words | tr '\n' ' ') + echo "With spaces (easier to memorize): $pass" + echo "Without (use this as the pass): $(echo $pass | tr -d ' ')" +} + # Function for previewing markdown files in the browser function pmdown() { From 818e687790ecca69102268f17c5798acae2d7ee0 Mon Sep 17 00:00:00 2001 From: Antono Vasiljev Date: Fri, 12 Aug 2011 04:07:12 +0300 Subject: [PATCH 138/151] Detect OS in emacs.aliases.bash --- aliases/available/emacs.aliases.bash | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/aliases/available/emacs.aliases.bash b/aliases/available/emacs.aliases.bash index 5b328768..5042b17e 100644 --- a/aliases/available/emacs.aliases.bash +++ b/aliases/available/emacs.aliases.bash @@ -1,3 +1,11 @@ #!/bin/bash -alias em="open -a emacs" \ No newline at end of file +case $OSTYPE in + linux*) + alias em='emacs' + alias e='emacsclient -n' + ;; + darwin*) + alias em="open -a emacs" + ;; +esac From 89da5f9ceccc5667ff4d946d25d4d4a5b2b98698 Mon Sep 17 00:00:00 2001 From: Antono Vasiljev Date: Fri, 12 Aug 2011 04:08:11 +0300 Subject: [PATCH 139/151] general.aliases.bash: use native tree if [ -x ] .... --- aliases/available/general.aliases.bash | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/aliases/available/general.aliases.bash b/aliases/available/general.aliases.bash index 74f54280..457d6b5b 100644 --- a/aliases/available/general.aliases.bash +++ b/aliases/available/general.aliases.bash @@ -37,15 +37,19 @@ alias rb="ruby" alias piano="pianobar" -alias ..='cd ..' # Go up one directory -alias ...='cd ../..' # Go up two directories -alias -- -="cd -" # Go back +alias ..='cd ..' # Go up one directory +alias ...='cd ../..' # Go up two directories +alias ....='cd ../../..' # Go up two directories +alias -- -="cd -" # Go back # Shell History alias h='history' # Tree -alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'" +if [ ! -x "$(which tree)" ] +then + alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'" +fi # Directory alias md='mkdir -p' From 380a4a6c0e482a6f8f139d3cc8fc3daa8023f63a Mon Sep 17 00:00:00 2001 From: Antono Vasiljev Date: Fri, 12 Aug 2011 04:12:07 +0300 Subject: [PATCH 140/151] Alias for textmate only on darwin* --- aliases/available/textmate.aliases.bash | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/aliases/available/textmate.aliases.bash b/aliases/available/textmate.aliases.bash index ecd616ff..4e696a55 100644 --- a/aliases/available/textmate.aliases.bash +++ b/aliases/available/textmate.aliases.bash @@ -1,5 +1,9 @@ #!/bin/bash -# Textmate -alias e='mate . &' -alias et='mate app config db lib public script test spec config.ru Gemfile Rakefile README &' \ No newline at end of file +case $OSTYPE in + darwin*) + # Textmate + alias e='mate . &' + alias et='mate app config db lib public script test spec config.ru Gemfile Rakefile README &' + ;; +esac From ba8fde85ebbc59e4440dfe45834c8da78671811f Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Fri, 12 Aug 2011 16:30:55 -0500 Subject: [PATCH 141/151] Make gshuf alias checker work on other bash versions --- aliases/available/general.aliases.bash | 4 ++-- plugins/available/base.plugin.bash | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/aliases/available/general.aliases.bash b/aliases/available/general.aliases.bash index 74f54280..4f49a6a8 100644 --- a/aliases/available/general.aliases.bash +++ b/aliases/available/general.aliases.bash @@ -14,8 +14,8 @@ if [ $(uname) = "Linux" ] then alias ls="ls --color=always" fi - -if [ ! -z "$(which gshuf)" ] +which gshuf &> /dev/null +if [ $? -eq 1 ] then alias shuf=gshuf fi diff --git a/plugins/available/base.plugin.bash b/plugins/available/base.plugin.bash index cccd956c..7a6dc80f 100644 --- a/plugins/available/base.plugin.bash +++ b/plugins/available/base.plugin.bash @@ -16,7 +16,8 @@ function myip { } pass() { - if [ -z "$(which gshuf)" ] + which gshuf &> /dev/null + if [ $? -eq 1 ] then echo "Error: shuf isn't installed!" return 1 From 8e0b66899dc1fcc818c45f925a14fea36cd5e279 Mon Sep 17 00:00:00 2001 From: Noorul Islam K M Date: Mon, 22 Aug 2011 12:35:00 +0530 Subject: [PATCH 142/151] Do not break out of the loop instead continue with other items in the list. --- bash_it.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash_it.sh b/bash_it.sh index c7cbaa73..fd7b546d 100644 --- a/bash_it.sh +++ b/bash_it.sh @@ -22,7 +22,7 @@ for file_type in "aliases" "completion" "plugins" do if [ ! -d "${BASH}/${file_type}/enabled" ] then - break + continue fi FILES="${BASH}/${file_type}/enabled/*.bash" for config_file in $FILES From 18bcceaa0860366d8fced94759dfd12fdd4ca217 Mon Sep 17 00:00:00 2001 From: Antono Vasiljev Date: Thu, 25 Aug 2011 16:45:51 +0300 Subject: [PATCH 143/151] Updated nvm.plugin.bash --- plugins/available/nvm.plugin.bash | 66 ++++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 5 deletions(-) diff --git a/plugins/available/nvm.plugin.bash b/plugins/available/nvm.plugin.bash index a02722e1..a5145ec2 100644 --- a/plugins/available/nvm.plugin.bash +++ b/plugins/available/nvm.plugin.bash @@ -4,7 +4,6 @@ # # Implemented by Tim Caswell # with much bash help from Matthew Ranney -# https://github.com/creationix/nvm export NVM_DIR=$HOME/.nvm @@ -89,6 +88,7 @@ nvm() echo "Usage:" echo " nvm help Show this message" echo " nvm install Download and install a " + echo " nvm uninstall Uninstall a version" echo " nvm use Modify PATH to use " echo " nvm ls List versions (installed versions are blue)" echo " nvm ls List versions matching a given description" @@ -96,13 +96,15 @@ nvm() echo " nvm sync Update the local cache of available versions" echo " nvm alias [] Show all aliases beginning with " echo " nvm alias Set an alias named pointing to " + echo " nvm unalias Deletes the alias named " + echo " nvm copy-packages Install global NPM packages contained in to current version" echo echo "Example:" echo " nvm install v0.4.0 Install a specific version number" echo " nvm use stable Use the stable release" echo " nvm install latest Install the latest, possibly unstable version" echo " nvm use 0.2 Use the latest available 0.2.x release" - echo " nvm alias default v0.4.0 Set v0.4.0 as the default" + echo " nvm alias default v0.4.0 Set v0.4.0 as the default" echo ;; "install" ) @@ -112,10 +114,17 @@ nvm() fi [ "$NOCURL" ] && curl && return VERSION=`nvm_version $2` + tarball='' + if [ "`curl -Is "http://nodejs.org/dist/$VERSION/node-$VERSION.tar.gz" | grep '200 OK'`" != '' ]; then + tarball="http://nodejs.org/dist/$VERSION/node-$VERSION.tar.gz" + elif [ "`curl -Is "http://nodejs.org/dist/node-$VERSION.tar.gz" | grep '200 OK'`" != '' ]; then + tarball="http://nodejs.org/dist/node-$VERSION.tar.gz" + fi if ( + [ ! -z $tarball ] && \ mkdir -p "$NVM_DIR/src" && \ cd "$NVM_DIR/src" && \ - curl -C - -# "http://nodejs.org/dist/node-$VERSION.tar.gz" -o "node-$VERSION.tar.gz" && \ + curl -C - -# $tarball -o "node-$VERSION.tar.gz" && \ tar -xzf "node-$VERSION.tar.gz" && \ cd "node-$VERSION" && \ ./configure --prefix="$NVM_DIR/$VERSION" && \ @@ -134,6 +143,36 @@ nvm() echo "nvm: install $VERSION failed!" fi ;; + "uninstall" ) + [ $# -ne 2 ] && nvm help && return + if [[ $2 == `nvm_version` ]]; then + echo "nvm: Cannot uninstall currently-active node version, $2." + return + fi + VERSION=`nvm_version $2` + if [ ! -d $NVM_DIR/$VERSION ]; then + echo "$VERSION version is not installed yet" + return; + fi + + # Delete all files related to target version. + (cd "$NVM_DIR" && \ + rm -rf "node-$VERSION" 2>/dev/null && \ + mkdir -p "$NVM_DIR/src" && \ + cd "$NVM_DIR/src" && \ + rm -f "node-$VERSION.tar.gz" 2>/dev/null && \ + rm -rf "$NVM_DIR/$VERSION" 2>/dev/null) + echo "Uninstalled node $VERSION" + + # Rm any aliases that point to uninstalled version. + for A in `grep -l $VERSION $NVM_DIR/alias/*` + do + nvm unalias `basename $A` + done + + # Run sync in order to restore version stub file in $NVM_DIR. + nvm sync 1>/dev/null + ;; "deactivate" ) if [[ $PATH == *$NVM_DIR/*/bin* ]]; then export PATH=${PATH%$NVM_DIR/*/bin*}${PATH#*$NVM_DIR/*/bin:} @@ -210,7 +249,7 @@ nvm() mkdir -p $NVM_DIR/alias VERSION=`nvm_version $3` if [ $? -ne 0 ]; then - echo "! WARNING: Version '$3' does not exist." >&2 + echo "! WARNING: Version '$3' does not exist." >&2 fi echo $3 > "$NVM_DIR/alias/$2" if [ ! "$3" = "$VERSION" ]; then @@ -220,6 +259,13 @@ nvm() echo "$2 -> $3" fi ;; + "unalias" ) + mkdir -p $NVM_DIR/alias + [ $# -ne 2 ] && nvm help && return + [ ! -f $NVM_DIR/alias/$2 ] && echo "Alias $2 doesn't exist!" && return + rm -f $NVM_DIR/alias/$2 + echo "Deleted alias $2" + ;; "sync" ) [ "$NOCURL" ] && curl && return LATEST=`nvm_version latest` @@ -227,7 +273,7 @@ nvm() (cd $NVM_DIR rm -f v* 2>/dev/null printf "# syncing with nodejs.org..." - for VER in `curl -s http://nodejs.org/dist/ -o - | grep 'node-v.*\.tar\.gz' | sed -e 's/.*node-//' -e 's/\.tar\.gz.*//'`; do + for VER in `curl -s http://nodejs.org/dist/ -o - | grep 'v[0-9].*' | sed -e 's/.*node-//' -e 's/\.tar\.gz.*//' -e 's/<[^>]*>//' -e 's/\/<[^>]*>.*//'`; do touch $VER done echo " done." @@ -235,6 +281,16 @@ nvm() [ "$STABLE" = `nvm_version stable` ] || echo "NEW stable: `nvm_version stable`" [ "$LATEST" = `nvm_version latest` ] || echo "NEW latest: `nvm_version latest`" ;; + "copy-packages" ) + if [ $# -ne 2 ]; then + nvm help + return + fi + VERSION=`nvm_version $2` + ROOT=`nvm use $VERSION && npm -g root` + INSTALLS=`nvm use $VERSION > /dev/null && npm -g -p ll | grep "$ROOT\/[^/]\+$" | cut -d '/' -f 8 | cut -d ":" -f 2 | grep -v npm | tr "\n" " "` + npm install -g $INSTALLS + ;; "clear-cache" ) rm -f $NVM_DIR/v* 2>/dev/null echo "Cache cleared." From 8a46e195d6f0dc5f8b5388816c38e60aeac8ff87 Mon Sep 17 00:00:00 2001 From: Martin Westin Date: Mon, 29 Aug 2011 08:22:19 +0200 Subject: [PATCH 144/151] Bundler aliases "inspired by" OhMyZsh --- aliases/available/bundler.aliases.bash | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 aliases/available/bundler.aliases.bash diff --git a/aliases/available/bundler.aliases.bash b/aliases/available/bundler.aliases.bash new file mode 100644 index 00000000..12484f62 --- /dev/null +++ b/aliases/available/bundler.aliases.bash @@ -0,0 +1,21 @@ +#!/bin/bash + +# Bundler Commands +alias be="bundle exec" +alias bi="bundle install" +alias bl="bundle list" +alias bu="bundle update" +alias bp="bundle package" + + +function bundler-help() { + echo "Bundler Aliases Usage" + echo + echo " be = bundle exec" + echo " bi = bundle install" + echo " bl = bundle list" + echo " bu = bundle update" + echo " bp = bundle package" + echo +} + From 323ce20a2d1e67b1d3025604f5e33c60b52ae7f9 Mon Sep 17 00:00:00 2001 From: John Schulz Date: Tue, 20 Sep 2011 11:07:48 -0400 Subject: [PATCH 145/151] Replace `$BASH` with `$BASH_IT` because `$BASH` is already used on *nix systems for the pathname to the executable (http://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html#Bash-Variables) --- bash_it.sh | 18 +++++++++--------- install.sh | 14 +++++++------- lib/appearance.bash | 6 +++--- template/bash_profile.template.bash | 6 +++--- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/bash_it.sh b/bash_it.sh index fd7b546d..4ee8f2d3 100644 --- a/bash_it.sh +++ b/bash_it.sh @@ -7,11 +7,11 @@ alias reload='source ~/.bash_profile' # Load the framework # Load colors first so they can be use in base theme -source "${BASH}/themes/colors.theme.bash" -source "${BASH}/themes/base.theme.bash" +source "${BASH_IT}/themes/colors.theme.bash" +source "${BASH_IT}/themes/base.theme.bash" # Library -LIB="${BASH}/lib/*.bash" +LIB="${BASH_IT}/lib/*.bash" for config_file in $LIB do source $config_file @@ -20,11 +20,11 @@ done # Load enabled aliases, completion, plugins for file_type in "aliases" "completion" "plugins" do - if [ ! -d "${BASH}/${file_type}/enabled" ] + if [ ! -d "${BASH_IT}/${file_type}/enabled" ] then - continue + continue fi - FILES="${BASH}/${file_type}/enabled/*.bash" + FILES="${BASH_IT}/${file_type}/enabled/*.bash" for config_file in $FILES do source $config_file @@ -32,13 +32,13 @@ do done # Load any custom aliases that the user has added -if [ -e "${BASH}/aliases/custom.aliases.bash" ] +if [ -e "${BASH_IT}/aliases/custom.aliases.bash" ] then - source "${BASH}/aliases/custom.aliases.bash" + source "${BASH_IT}/aliases/custom.aliases.bash" fi # Custom -CUSTOM="${BASH}/custom/*.bash" +CUSTOM="${BASH_IT}/custom/*.bash" for config_file in $CUSTOM do source $config_file diff --git a/install.sh b/install.sh index f84c097b..a80a7499 100755 --- a/install.sh +++ b/install.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -BASH="$HOME/.bash_it" +BASH_IT="$HOME/.bash_it" cp $HOME/.bash_profile $HOME/.bash_profile.bak @@ -30,24 +30,24 @@ done function load_all() { file_type=$1 - [ ! -d "$BASH/$file_type/enabled" ] && mkdir "$BASH/${file_type}/enabled" - ln -s $BASH/${file_type}/available/* "${BASH}/${file_type}/enabled" + [ ! -d "$BASH_IT/$file_type/enabled" ] && mkdir "$BASH_IT/${file_type}/enabled" + ln -s $BASH_IT/${file_type}/available/* "${BASH_IT}/${file_type}/enabled" } function load_some() { file_type=$1 - for file in `ls $BASH/${file_type}/available` + for file in `ls $BASH_IT/${file_type}/available` do - if [ ! -d "$BASH/$file_type/enabled" ] + if [ ! -d "$BASH_IT/$file_type/enabled" ] then - mkdir "$BASH/$file_type/enabled" + mkdir "$BASH_IT/$file_type/enabled" fi while true do read -p "Would you like to enable the ${file%.*.*} $file_type? [Y/N] " RESP case $RESP in [yY]) - ln -s "$BASH/$file_type/available/$file" "$BASH/$file_type/enabled" + ln -s "$BASH_IT/$file_type/available/$file" "$BASH_IT/$file_type/enabled" break ;; [nN]) diff --git a/lib/appearance.bash b/lib/appearance.bash index f7235118..28a131a4 100644 --- a/lib/appearance.bash +++ b/lib/appearance.bash @@ -8,6 +8,6 @@ export GREP_COLOR='1;33' export LSCOLORS='Gxfxcxdxdxegedabagacad' # Load the theme -if [[ $BASH_THEME ]]; then - source "$BASH/themes/$BASH_THEME/$BASH_THEME.theme.bash" -fi \ No newline at end of file +if [[ $BASH_IT_THEME ]]; then + source "$BASH_IT/themes/$BASH_IT_THEME/$BASH_IT_THEME.theme.bash" +fi diff --git a/template/bash_profile.template.bash b/template/bash_profile.template.bash index 95f481e9..34d99ac1 100644 --- a/template/bash_profile.template.bash +++ b/template/bash_profile.template.bash @@ -7,11 +7,11 @@ export PATH=$PATH:~/.gem/ruby/1.8/bin:/opt/nginx/sbin # Path to the bash it configuration -export BASH=$HOME/.bash_it +export BASH_IT=$HOME/.bash_it # Lock and Load a custom theme file # location /.bash_it/themes/ -export BASH_THEME='bobby' +export BASH_IT_THEME='bobby' # Your place for hosting Git repos. I use this for private repos. export GIT_HOSTING='git@git.domain.com' @@ -40,4 +40,4 @@ export TODO="t" #export VCPROMPT_EXECUTABLE=~/.vcprompt/bin/vcprompt # Load Bash It -source $BASH/bash_it.sh +source $BASH_IT/bash_it.sh From b2b629eb1ff8be47ae3f063532f3120427f23790 Mon Sep 17 00:00:00 2001 From: John Schulz Date: Sun, 9 Oct 2011 14:24:10 -0400 Subject: [PATCH 146/151] New prompt functions and variables * `(git|svn|hg)_promp_vars` only assign values to the variables but do not `echo` * `(git|svn|hg)_promp_info` still `echo`s, but now calls `*_prompt_info` first * Introduce `SCM_CHANGE` to store the changeset id * Introduce `SCM_BRANCH` to store the branch name --- themes/base.theme.bash | 137 ++++++++++++++++++++++++++--------------- 1 file changed, 86 insertions(+), 51 deletions(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index feee64e8..05db36e5 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -6,15 +6,16 @@ SCM_THEME_PROMPT_CLEAN=' ✓' SCM_THEME_PROMPT_PREFIX=' |' SCM_THEME_PROMPT_SUFFIX='|' -GIT='git' +SCM_GIT='git' SCM_GIT_CHAR='±' -HG='hg' +SCM_HG='hg' SCM_HG_CHAR='☿' -SVN='svn' +SCM_SVN='svn' SCM_SVN_CHAR='⑆' +SCM_NONE='NONE' SCM_NONE_CHAR='○' RVM_THEME_PROMPT_PREFIX=' |' @@ -24,76 +25,85 @@ VIRTUALENV_THEME_PROMPT_PREFIX=' |' VIRTUALENV_THEME_PROMPT_SUFFIX='|' function scm { - if [[ -d .git ]]; then SCM=$GIT - elif [[ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]]; then SCM=$GIT - elif [[ -d .hg ]]; then SCM=$HG - elif [[ -n "$(hg root 2> /dev/null)" ]]; then SCM=$HG - elif [[ -d .svn ]]; then SCM=$SVN - else SCM='NONE' + if [[ -d .git ]]; then SCM=$SCM_GIT + elif [[ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]]; then SCM=$SCM_GIT + elif [[ -d .hg ]]; then SCM=$SCM_HG + elif [[ -n "$(hg root 2> /dev/null)" ]]; then SCM=$SCM_HG + elif [[ -d .svn ]]; then SCM=$SCM_SVN + else SCM=$SCM_NONE fi } -function scm_char { +function scm_prompt_char { if [[ -z $SCM ]]; then scm; fi - [[ $SCM == $GIT ]] && echo $SCM_GIT_CHAR && return - [[ $SCM == $HG ]] && echo $SCM_HG_CHAR && return - [[ $SCM == $SVN ]] && echo $SCM_SVN_CHAR && return - echo $SCM_NONE_CHAR + if [[ $SCM == $SCM_GIT ]]; then SCM_CHAR=$SCM_GIT_CHAR + elif [[ $SCM == $SCM_HG ]]; then SCM_CHAR=$SCM_HG_CHAR + elif [[ $SCM == $SCM_SVN ]]; then SCM_CHAR=$SCM_SVN_CHAR + else SCM_CHAR=$SCM_NONE_CHAR + fi +} + +function scm_prompt_vars { + scm + scm_prompt_char + SCM_DIRTY=0 + SCM_STATE='' + [[ $SCM == $SCM_GIT ]] && git_prompt_vars && return + [[ $SCM == $SCM_HG ]] && hg_prompt_vars && return + [[ $SCM == $SCM_SVN ]] && svn_prompt_vars && return } function scm_prompt_info { - if [[ -z $SCM ]]; then scm; fi - [[ $SCM == $GIT ]] && git_prompt_info && return - [[ $SCM == $HG ]] && hg_prompt_info && return - [[ $SCM == $SVN ]] && svn_prompt_info && return + scm + scm_prompt_char + SCM_DIRTY=0 + SCM_STATE='' + [[ $SCM == $SCM_GIT ]] && git_prompt_info && return + [[ $SCM == $SCM_HG ]] && hg_prompt_info && return + [[ $SCM == $SCM_SVN ]] && svn_prompt_info && return } -# Stolen from Steve Losh -# left in for backwards-compatibility -function prompt_char { - char=$(scm_char); - echo -e "$char" -} - -function git_prompt_info { +function git_prompt_vars { if [[ -n $(git status -s 2> /dev/null |grep -v ^# |grep -v "working directory clean") ]]; then - state=${GIT_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} + SCM_DIRTY=1 + SCM_STATE=${GIT_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} else - state=${GIT_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} + SCM_DIRTY=0 + SCM_STATE=${GIT_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} fi - prefix=${GIT_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} - suffix=${GIT_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} - ref=$(git symbolic-ref HEAD 2> /dev/null) || return - - echo -e "$prefix${ref#refs/heads/}$state$suffix" + 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) } -function svn_prompt_info { +function svn_prompt_vars { if [[ -n $(svn status 2> /dev/null) ]]; then - state=${SVN_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} + SCM_DIRTY=1 + SCM_STATE=${SVN_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} else - state=${SVN_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} + SCM_DIRTY=0 + SCM_STATE=${SVN_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} fi - prefix=${SVN_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} - suffix=${SVN_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} - ref=$(svn info 2> /dev/null | awk -F/ '/^URL:/ { for (i=0; i<=NF; i++) { if ($i == "branches" || $i == "tags" ) { print $(i+1); break }; if ($i == "trunk") { print $i; break } } }') || return - - [[ -z $ref ]] && return - echo -e "$prefix$ref$state$suffix" + SCM_PREFIX=${SVN_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} + SCM_SUFFIX=${SVN_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} + SCM_BRANCH=$(svn info 2> /dev/null | awk -F/ '/^URL:/ { for (i=0; i<=NF; i++) { if ($i == "branches" || $i == "tags" ) { print $(i+1); break }; if ($i == "trunk") { print $i; break } } }') || return + SCM_CHANGE=$(svn info 2> /dev/null | sed -ne 's#^Revision: ##p' ) } -function hg_prompt_info() { +function hg_prompt_vars { if [[ -n $(hg status 2> /dev/null) ]]; then - state=${HG_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} + SCM_DIRTY=1 + SCM_STATE=${HG_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} else - state=${HG_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} + SCM_DIRTY=0 + SCM_STATE=${HG_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} fi - prefix=${HG_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} - suffix=${HG_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} - branch=$(hg summary 2> /dev/null | grep branch | awk '{print $2}') - changeset=$(hg summary 2> /dev/null | grep parent | awk '{print $2}') - - echo -e "$prefix$branch:${changeset#*:}$state$suffix" + SCM_PREFIX=${HG_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} + SCM_SUFFIX=${HG_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} + SCM_BRANCH=$(hg summary 2> /dev/null | grep branch | awk '{print $2}') + SCM_CHANGE=$(hg summary 2> /dev/null | grep parent | awk '{print $2}') } function rvm_version_prompt { @@ -109,3 +119,28 @@ function virtualenv_prompt { echo -e "$VIRTUALENV_THEME_PROMPT_PREFIX$virtualenv$VIRTUALENV_THEME_PROMPT_SUFFIX" fi } + +# backwards-compatibility +function git_prompt_info { + git_prompt_vars + echo -e "$SCM_PREFIX$SCM_BRANCH$SCM_STATE$SCM_SUFFIX" +} + +function svn_prompt_info { + svn_prompt_vars + echo -e "$SCM_PREFIX$SCM_BRANCH$SCM_STATE$SCM_SUFFIX" +} + +function hg_prompt_info() { + hg_prompt_vars + echo -e "$SCM_PREFIX$SCM_BRANCH:${SCM_CHANGE#*:}$SCM_STATE$SCM_SUFFIX" +} + +function scm_char { + scm_prompt_char + echo -e "$SCM_CHAR" +} + +function prompt_char { + scm_char +} From 7d18cccae949bb3ba088edb195ba9232ee204369 Mon Sep 17 00:00:00 2001 From: Jon Schewe Date: Sun, 9 Oct 2011 20:44:29 -0500 Subject: [PATCH 147/151] Remove error message when enabled directory is empty This is fixed by checking if the file exists before trying to source it. --- bash_it.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/bash_it.sh b/bash_it.sh index fd7b546d..bfa6664b 100644 --- a/bash_it.sh +++ b/bash_it.sh @@ -14,7 +14,9 @@ source "${BASH}/themes/base.theme.bash" LIB="${BASH}/lib/*.bash" for config_file in $LIB do - source $config_file + if [ -e "${config_file}" ]; then + source $config_file + fi done # Load enabled aliases, completion, plugins @@ -27,7 +29,9 @@ do FILES="${BASH}/${file_type}/enabled/*.bash" for config_file in $FILES do - source $config_file + if [ -e "${config_file}" ]; then + source $config_file + fi done done @@ -41,7 +45,9 @@ fi CUSTOM="${BASH}/custom/*.bash" for config_file in $CUSTOM do - source $config_file + if [ -e "${config_file}" ]; then + source $config_file + fi done From 7483c6dac351f836bd574c9cdff4a23df7cd507f Mon Sep 17 00:00:00 2001 From: John Schulz Date: Thu, 27 Oct 2011 19:29:34 -0400 Subject: [PATCH 148/151] Custom themes should be loaded *after* the base theme. --- bash_it.sh | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/bash_it.sh b/bash_it.sh index 4ee8f2d3..fd87248a 100644 --- a/bash_it.sh +++ b/bash_it.sh @@ -4,19 +4,6 @@ # Reload Library alias reload='source ~/.bash_profile' -# Load the framework - -# Load colors first so they can be use in base theme -source "${BASH_IT}/themes/colors.theme.bash" -source "${BASH_IT}/themes/base.theme.bash" - -# Library -LIB="${BASH_IT}/lib/*.bash" -for config_file in $LIB -do - source $config_file -done - # Load enabled aliases, completion, plugins for file_type in "aliases" "completion" "plugins" do @@ -44,6 +31,17 @@ do source $config_file done +# Load colors first so they can be use in base theme +source "${BASH_IT}/themes/colors.theme.bash" +source "${BASH_IT}/themes/base.theme.bash" + +# library +[ -z "$BASH_IT" ] && export BASH_IT=$HOME/.bash_it +LIB="${BASH_IT}/lib/*.bash" +for config_file in $LIB +do + source $config_file +done unset config_file if [[ $PROMPT ]]; then From e3194237e905f80231873fd6b1b778b11409055c Mon Sep 17 00:00:00 2001 From: John Schulz Date: Fri, 28 Oct 2011 19:22:20 -0400 Subject: [PATCH 149/151] `$BASH_IT` should be conditionally defined before use. 7483c6dac351f836bd574c9cdff4a23df7cd507f moved one line too many. --- bash_it.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bash_it.sh b/bash_it.sh index fd87248a..64a95232 100644 --- a/bash_it.sh +++ b/bash_it.sh @@ -4,6 +4,9 @@ # Reload Library alias reload='source ~/.bash_profile' +# Only set $BASH_IT if it's not already set +[ -z "$BASH_IT" ] && export BASH_IT=$HOME/.bash_it + # Load enabled aliases, completion, plugins for file_type in "aliases" "completion" "plugins" do @@ -36,7 +39,6 @@ source "${BASH_IT}/themes/colors.theme.bash" source "${BASH_IT}/themes/base.theme.bash" # library -[ -z "$BASH_IT" ] && export BASH_IT=$HOME/.bash_it LIB="${BASH_IT}/lib/*.bash" for config_file in $LIB do From b6d444d0ced08fbb748908fd648c0534ffd57705 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Sat, 29 Oct 2011 18:55:20 -0500 Subject: [PATCH 150/151] Move this back to its original location Not sure why this needs to be moved. Feels like it could cause some issues since the values defined in themes aren't available to any of the lib or plugins. --- bash_it.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/bash_it.sh b/bash_it.sh index ee6957b9..b2ca7f62 100644 --- a/bash_it.sh +++ b/bash_it.sh @@ -7,6 +7,17 @@ alias reload='source ~/.bash_profile' # Only set $BASH_IT if it's not already set [ -z "$BASH_IT" ] && export BASH_IT=$HOME/.bash_it +# Load colors first so they can be use in base theme +source "${BASH_IT}/themes/colors.theme.bash" +source "${BASH_IT}/themes/base.theme.bash" + +# library +LIB="${BASH_IT}/lib/*.bash" +for config_file in $LIB +do + source $config_file +done + # Load enabled aliases, completion, plugins for file_type in "aliases" "completion" "plugins" do @@ -38,17 +49,6 @@ do fi done -# Load colors first so they can be use in base theme -source "${BASH_IT}/themes/colors.theme.bash" -source "${BASH_IT}/themes/base.theme.bash" - -# library -LIB="${BASH_IT}/lib/*.bash" -for config_file in $LIB -do - source $config_file -done - unset config_file if [[ $PROMPT ]]; then export PS1=$PROMPT From b59ee658f78ec6ff8c6c2754216e0322b7fe18e2 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Sat, 29 Oct 2011 18:56:36 -0500 Subject: [PATCH 151/151] Make sure that the new BASH_IT/BASH_IT_THEME maintains BC --- bash_it.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/bash_it.sh b/bash_it.sh index b2ca7f62..7844f37e 100644 --- a/bash_it.sh +++ b/bash_it.sh @@ -5,7 +5,21 @@ alias reload='source ~/.bash_profile' # Only set $BASH_IT if it's not already set -[ -z "$BASH_IT" ] && export BASH_IT=$HOME/.bash_it +if [ -z "$BASH_IT" ]; +then + # Setting $BASH to maintain backwards compatibility + # TODO: warn users that they should upgrade their .bash_profile + export BASH_IT=$BASH + export BASH=`bash -c 'echo $BASH'` +fi + +# For backwards compatibility, look in old BASH_THEME location +if [ -z "$BASH_IT_THEME" ]; +then + # TODO: warn users that they should upgrade their .bash_profile + export BASH_IT_THEME="$BASH_THEME"; + unset $BASH_THEME; +fi # Load colors first so they can be use in base theme source "${BASH_IT}/themes/colors.theme.bash"