Conflicts:
README.textile
lib/history.zsh
| ... | ... |
@@ -32,12 +32,14 @@ zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-dir |
| 32 | 32 |
cdpath=(.) |
| 33 | 33 |
|
| 34 | 34 |
# use /etc/hosts and known_hosts for hostname completion |
| 35 |
+[ -r /etc/ssh/ssh_known_hosts ] && _global_ssh_hosts=(${${${${(f)"$(</etc/ssh/ssh_known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
|
|
| 35 | 36 |
[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
|
| 36 | 37 |
[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
|
| 37 | 38 |
hosts=( |
| 39 |
+ "$_global_ssh_hosts[@]" |
|
| 38 | 40 |
"$_ssh_hosts[@]" |
| 39 | 41 |
"$_etc_hosts[@]" |
| 40 |
- `hostname` |
|
| 42 |
+ "$HOST" |
|
| 41 | 43 |
localhost |
| 42 | 44 |
) |
| 43 | 45 |
zstyle ':completion:*:hosts' hosts $hosts |
| ... | ... |
@@ -3,11 +3,11 @@ function zsh_stats() {
|
| 3 | 3 |
} |
| 4 | 4 |
|
| 5 | 5 |
function uninstall_oh_my_zsh() {
|
| 6 |
- /bin/sh $ZSH/tools/uninstall.sh |
|
| 6 |
+ /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/uninstall.sh |
|
| 7 | 7 |
} |
| 8 | 8 |
|
| 9 | 9 |
function upgrade_oh_my_zsh() {
|
| 10 |
- /bin/sh $ZSH/tools/upgrade.sh |
|
| 10 |
+ /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh |
|
| 11 | 11 |
} |
| 12 | 12 |
|
| 13 | 13 |
function take() {
|
| ... | ... |
@@ -9,15 +9,21 @@ function disable_git_prompt_info() {
|
| 9 | 9 |
GIT_PROMPT_DISABLED=1 |
| 10 | 10 |
} |
| 11 | 11 |
|
| 12 |
+ |
|
| 12 | 13 |
# Checks if working tree is dirty |
| 13 | 14 |
parse_git_dirty() {
|
| 14 |
- if [[ -n $(git status -s 2> /dev/null) ]]; then |
|
| 15 |
+ local SUBMODULE_SYNTAX='' |
|
| 16 |
+ if [[ $POST_1_7_2_GIT -gt 0 ]]; then |
|
| 17 |
+ SUBMODULE_SYNTAX="--ignore-submodules=dirty" |
|
| 18 |
+ fi |
|
| 19 |
+ if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then
|
|
| 15 | 20 |
echo "$ZSH_THEME_GIT_PROMPT_DIRTY" |
| 16 | 21 |
else |
| 17 | 22 |
echo "$ZSH_THEME_GIT_PROMPT_CLEAN" |
| 18 | 23 |
fi |
| 19 | 24 |
} |
| 20 | 25 |
|
| 26 |
+ |
|
| 21 | 27 |
# Checks if there are commits ahead from remote |
| 22 | 28 |
function git_prompt_ahead() {
|
| 23 | 29 |
if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then |
| ... | ... |
@@ -67,3 +73,29 @@ git_prompt_status() {
|
| 67 | 67 |
fi |
| 68 | 68 |
echo $STATUS |
| 69 | 69 |
} |
| 70 |
+ |
|
| 71 |
+#compare the provided version of git to the version installed and on path |
|
| 72 |
+#prints 1 if input version <= installed version |
|
| 73 |
+#prints -1 otherwise |
|
| 74 |
+function git_compare_version() {
|
|
| 75 |
+ local INPUT_GIT_VERSION=$1; |
|
| 76 |
+ local INSTALLED_GIT_VERSION |
|
| 77 |
+ INPUT_GIT_VERSION=(${(s/./)INPUT_GIT_VERSION});
|
|
| 78 |
+ INSTALLED_GIT_VERSION=($(git --version)); |
|
| 79 |
+ INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]});
|
|
| 80 |
+ |
|
| 81 |
+ for i in {1..3}; do
|
|
| 82 |
+ if [[ $INSTALLED_GIT_VERSION[$i] -lt $INPUT_GIT_VERSION[$i] ]]; then |
|
| 83 |
+ echo -1 |
|
| 84 |
+ return 0 |
|
| 85 |
+ fi |
|
| 86 |
+ done |
|
| 87 |
+ echo 1 |
|
| 88 |
+} |
|
| 89 |
+ |
|
| 90 |
+#this is unlikely to change so make it all statically assigned |
|
| 91 |
+POST_1_7_2_GIT=$(git_compare_version "1.7.2") |
|
| 92 |
+#clean up the namespace slightly by removing the checker function |
|
| 93 |
+unset -f git_compare_version |
|
| 94 |
+ |
|
| 95 |
+ |
| ... | ... |
@@ -3,15 +3,11 @@ HISTFILE=$HOME/.zsh_history |
| 3 | 3 |
HISTSIZE=100000 |
| 4 | 4 |
SAVEHIST=100000 |
| 5 | 5 |
|
| 6 |
-setopt hist_ignore_dups # ignore duplication command history list |
|
| 7 |
-setopt share_history # share command history data |
|
| 8 |
- |
|
| 9 |
-setopt hist_verify |
|
| 10 |
-setopt inc_append_history |
|
| 6 |
+setopt append_history |
|
| 11 | 7 |
setopt extended_history |
| 12 | 8 |
setopt hist_expire_dups_first |
| 9 |
+setopt hist_ignore_dups # ignore duplication command history list |
|
| 13 | 10 |
setopt hist_ignore_space |
| 14 |
-setopt hist_reduce_blanks |
|
| 15 |
- |
|
| 16 |
-setopt SHARE_HISTORY |
|
| 17 |
-setopt APPEND_HISTORY |
|
| 11 |
+setopt hist_verify |
|
| 12 |
+setopt inc_append_history |
|
| 13 |
+setopt share_history # share command history data |
| ... | ... |
@@ -4,7 +4,7 @@ |
| 4 | 4 |
#Limited support for Apple Terminal (Terminal can't set window or tab separately) |
| 5 | 5 |
function title {
|
| 6 | 6 |
[ "$DISABLE_AUTO_TITLE" != "true" ] || return |
| 7 |
- if [[ "$TERM" == screen* ]]; then |
|
| 7 |
+ if [[ "$TERM" == screen* ]]; then |
|
| 8 | 8 |
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars |
| 9 | 9 |
elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then |
| 10 | 10 |
print -Pn "\e]2;$2:q\a" #set window name |
| ... | ... |
@@ -16,14 +16,18 @@ ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD |
| 16 | 16 |
ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~" |
| 17 | 17 |
|
| 18 | 18 |
#Appears when you have the prompt |
| 19 |
-function precmd {
|
|
| 19 |
+function omz_termsupport_precmd {
|
|
| 20 | 20 |
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE |
| 21 | 21 |
} |
| 22 | 22 |
|
| 23 | 23 |
#Appears at the beginning of (and during) of command execution |
| 24 |
-function preexec {
|
|
| 24 |
+function omz_termsupport_preexec {
|
|
| 25 | 25 |
emulate -L zsh |
| 26 | 26 |
setopt extended_glob |
| 27 | 27 |
local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
|
| 28 | 28 |
title "$CMD" "%100>...>$2%<<" |
| 29 | 29 |
} |
| 30 |
+ |
|
| 31 |
+autoload -U add-zsh-hook |
|
| 32 |
+add-zsh-hook precmd omz_termsupport_precmd |
|
| 33 |
+add-zsh-hook preexec omz_termsupport_preexec |
| ... | ... |
@@ -13,20 +13,33 @@ fpath=($ZSH/functions $ZSH/completions $fpath) |
| 13 | 13 |
# TIP: Add files you don't want in git to .gitignore |
| 14 | 14 |
for config_file ($ZSH/lib/*.zsh) source $config_file |
| 15 | 15 |
|
| 16 |
-# Add all defined plugins to fpath |
|
| 17 |
-plugin=${plugin:=()}
|
|
| 18 |
-for plugin ($plugins) fpath=($ZSH/plugins/$plugin $fpath) |
|
| 16 |
+# Set ZSH_CUSTOM to the path where your custom config files |
|
| 17 |
+# and plugins exists, or else we will use the default custom/ |
|
| 18 |
+if [[ -z "$ZSH_CUSTOM" ]]; then |
|
| 19 |
+ ZSH_CUSTOM="$ZSH/custom" |
|
| 20 |
+fi |
|
| 21 |
+ |
|
| 22 |
+ |
|
| 23 |
+is_plugin() {
|
|
| 24 |
+ local base_dir=$1 |
|
| 25 |
+ local name=$2 |
|
| 26 |
+ test -f $base_dir/plugins/$name/$name.plugin.zsh \ |
|
| 27 |
+ || test -f $base_dir/plugins/$name/_$name |
|
| 28 |
+} |
|
| 29 |
+# Add all defined plugins to fpath. This must be done |
|
| 30 |
+# before running compinit. |
|
| 31 |
+for plugin ($plugins); do |
|
| 32 |
+ if is_plugin $ZSH_CUSTOM $plugin; then |
|
| 33 |
+ fpath=($ZSH_CUSTOM/plugins/$plugin $fpath) |
|
| 34 |
+ elif is_plugin $ZSH $plugin; then |
|
| 35 |
+ fpath=($ZSH/plugins/$plugin $fpath) |
|
| 36 |
+ fi |
|
| 37 |
+done |
|
| 19 | 38 |
|
| 20 | 39 |
# Load and run compinit |
| 21 | 40 |
autoload -U compinit |
| 22 | 41 |
compinit -i |
| 23 | 42 |
|
| 24 |
-# Set ZSH_CUSTOM to the path where your custom config files |
|
| 25 |
-# and plugins exists, or else we will use the default custom/ |
|
| 26 |
-if [ "$ZSH_CUSTOM" = "" ] |
|
| 27 |
-then |
|
| 28 |
- ZSH_CUSTOM="$ZSH/custom" |
|
| 29 |
-fi |
|
| 30 | 43 |
|
| 31 | 44 |
# Load all of the plugins that were defined in ~/.zshrc |
| 32 | 45 |
for plugin ($plugins); do |
| ... | ... |
@@ -52,7 +65,12 @@ then |
| 52 | 52 |
else |
| 53 | 53 |
if [ ! "$ZSH_THEME" = "" ] |
| 54 | 54 |
then |
| 55 |
- source "$ZSH/themes/$ZSH_THEME.zsh-theme" |
|
| 55 |
+ if [ -f "$ZSH/custom/$ZSH_THEME.zsh-theme" ] |
|
| 56 |
+ then |
|
| 57 |
+ source "$ZSH/custom/$ZSH_THEME.zsh-theme" |
|
| 58 |
+ else |
|
| 59 |
+ source "$ZSH/themes/$ZSH_THEME.zsh-theme" |
|
| 60 |
+ fi |
|
| 56 | 61 |
fi |
| 57 | 62 |
fi |
| 58 | 63 |
|
| ... | ... |
@@ -9,6 +9,7 @@ if [[ -x `which yaourt` ]]; then |
| 9 | 9 |
alias yaconf='yaourt -C' # Fix all configuration files with vimdiff |
| 10 | 10 |
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips |
| 11 | 11 |
alias yaupg='yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system. |
| 12 |
+ alias yasu='yaourt --sucre' # Same as yaupg, but without confirmation |
|
| 12 | 13 |
alias yain='yaourt -S' # Install specific package(s) from the repositories |
| 13 | 14 |
alias yains='yaourt -U' # Install specific package not from the repositories but from a file |
| 14 | 15 |
alias yare='yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies |
| ... | ... |
@@ -1,3 +1,9 @@ |
| 1 |
-if [ -f `brew --prefix`/etc/autojump ]; then |
|
| 2 |
- . `brew --prefix`/etc/autojump |
|
| 1 |
+if [ $commands[autojump] ]; then # check if autojump is installed |
|
| 2 |
+ if [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package |
|
| 3 |
+ . /usr/share/autojump/autojump.zsh |
|
| 4 |
+ elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation |
|
| 5 |
+ . /etc/profile.d/autojump.zsh |
|
| 6 |
+ elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump ]; then # mac os x with brew |
|
| 7 |
+ . `brew --prefix`/etc/autojump |
|
| 8 |
+ fi |
|
| 3 | 9 |
fi |
| 4 | 10 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,20 @@ |
| 0 |
+if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then |
|
| 1 |
+ function battery_pct_remaining() { echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')" }
|
|
| 2 |
+ function battery_time_remaining() { echo $(acpi | cut -f3 -d ',') }
|
|
| 3 |
+ function battery_pct_prompt() {
|
|
| 4 |
+ b=$(battery_pct_remaining) |
|
| 5 |
+ if [ $b -gt 50 ] ; then |
|
| 6 |
+ color='green' |
|
| 7 |
+ elif [ $b -gt 20 ] ; then |
|
| 8 |
+ color='yellow' |
|
| 9 |
+ else |
|
| 10 |
+ color='red' |
|
| 11 |
+ fi |
|
| 12 |
+ echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
|
|
| 13 |
+ } |
|
| 14 |
+else |
|
| 15 |
+ error_msg='no battery' |
|
| 16 |
+ function battery_pct_remaining() { echo $error_msg }
|
|
| 17 |
+ function battery_time_remaining() { echo $error_msg }
|
|
| 18 |
+ function battery_pct_prompt() { echo '' }
|
|
| 19 |
+fi |
| ... | ... |
@@ -1,7 +1,3 @@ |
| 1 |
-fpath=($ZSH/plugins/bundler $fpath) |
|
| 2 |
-autoload -U compinit |
|
| 3 |
-compinit -i |
|
| 4 |
- |
|
| 5 | 1 |
alias be="bundle exec" |
| 6 | 2 |
alias bi="bundle install" |
| 7 | 3 |
alias bl="bundle list" |
| ... | ... |
@@ -10,7 +6,7 @@ alias bu="bundle update" |
| 10 | 10 |
|
| 11 | 11 |
# The following is based on https://github.com/gma/bundler-exec |
| 12 | 12 |
|
| 13 |
-bundled_commands=(cap capify cucumber foreman guard heroku nanoc rackup rails rainbows rake rspec ruby shotgun spec spork thin unicorn unicorn_rails) |
|
| 13 |
+bundled_commands=(annotate cap capify cucumber ey foreman guard heroku middleman nanoc rackup rainbows rails rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails) |
|
| 14 | 14 |
|
| 15 | 15 |
## Functions |
| 16 | 16 |
|
| ... | ... |
@@ -20,7 +16,7 @@ _bundler-installed() {
|
| 20 | 20 |
|
| 21 | 21 |
_within-bundled-project() {
|
| 22 | 22 |
local check_dir=$PWD |
| 23 |
- while [ "$(dirname $check_dir)" != "/" ]; do |
|
| 23 |
+ while [ $check_dir != "/" ]; do |
|
| 24 | 24 |
[ -f "$check_dir/Gemfile" ] && return |
| 25 | 25 |
check_dir="$(dirname $check_dir)" |
| 26 | 26 |
done |
| ... | ... |
@@ -41,6 +37,6 @@ for cmd in $bundled_commands; do |
| 41 | 41 |
alias $cmd=bundled_$cmd |
| 42 | 42 |
|
| 43 | 43 |
if which _$cmd > /dev/null 2>&1; then |
| 44 |
- compdef _$cmd bundled_$cmd |
|
| 44 |
+ compdef _$cmd bundled_$cmd=$cmd |
|
| 45 | 45 |
fi |
| 46 | 46 |
done |
| ... | ... |
@@ -54,7 +54,7 @@ if [[ $use_sudo -eq 1 ]]; then |
| 54 | 54 |
|
| 55 | 55 |
# apt-get only |
| 56 | 56 |
alias ads="sudo $apt_pref dselect-upgrade" |
| 57 |
- |
|
| 57 |
+ |
|
| 58 | 58 |
# Install all .deb files in the current directory. |
| 59 | 59 |
# Warning: you will need to put the glob in single quotes if you use: |
| 60 | 60 |
# glob_subst |
| ... | ... |
@@ -113,9 +113,6 @@ alias allpkgs='aptitude search -F "%p" --disable-columns ~i' |
| 113 | 113 |
alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc' |
| 114 | 114 |
|
| 115 | 115 |
|
| 116 |
- |
|
| 117 |
- |
|
| 118 |
- |
|
| 119 | 116 |
# Functions ################################################################# |
| 120 | 117 |
# create a simple script that can be used to 'duplicate' a system |
| 121 | 118 |
apt-copy() {
|
| ... | ... |
@@ -132,11 +129,46 @@ apt-copy() {
|
| 132 | 132 |
chmod +x apt-copy.sh |
| 133 | 133 |
} |
| 134 | 134 |
|
| 135 |
+# Prints apt history |
|
| 136 |
+# Usage: |
|
| 137 |
+# apt-history install |
|
| 138 |
+# apt-history upgrade |
|
| 139 |
+# apt-history remove |
|
| 140 |
+# apt-history rollback |
|
| 141 |
+# apt-history list |
|
| 142 |
+# Based On: http://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html |
|
| 143 |
+apt-history () {
|
|
| 144 |
+ case "$1" in |
|
| 145 |
+ install) |
|
| 146 |
+ zgrep --no-filename 'install ' $(ls -rt /var/log/dpkg*) |
|
| 147 |
+ ;; |
|
| 148 |
+ upgrade|remove) |
|
| 149 |
+ zgrep --no-filename $1 $(ls -rt /var/log/dpkg*) |
|
| 150 |
+ ;; |
|
| 151 |
+ rollback) |
|
| 152 |
+ zgrep --no-filename upgrade $(ls -rt /var/log/dpkg*) | \ |
|
| 153 |
+ grep "$2" -A10000000 | \ |
|
| 154 |
+ grep "$3" -B10000000 | \ |
|
| 155 |
+ awk '{print $4"="$5}'
|
|
| 156 |
+ ;; |
|
| 157 |
+ list) |
|
| 158 |
+ zcat $(ls -rt /var/log/dpkg*) |
|
| 159 |
+ ;; |
|
| 160 |
+ *) |
|
| 161 |
+ echo "Parameters:" |
|
| 162 |
+ echo " install - Lists all packages that have been installed." |
|
| 163 |
+ echo " upgrade - Lists all packages that have been upgraded." |
|
| 164 |
+ echo " remove - Lists all packages that have been removed." |
|
| 165 |
+ echo " rollback - Lists rollback information." |
|
| 166 |
+ echo " list - Lists all contains of dpkg logs." |
|
| 167 |
+ ;; |
|
| 168 |
+ esac |
|
| 169 |
+} |
|
| 135 | 170 |
|
| 136 | 171 |
# Kernel-package building shortcut |
| 137 | 172 |
kerndeb () {
|
| 138 | 173 |
# temporarily unset MAKEFLAGS ( '-j3' will fail ) |
| 139 |
- MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' ) |
|
| 174 |
+ MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' ) |
|
| 140 | 175 |
print '$MAKEFLAGS set to '"'$MAKEFLAGS'" |
| 141 | 176 |
appendage='-custom' # this shows up in $ (uname -r ) |
| 142 | 177 |
revision=$(date +"%Y%m%d") # this shows up in the .deb file name |
| ... | ... |
@@ -9,7 +9,7 @@ alias gup='git fetch && git rebase' |
| 9 | 9 |
compdef _git gup=git-fetch |
| 10 | 10 |
alias gp='git push' |
| 11 | 11 |
compdef _git gp=git-push |
| 12 |
-gdv() { git-diff -w "$@" | view - }
|
|
| 12 |
+gdv() { git diff -w "$@" | view - }
|
|
| 13 | 13 |
compdef _git gdv=git-diff |
| 14 | 14 |
alias gc='git commit -v' |
| 15 | 15 |
compdef _git gc=git-commit |
| ... | ... |
@@ -17,6 +17,7 @@ alias gca='git commit -v -a' |
| 17 | 17 |
compdef _git gca=git-commit |
| 18 | 18 |
alias gco='git checkout' |
| 19 | 19 |
compdef _git gco=git-checkout |
| 20 |
+alias gcm='git checkout master' |
|
| 20 | 21 |
alias gb='git branch' |
| 21 | 22 |
compdef _git gb=git-branch |
| 22 | 23 |
alias gba='git branch -a' |
| ... | ... |
@@ -35,6 +36,8 @@ alias ga='git add' |
| 35 | 35 |
compdef _git ga=git-add |
| 36 | 36 |
alias gm='git merge' |
| 37 | 37 |
compdef _git gm=git-merge |
| 38 |
+alias grh='git reset HEAD' |
|
| 39 |
+alias grhh='git reset HEAD --hard' |
|
| 38 | 40 |
|
| 39 | 41 |
# Git and svn mix |
| 40 | 42 |
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' |
| ... | ... |
@@ -57,4 +60,4 @@ compdef ggpull=git |
| 57 | 57 |
alias ggpush='git push origin $(current_branch)' |
| 58 | 58 |
compdef ggpush=git |
| 59 | 59 |
alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)' |
| 60 |
-compdef ggpnp=git |
|
| 60 |
+compdef ggpnp=git |
|
| 61 | 61 |
\ No newline at end of file |
| ... | ... |
@@ -1,7 +1,17 @@ |
| 1 | 1 |
# Setup hub function for git, if it is available; http://github.com/defunkt/hub |
| 2 | 2 |
if [ "$commands[(I)hub]" ] && [ "$commands[(I)ruby]" ]; then |
| 3 | 3 |
# eval `hub alias -s zsh` |
| 4 |
- function git(){hub "$@"}
|
|
| 4 |
+ function git(){
|
|
| 5 |
+ if ! (( $+_has_working_hub )); then |
|
| 6 |
+ hub --version &> /dev/null |
|
| 7 |
+ _has_working_hub=$(($? == 0)) |
|
| 8 |
+ fi |
|
| 9 |
+ if (( $_has_working_hub )) ; then |
|
| 10 |
+ hub "$@" |
|
| 11 |
+ else |
|
| 12 |
+ command git "$@" |
|
| 13 |
+ fi |
|
| 14 |
+ } |
|
| 5 | 15 |
fi |
| 6 | 16 |
|
| 7 | 17 |
# Functions ################################################################# |
| 8 | 18 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,14 @@ |
| 0 |
+#---oh-my-zsh plugin : task Autocomplete for Jake tool--- |
|
| 1 |
+# Jake : https://github.com/mde/jake |
|
| 2 |
+# Warning : Jakefile should have the right case : Jakefile or jakefile |
|
| 3 |
+# Tested on : MacOSX 10.7 (Lion), Ubuntu 11.10 |
|
| 4 |
+# Author : Alexandre Lacheze (@al3xstrat) |
|
| 5 |
+# Inspiration : http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh |
|
| 6 |
+ |
|
| 7 |
+function _jake () {
|
|
| 8 |
+ if [ -f Jakefile ]||[ -f jakefile ]; then |
|
| 9 |
+ compadd `jake -T | cut -d " " -f 2 | sed -E "s/.\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"`
|
|
| 10 |
+ fi |
|
| 11 |
+} |
|
| 12 |
+ |
|
| 13 |
+compdef _jake jake |
|
| 0 | 14 |
\ No newline at end of file |
| ... | ... |
@@ -26,7 +26,7 @@ _knife() {
|
| 26 | 26 |
|
| 27 | 27 |
case $state in |
| 28 | 28 |
knifecmd) |
| 29 |
- compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec index node recipe role search ssh status windows $cloudproviders |
|
| 29 |
+ compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec environment index node recipe role search ssh status windows $cloudproviders |
|
| 30 | 30 |
;; |
| 31 | 31 |
knifesubcmd) |
| 32 | 32 |
case $words[2] in |
| ... | ... |
@@ -42,6 +42,9 @@ _knife() {
|
| 42 | 42 |
cookbook) |
| 43 | 43 |
compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload |
| 44 | 44 |
;; |
| 45 |
+ environment) |
|
| 46 |
+ compadd -Q "$@" list create delete edit show "from file" |
|
| 47 |
+ ;; |
|
| 45 | 48 |
node) |
| 46 | 49 |
compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete" |
| 47 | 50 |
;; |
| ... | ... |
@@ -138,27 +141,31 @@ _knife_options3() {
|
| 138 | 138 |
|
| 139 | 139 |
# The chef_x_remote functions use knife to get a list of objects of type x on the server |
| 140 | 140 |
_chef_roles_remote() {
|
| 141 |
- (knife role list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
|
| 141 |
+ (knife role list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
|
| 142 | 142 |
} |
| 143 | 143 |
|
| 144 | 144 |
_chef_clients_remote() {
|
| 145 |
- (knife client list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
|
| 145 |
+ (knife client list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
|
| 146 | 146 |
} |
| 147 | 147 |
|
| 148 | 148 |
_chef_nodes_remote() {
|
| 149 |
- (knife node list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
|
| 149 |
+ (knife node list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
|
| 150 | 150 |
} |
| 151 | 151 |
|
| 152 | 152 |
_chef_cookbooks_remote() {
|
| 153 |
- (knife cookbook list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
|
| 153 |
+ (knife cookbook list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
|
| 154 | 154 |
} |
| 155 | 155 |
|
| 156 | 156 |
_chef_sitecookbooks_remote() {
|
| 157 |
- (knife cookbook site list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
|
| 157 |
+ (knife cookbook site list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
|
| 158 | 158 |
} |
| 159 | 159 |
|
| 160 | 160 |
_chef_data_bags_remote() {
|
| 161 |
- (knife data bag list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
|
| 161 |
+ (knife data bag list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
|
| 162 |
+} |
|
| 163 |
+ |
|
| 164 |
+_chef_environments_remote() {
|
|
| 165 |
+ (knife environment list | awk '{print $1}')
|
|
| 162 | 166 |
} |
| 163 | 167 |
|
| 164 | 168 |
# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server |
| ... | ... |
@@ -1,14 +1,14 @@ |
| 1 | 1 |
|
| 2 | 2 |
# Mercurial |
| 3 |
-alias hgc='hg commit -v' |
|
| 4 |
-alias hgb='hg branch -v' |
|
| 3 |
+alias hgc='hg commit' |
|
| 4 |
+alias hgb='hg branch' |
|
| 5 | 5 |
alias hgba='hg branches' |
| 6 | 6 |
alias hgco='hg checkout' |
| 7 | 7 |
alias hgd='hg diff' |
| 8 | 8 |
alias hged='hg diffmerge' |
| 9 | 9 |
# pull and update |
| 10 |
-alias hgl='hg pull -u -v' |
|
| 11 |
-alias hgp='hg push -v' |
|
| 12 |
-alias hgs='hg status -v' |
|
| 10 |
+alias hgl='hg pull -u' |
|
| 11 |
+alias hgp='hg push' |
|
| 12 |
+alias hgs='hg status' |
|
| 13 | 13 |
# this is the 'git commit --amend' equivalent |
| 14 | 14 |
alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip' |
| ... | ... |
@@ -3,30 +3,43 @@ |
| 3 | 3 |
|
| 4 | 4 |
# pip zsh completion, based on homebrew completion |
| 5 | 5 |
|
| 6 |
+_pip_all() {
|
|
| 7 |
+ # we cache the list of packages (originally from the macports plugin) |
|
| 8 |
+ if (( ! $+piplist )); then |
|
| 9 |
+ echo -n " (caching package index...)" |
|
| 10 |
+ piplist=($(pip search * | cut -d ' ' -f 1 | tr '[A-Z]' '[a-z]')) |
|
| 11 |
+ fi |
|
| 12 |
+} |
|
| 13 |
+ |
|
| 6 | 14 |
_pip_installed() {
|
| 7 |
- installed_pkgs=(`pip freeze`) |
|
| 15 |
+ installed_pkgs=(`pip freeze | cut -d '=' -f 1`) |
|
| 8 | 16 |
} |
| 9 | 17 |
|
| 10 | 18 |
local -a _1st_arguments |
| 11 | 19 |
_1st_arguments=( |
| 12 |
- 'bundle:Create pybundles (archives containing multiple packages)' |
|
| 13 |
- 'freeze:Output all currently installed packages (exact versions) to stdout' |
|
| 14 |
- 'help:Show available commands' |
|
| 15 |
- 'install:Install packages' |
|
| 16 |
- 'search:Search PyPI' |
|
| 17 |
- 'uninstall:Uninstall packages' |
|
| 18 |
- 'unzip:Unzip individual packages' |
|
| 19 |
- 'zip:Zip individual packages' |
|
| 20 |
+ 'bundle:create pybundles (archives containing multiple packages)' |
|
| 21 |
+ 'freeze:output all currently installed packages (exact versions) to stdout' |
|
| 22 |
+ 'help:show available commands' |
|
| 23 |
+ 'install:install packages' |
|
| 24 |
+ 'search:search PyPI' |
|
| 25 |
+ 'uninstall:uninstall packages' |
|
| 26 |
+ 'unzip:unzip individual packages' |
|
| 27 |
+ 'zip:zip individual packages' |
|
| 20 | 28 |
) |
| 21 | 29 |
|
| 22 | 30 |
local expl |
| 23 |
-local -a pkgs installed_pkgs |
|
| 31 |
+local -a all_pkgs installed_pkgs |
|
| 24 | 32 |
|
| 25 | 33 |
_arguments \ |
| 26 |
- '(--version)--version[Show version number of program and exit]' \ |
|
| 27 |
- '(-v --verbose)'{-v,--verbose}'[Give more output]' \
|
|
| 28 |
- '(-q --quiet)'{-q,--quiet}'[Give less output]' \
|
|
| 29 |
- '(-h --help)'{-h,--help}'[Show help]' \
|
|
| 34 |
+ '(--version)--version[show version number of program and exit]' \ |
|
| 35 |
+ '(-h --help)'{-h,--help}'[show help]' \
|
|
| 36 |
+ '(-E --environment)'{-E,--environment}'[virtualenv environment to run pip in]' \
|
|
| 37 |
+ '(-s --enable-site-packages)'{-s,--enable-site-packages}'[include site-packages in virtualenv]' \
|
|
| 38 |
+ '(-v --verbose)'{-v,--verbose}'[give more output]' \
|
|
| 39 |
+ '(-q --quiet)'{-q,--quiet}'[give less output]' \
|
|
| 40 |
+ '(--log)--log[log file location]' \ |
|
| 41 |
+ '(--proxy)--proxy[proxy in form user:passwd@proxy.server:port]' \ |
|
| 42 |
+ '(--timeout)--timeout[socket timeout (default 15s)]' \ |
|
| 30 | 43 |
'*:: :->subcmds' && return 0 |
| 31 | 44 |
|
| 32 | 45 |
if (( CURRENT == 1 )); then |
| ... | ... |
@@ -35,10 +48,25 @@ if (( CURRENT == 1 )); then |
| 35 | 35 |
fi |
| 36 | 36 |
|
| 37 | 37 |
case "$words[1]" in |
| 38 |
- list) |
|
| 39 |
- if [[ "$state" == forms ]]; then |
|
| 40 |
- _pip_installed |
|
| 41 |
- _requested installed_pkgs expl 'installed packages' compadd -a installed_pkgs |
|
| 38 |
+ search) |
|
| 39 |
+ _arguments \ |
|
| 40 |
+ '(--index)--index[base URL of Python Package Index]' ;; |
|
| 41 |
+ freeze) |
|
| 42 |
+ _arguments \ |
|
| 43 |
+ '(-l --local)'{-l,--local}'[report only virtualenv packages]' ;;
|
|
| 44 |
+ install) |
|
| 45 |
+ _arguments \ |
|
| 46 |
+ '(-U --upgrade)'{-U,--upgrade}'[upgrade all packages to the newest available version]' \
|
|
| 47 |
+ '(-f --find-links)'{-f,--find-links}'[URL for finding packages]' \
|
|
| 48 |
+ '(--no-deps --no-dependencies)'{--no-deps,--no-dependencies}'[iIgnore package dependencies]' \
|
|
| 49 |
+ '(--no-install)--no-install[only download packages]' \ |
|
| 50 |
+ '(--no-download)--no-download[only install downloaded packages]' \ |
|
| 51 |
+ '(--install-option)--install-option[extra arguments to be supplied to the setup.py]' \ |
|
| 52 |
+ '1: :->packages' && return 0 |
|
| 53 |
+ |
|
| 54 |
+ if [[ "$state" == packages ]]; then |
|
| 55 |
+ _pip_all |
|
| 56 |
+ _wanted piplist expl 'packages' compadd -a piplist |
|
| 42 | 57 |
fi ;; |
| 43 | 58 |
uninstall) |
| 44 | 59 |
_pip_installed |
| ... | ... |
@@ -1,10 +1,66 @@ |
| 1 |
-# Thanks to Christopher Sexton |
|
| 2 |
-# https://gist.github.com/965032 |
|
| 3 |
-function kapow {
|
|
| 4 |
- touch ~/.pow/$1/tmp/restart.txt |
|
| 5 |
- if [ $? -eq 0 ]; then |
|
| 6 |
- echo "$fg[yellow]Pow restarting $1...$reset_color" |
|
| 7 |
- fi |
|
| 1 |
+# Restart a rack app running under pow |
|
| 2 |
+# http://pow.cx/ |
|
| 3 |
+# |
|
| 4 |
+# Adds a kapow command that will restart an app |
|
| 5 |
+# |
|
| 6 |
+# $ kapow myapp |
|
| 7 |
+# |
|
| 8 |
+# Supports command completion. |
|
| 9 |
+# |
|
| 10 |
+# If you are not already using completion you might need to enable it with |
|
| 11 |
+# |
|
| 12 |
+# autoload -U compinit compinit |
|
| 13 |
+# |
|
| 14 |
+# Changes: |
|
| 15 |
+# |
|
| 16 |
+# Defaults to the current application, and will walk up the tree to find |
|
| 17 |
+# a config.ru file and restart the corresponding app |
|
| 18 |
+# |
|
| 19 |
+# Will Detect if a app does not exist in pow and print a (slightly) helpful |
|
| 20 |
+# error message |
|
| 21 |
+ |
|
| 22 |
+rack_root_detect(){
|
|
| 23 |
+ setopt chaselinks |
|
| 24 |
+ local orgdir=$(pwd) |
|
| 25 |
+ local basedir=$(pwd) |
|
| 26 |
+ |
|
| 27 |
+ while [[ $basedir != '/' ]]; do |
|
| 28 |
+ test -e "$basedir/config.ru" && break |
|
| 29 |
+ builtin cd ".." 2>/dev/null |
|
| 30 |
+ basedir="$(pwd)" |
|
| 31 |
+ done |
|
| 32 |
+ |
|
| 33 |
+ builtin cd $orgdir 2>/dev/null |
|
| 34 |
+ [[ ${basedir} == "/" ]] && return 1
|
|
| 35 |
+ echo `basename $basedir | sed -E "s/.(com|net|org)//"` |
|
| 8 | 36 |
} |
| 9 | 37 |
|
| 38 |
+kapow(){
|
|
| 39 |
+ local vhost=$1 |
|
| 40 |
+ [ ! -n "$vhost" ] && vhost=$(rack_root_detect) |
|
| 41 |
+ if [ ! -h ~/.pow/$vhost ] |
|
| 42 |
+ then |
|
| 43 |
+ echo "pow: This domain isn’t set up yet. Symlink your application to ${vhost} first."
|
|
| 44 |
+ return 1 |
|
| 45 |
+ fi |
|
| 46 |
+ |
|
| 47 |
+ [ ! -d ~/.pow/${vhost}/tmp ] && mkdir -p ~/.pow/$vhost/tmp
|
|
| 48 |
+ touch ~/.pow/$vhost/tmp/restart.txt; |
|
| 49 |
+ [ $? -eq 0 ] && echo "pow: restarting $vhost.dev" |
|
| 50 |
+} |
|
| 10 | 51 |
compctl -W ~/.pow -/ kapow |
| 52 |
+ |
|
| 53 |
+powit(){
|
|
| 54 |
+ local basedir=$(pwd) |
|
| 55 |
+ local vhost=$1 |
|
| 56 |
+ [ ! -n "$vhost" ] && vhost=$(rack_root_detect) |
|
| 57 |
+ if [ ! -h ~/.pow/$vhost ] |
|
| 58 |
+ then |
|
| 59 |
+ echo "pow: Symlinking your app with pow. ${vhost}"
|
|
| 60 |
+ [ ! -d ~/.pow/${vhost} ] && ln -s $basedir ~/.pow/$vhost
|
|
| 61 |
+ return 1 |
|
| 62 |
+ fi |
|
| 63 |
+} |
|
| 64 |
+ |
|
| 65 |
+# View the standard out (puts) from any pow app |
|
| 66 |
+alias kaput="tail -f ~/Library/Logs/Pow/apps/*" |
| ... | ... |
@@ -2,6 +2,7 @@ alias ss='thin --stats "/thin/stats" start' |
| 2 | 2 |
alias sg='ruby script/generate' |
| 3 | 3 |
alias sd='ruby script/destroy' |
| 4 | 4 |
alias sp='ruby script/plugin' |
| 5 |
+alias sr='ruby script/runner' |
|
| 5 | 6 |
alias ssp='ruby script/spec' |
| 6 | 7 |
alias rdbm='rake db:migrate' |
| 7 | 8 |
alias sc='ruby script/console' |
| ... | ... |
@@ -14,6 +14,9 @@ alias rdb='_rails_command dbconsole' |
| 14 | 14 |
alias rdbm='rake db:migrate db:test:clone' |
| 15 | 15 |
alias rg='_rails_command generate' |
| 16 | 16 |
alias rp='_rails_command plugin' |
| 17 |
+alias ru='_rails_command runner' |
|
| 17 | 18 |
alias rs='_rails_command server' |
| 18 | 19 |
alias rsd='_rails_command server --debugger' |
| 19 | 20 |
alias devlog='tail -f log/development.log' |
| 21 |
+alias rdm='rake db:migrate' |
|
| 22 |
+alias rdr='rake db:rollback' |
| 20 | 23 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,6 @@ |
| 0 |
+alias rake="noglob rake" # allows square brackts for rake task invocation |
|
| 1 |
+alias brake='noglob bundle exec rake' # execute the bundled rake gem |
|
| 2 |
+alias srake='noglob sudo rake' # noglob must come before sudo |
|
| 3 |
+alias sbrake='noglob sudo bundle exec rake' # altogether now ... |
|
| 4 |
+ |
|
| 5 |
+ |
| 0 | 6 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,44 @@ |
| 0 |
+FOUND_RBENV=0 |
|
| 1 |
+for rbenvdir in "$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv" ; do |
|
| 2 |
+ if [ -d $rbenvdir/bin -a $FOUND_RBENV -eq 0 ] ; then |
|
| 3 |
+ FOUND_RBENV=1 |
|
| 4 |
+ export RBENV_ROOT=$rbenvdir |
|
| 5 |
+ export PATH=${rbenvdir}/bin:$PATH
|
|
| 6 |
+ eval "$(rbenv init -)" |
|
| 7 |
+ |
|
| 8 |
+ alias rubies="rbenv versions" |
|
| 9 |
+ alias gemsets="rbenv gemset list" |
|
| 10 |
+ |
|
| 11 |
+ function current_ruby() {
|
|
| 12 |
+ echo "$(rbenv version-name)" |
|
| 13 |
+ } |
|
| 14 |
+ |
|
| 15 |
+ function current_gemset() {
|
|
| 16 |
+ echo "$(rbenv gemset active 2&>/dev/null | sed -e ":a" -e '$ s/\n/+/gp;N;b a' | head -n1)" |
|
| 17 |
+ } |
|
| 18 |
+ |
|
| 19 |
+ function gems {
|
|
| 20 |
+ local rbenv_path=$(rbenv prefix) |
|
| 21 |
+ gem list $@ | sed \ |
|
| 22 |
+ -Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \ |
|
| 23 |
+ -Ee "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \ |
|
| 24 |
+ -Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \ |
|
| 25 |
+ -Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g" |
|
| 26 |
+ } |
|
| 27 |
+ |
|
| 28 |
+ function rbenv_prompt_info() {
|
|
| 29 |
+ if [[ -n $(current_gemset) ]] ; then |
|
| 30 |
+ echo "$(current_ruby)@$(current_gemset)" |
|
| 31 |
+ else |
|
| 32 |
+ echo "$(current_ruby)" |
|
| 33 |
+ fi |
|
| 34 |
+ } |
|
| 35 |
+ fi |
|
| 36 |
+done |
|
| 37 |
+unset rbenvdir |
|
| 38 |
+ |
|
| 39 |
+if [ $FOUND_RBENV -eq 0 ] ; then |
|
| 40 |
+ alias rubies='ruby -v' |
|
| 41 |
+ function gemsets() { echo 'not supported' }
|
|
| 42 |
+ function rbenv_prompt_info() { echo "system: $(ruby -v | cut -f-2 -d ' ')" }
|
|
| 43 |
+fi |
| ... | ... |
@@ -37,7 +37,7 @@ function gems {
|
| 37 | 37 |
local current_gemset=`rvm-prompt g` |
| 38 | 38 |
|
| 39 | 39 |
gem list $@ | sed \ |
| 40 |
- -Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \ |
|
| 40 |
+ -Ee "s/\([0-9, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \ |
|
| 41 | 41 |
-Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \ |
| 42 | 42 |
-Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \ |
| 43 | 43 |
-Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g" |
| 44 | 44 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,64 @@ |
| 0 |
+# Contributed and SLIGHTLY modded by Matt Parnell/ilikenwf <parwok -at- gmail> |
|
| 1 |
+# Created by the blogger at the URL below...I don't know where to find his/her name |
|
| 2 |
+# Original found at http://www.shellperson.net/sprunge-pastebin-script/ |
|
| 3 |
+ |
|
| 4 |
+usage() {
|
|
| 5 |
+description | fmt -s >&2 |
|
| 6 |
+} |
|
| 7 |
+ |
|
| 8 |
+description() {
|
|
| 9 |
+cat << HERE |
|
| 10 |
+ |
|
| 11 |
+DESCRIPTION |
|
| 12 |
+ Upload data and fetch URL from the pastebin http://sprunge.us |
|
| 13 |
+ |
|
| 14 |
+USAGE |
|
| 15 |
+ $0 filename.txt |
|
| 16 |
+ $0 text string |
|
| 17 |
+ $0 < filename.txt |
|
| 18 |
+ piped_data | $0 |
|
| 19 |
+ |
|
| 20 |
+NOTES |
|
| 21 |
+-------------------------------------------------------------------------- |
|
| 22 |
+* INPUT METHODS * |
|
| 23 |
+$0 can accept piped data, STDIN redirection [<filename.txt], text strings following the command as arguments, or filenames as arguments. Only one of these methods can be used at a time, so please see the note on precedence. Also, note that using a pipe or STDIN redirection will treat tabs as spaces, or disregard them entirely (if they appear at the beginning of a line). So I suggest using a filename as an argument if tabs are important either to the function or readability of the code. |
|
| 24 |
+ |
|
| 25 |
+* PRECEDENCE * |
|
| 26 |
+STDIN redirection has precedence, then piped input, then a filename as an argument, and finally text strings as an arguments. |
|
| 27 |
+ |
|
| 28 |
+ EXAMPLE: |
|
| 29 |
+ echo piped | "$0" arguments.txt < stdin_redirection.txt |
|
| 30 |
+ |
|
| 31 |
+In this example, the contents of file_as_stdin_redirection.txt would be uploaded. Both the piped_text and the file_as_argument.txt are ignored. If there is piped input and arguments, the arguments will be ignored, and the piped input uploaded. |
|
| 32 |
+ |
|
| 33 |
+* FILENAMES * |
|
| 34 |
+If a filename is misspelled or doesn't have the necessary path description, it will NOT generate an error, but will instead treat it as a text string and upload it. |
|
| 35 |
+-------------------------------------------------------------------------- |
|
| 36 |
+ |
|
| 37 |
+HERE |
|
| 38 |
+exit |
|
| 39 |
+} |
|
| 40 |
+ |
|
| 41 |
+sprunge() {
|
|
| 42 |
+ if [ -t 0 ]; then |
|
| 43 |
+ echo Running interactively, checking for arguments... >&2 |
|
| 44 |
+ if [ "$*" ]; then |
|
| 45 |
+ echo Arguments present... >&2 |
|
| 46 |
+ if [ -f "$*" ]; then |
|
| 47 |
+ echo Uploading the contents of "$*"... >&2 |
|
| 48 |
+ cat "$*" |
|
| 49 |
+ else |
|
| 50 |
+ echo Uploading the text: \""$*"\"... >&2 |
|
| 51 |
+ echo "$*" |
|
| 52 |
+ fi | curl -F 'sprunge=<-' http://sprunge.us |
|
| 53 |
+ else |
|
| 54 |
+ echo No arguments found, printing USAGE and exiting. >&2 |
|
| 55 |
+ usage |
|
| 56 |
+ fi |
|
| 57 |
+ else |
|
| 58 |
+ echo Using input from a pipe or STDIN redirection... >&2 |
|
| 59 |
+ while read -r line ; do |
|
| 60 |
+ echo $line |
|
| 61 |
+ done | curl -F 'sprunge=<-' http://sprunge.us |
|
| 62 |
+ fi |
|
| 63 |
+} |
| 0 | 64 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,13 @@ |
| 0 |
+# Symfony2 basic command completion |
|
| 1 |
+ |
|
| 2 |
+_symfony2_get_command_list () {
|
|
| 3 |
+ app/console --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }'
|
|
| 4 |
+} |
|
| 5 |
+ |
|
| 6 |
+_symfony2 () {
|
|
| 7 |
+ if [ -f app/console ]; then |
|
| 8 |
+ compadd `_symfony2_get_command_list` |
|
| 9 |
+ fi |
|
| 10 |
+} |
|
| 11 |
+ |
|
| 12 |
+compdef _symfony2 app/console |
|
| 0 | 13 |
\ No newline at end of file |
| ... | ... |
@@ -1,37 +1,37 @@ |
| 1 | 1 |
#compdef task |
| 2 |
-# |
|
| 3 | 2 |
# zsh completion for taskwarrior |
| 4 | 3 |
# |
| 4 |
+# taskwarrior - a command line task list manager. |
|
| 5 |
+# |
|
| 5 | 6 |
# Copyright 2010 - 2011 Johannes Schlatow |
| 6 | 7 |
# Copyright 2009 P.C. Shyamshankar |
| 7 |
-# All rights reserved. |
|
| 8 |
-# |
|
| 9 |
-# This script is part of the taskwarrior project. |
|
| 10 | 8 |
# |
| 11 |
-# This program is free software; you can redistribute it and/or modify it under |
|
| 12 |
-# the terms of the GNU General Public License as published by the Free Software |
|
| 13 |
-# Foundation; either version 2 of the License, or (at your option) any later |
|
| 14 |
-# version. |
|
| 9 |
+# Permission is hereby granted, free of charge, to any person obtaining a copy |
|
| 10 |
+# of this software and associated documentation files (the "Software"), to deal |
|
| 11 |
+# in the Software without restriction, including without limitation the rights |
|
| 12 |
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
| 13 |
+# copies of the Software, and to permit persons to whom the Software is |
|
| 14 |
+# furnished to do so, subject to the following conditions: |
|
| 15 | 15 |
# |
| 16 |
-# This program is distributed in the hope that it will be useful, but WITHOUT |
|
| 17 |
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
| 18 |
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
| 19 |
-# details. |
|
| 16 |
+# The above copyright notice and this permission notice shall be included |
|
| 17 |
+# in all copies or substantial portions of the Software. |
|
| 20 | 18 |
# |
| 21 |
-# You should have received a copy of the GNU General Public License along with |
|
| 22 |
-# this program; if not, write to the |
|
| 19 |
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
|
| 20 |
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
| 21 |
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|
| 22 |
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
| 23 |
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
| 24 |
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
| 25 |
+# SOFTWARE. |
|
| 23 | 26 |
# |
| 24 |
-# Free Software Foundation, Inc., |
|
| 25 |
-# 51 Franklin Street, Fifth Floor, |
|
| 26 |
-# Boston, MA |
|
| 27 |
-# 02110-1301 |
|
| 28 |
-# USA |
|
| 27 |
+# http://www.opensource.org/licenses/mit-license.php |
|
| 29 | 28 |
# |
| 30 | 29 |
typeset -g _task_cmds _task_projects _task_tags _task_config _task_modifiers |
| 31 | 30 |
_task_projects=($(task _projects)) |
| 32 | 31 |
_task_tags=($(task _tags)) |
| 33 | 32 |
_task_ids=($(task _ids)) |
| 34 | 33 |
_task_config=($(task _config)) |
| 34 |
+_task_columns=($(task _columns)) |
|
| 35 | 35 |
_task_modifiers=( |
| 36 | 36 |
'before' \ |
| 37 | 37 |
'after' \ |
| ... | ... |
@@ -46,39 +46,19 @@ _task_modifiers=( |
| 46 | 46 |
'word' \ |
| 47 | 47 |
'noword' |
| 48 | 48 |
) |
| 49 |
+_task_conjunctions=( |
|
| 50 |
+ 'and' \ |
|
| 51 |
+ 'or' \ |
|
| 52 |
+ 'xor' \ |
|
| 53 |
+ '\)' |
|
| 54 |
+ '\('
|
|
| 55 |
+) |
|
| 49 | 56 |
_task_cmds=($(task _commands)) |
| 50 | 57 |
_task_zshcmds=( ${(f)"$(task _zshcommands)"} )
|
| 51 | 58 |
|
| 52 |
- |
|
| 53 |
-_task_idCmds=( |
|
| 54 |
- 'append' \ |
|
| 55 |
- 'prepend' \ |
|
| 56 |
- 'annotate' \ |
|
| 57 |
- 'denotate' \ |
|
| 58 |
- 'edit' \ |
|
| 59 |
- 'duplicate' \ |
|
| 60 |
- 'info' \ |
|
| 61 |
- 'start' \ |
|
| 62 |
- 'stop' \ |
|
| 63 |
- 'done' |
|
| 64 |
-) |
|
| 65 |
- |
|
| 66 |
-_task_idCmdsDesc=( |
|
| 67 |
- 'append:Appends more description to an existing task.' \ |
|
| 68 |
- 'prepend:Prepends more description to an existing task.' \ |
|
| 69 |
- 'annotate:Adds an annotation to an existing task.' \ |
|
| 70 |
- 'denotate:Deletes an annotation of an existing task.' \ |
|
| 71 |
- 'edit:Launches an editor to let you modify a task directly.' \ |
|
| 72 |
- 'duplicate:Duplicates the specified task, and allows modifications.' \ |
|
| 73 |
- 'info:Shows all data, metadata for specified task.' \ |
|
| 74 |
- 'start:Marks specified task as started.' \ |
|
| 75 |
- 'stop:Removes the start time from a task.' \ |
|
| 76 |
- 'done:Marks the specified task as completed.' |
|
| 77 |
-) |
|
| 78 |
- |
|
| 79 | 59 |
_task() {
|
| 80 | 60 |
_arguments -s -S \ |
| 81 |
- "*::task command:_task_commands" |
|
| 61 |
+ "*::task default:_task_default" |
|
| 82 | 62 |
return 0 |
| 83 | 63 |
} |
| 84 | 64 |
|
| ... | ... |
@@ -148,6 +128,7 @@ _regex_words values 'task frequencies' \ |
| 148 | 148 |
'weekly:Every week' \ |
| 149 | 149 |
'biweekly:Every two weeks' \ |
| 150 | 150 |
'fortnight:Every two weeks' \ |
| 151 |
++ 'monthly:Every month' \ |
|
| 151 | 152 |
'quarterly:Every three months' \ |
| 152 | 153 |
'semiannual:Every six months' \ |
| 153 | 154 |
'annual:Every year' \ |
| ... | ... |
@@ -196,22 +177,13 @@ _regex_arguments _task_attributes "${args[@]}"
|
| 196 | 196 |
|
| 197 | 197 |
## task commands |
| 198 | 198 |
|
| 199 |
-# default completion |
|
| 200 |
-(( $+functions[_task_default] )) || |
|
| 201 |
-_task_default() {
|
|
| 199 |
+# filter completion |
|
| 200 |
+(( $+functions[_task_filter] )) || |
|
| 201 |
+_task_filter() {
|
|
| 202 | 202 |
_task_attributes "$@" |
| 203 |
-} |
|
| 204 | 203 |
|
| 205 |
-# commands expecting an ID |
|
| 206 |
-(( $+functions[_task_id] )) || |
|
| 207 |
-_task_id() {
|
|
| 208 |
- if (( CURRENT < 3 )); then |
|
| 209 |
- # update IDs |
|
| 210 |
- _task_zshids=( ${(f)"$(task _zshids)"} )
|
|
| 211 |
- _describe -t values 'task IDs' _task_zshids |
|
| 212 |
- else |
|
| 213 |
- _task_attributes "$@" |
|
| 214 |
- fi |
|
| 204 |
+ # TODO complete conjunctions only if the previous word is a filter expression, i.e. attribute, ID, any non-command |
|
| 205 |
+ _describe -t default 'task conjunctions' _task_conjunctions |
|
| 215 | 206 |
} |
| 216 | 207 |
|
| 217 | 208 |
# merge completion |
| ... | ... |
@@ -235,46 +207,42 @@ _task_pull() {
|
| 235 | 235 |
_files |
| 236 | 236 |
} |
| 237 | 237 |
|
| 238 |
+# execute completion |
|
| 239 |
+(( $+functions[_task_execute] )) || |
|
| 240 |
+_task_execute() {
|
|
| 241 |
+ _files |
|
| 242 |
+} |
|
| 238 | 243 |
|
| 239 |
-# modify (task [0-9]* ...) completion |
|
| 240 |
-(( $+functions[_task_modify] )) || |
|
| 241 |
-_task_modify() {
|
|
| 242 |
- _describe -t commands 'task command' _task_idCmdsDesc |
|
| 243 |
- _task_attributes "$@" |
|
| 244 |
+# id-only completion |
|
| 245 |
+(( $+functions[_task_id] )) || |
|
| 246 |
+_task_id() {
|
|
| 247 |
+ _describe -t values 'task IDs' _task_zshids |
|
| 244 | 248 |
} |
| 245 | 249 |
|
| 246 | 250 |
## first level completion => task sub-command completion |
| 247 |
-(( $+functions[_task_commands] )) || |
|
| 248 |
-_task_commands() {
|
|
| 251 |
+(( $+functions[_task_default] )) || |
|
| 252 |
+_task_default() {
|
|
| 249 | 253 |
local cmd ret=1 |
| 250 |
- if (( CURRENT == 1 )); then |
|
| 251 |
- # update IDs |
|
| 252 |
- _task_zshids=( ${(f)"$(task _zshids)"} )
|
|
| 253 |
- |
|
| 254 |
- _describe -t commands 'task command' _task_zshcmds |
|
| 255 |
- _describe -t values 'task IDs' _task_zshids |
|
| 256 |
- # TODO match more than one ID |
|
| 257 |
- elif [[ $words[1] =~ ^[0-9]*$ ]] then |
|
| 258 |
- _call_function ret _task_modify |
|
| 259 |
- return ret |
|
| 260 |
- else |
|
| 261 |
-# local curcontext="${curcontext}"
|
|
| 262 |
-# cmd="${_task_cmds[(r)$words[1]:*]%%:*}"
|
|
| 263 |
- cmd="${_task_cmds[(r)$words[1]]}"
|
|
| 264 |
- idCmd="${(M)_task_idCmds[@]:#$words[1]}"
|
|
| 265 |
- if (( $#cmd )); then |
|
| 266 |
-# curcontext="${curcontext%:*:*}:task-${cmd}"
|
|
| 267 | 254 |
|
| 268 |
- if (( $#idCmd )); then |
|
| 269 |
- _call_function ret _task_id |
|
| 270 |
- else |
|
| 271 |
- _call_function ret _task_${cmd} ||
|
|
| 272 |
- _call_function ret _task_default || |
|
| 273 |
- _message "No command remaining." |
|
| 274 |
- fi |
|
| 275 |
- else |
|
| 276 |
- _message "Unknown subcommand ${cmd}"
|
|
| 277 |
- fi |
|
| 278 |
- return ret |
|
| 279 |
- fi |
|
| 255 |
+ integer i=1 |
|
| 256 |
+ while (( i < $#words )) |
|
| 257 |
+ do |
|
| 258 |
+ cmd="${_task_cmds[(r)$words[$i]]}"
|
|
| 259 |
+ if (( $#cmd )); then |
|
| 260 |
+ _call_function ret _task_${cmd} ||
|
|
| 261 |
+ _call_function ret _task_filter || |
|
| 262 |
+ _message "No command remaining." |
|
| 263 |
+ return ret |
|
| 264 |
+ fi |
|
| 265 |
+ (( i++ )) |
|
| 266 |
+ done |
|
| 267 |
+ |
|
| 268 |
+ # update IDs |
|
| 269 |
+ _task_zshids=( ${(f)"$(task _zshids)"} )
|
|
| 270 |
+ |
|
| 271 |
+ _describe -t commands 'task command' _task_zshcmds |
|
| 272 |
+ _describe -t values 'task IDs' _task_zshids |
|
| 273 |
+ _call_function ret _task_filter |
|
| 274 |
+ |
|
| 275 |
+ return ret |
|
| 280 | 276 |
} |
| 281 | 277 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,11 @@ |
| 0 |
+# Set Apple Terminal.app resume directory |
|
| 1 |
+# based on this answer: http://superuser.com/a/315029 |
|
| 2 |
+ |
|
| 3 |
+function chpwd {
|
|
| 4 |
+ local SEARCH=' ' |
|
| 5 |
+ local REPLACE='%20' |
|
| 6 |
+ local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
|
|
| 7 |
+ printf '\e]7;%s\a' "$PWD_URL" |
|
| 8 |
+} |
|
| 9 |
+ |
|
| 10 |
+chpwd |
|
| 0 | 11 |
\ No newline at end of file |
| 1 | 12 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,29 @@ |
| 0 |
+This plugin provides a wrapper around the "wakeonlan" tool available from most |
|
| 1 |
+distributions' package repositories, or from the following website: |
|
| 2 |
+ |
|
| 3 |
+http://gsd.di.uminho.pt/jpo/software/wakeonlan/ |
|
| 4 |
+ |
|
| 5 |
+In order to use this wrapper, create the ~/.wakeonlan directory, and place in |
|
| 6 |
+that directory one file for each device you would like to be able to wake. Give |
|
| 7 |
+the file a name that describes the device, such as its hostname. Each file |
|
| 8 |
+should contain a line with the mac address of the target device and the network |
|
| 9 |
+broadcast address. |
|
| 10 |
+ |
|
| 11 |
+For instance, there might be a file ~/.wakeonlan/leto with the following |
|
| 12 |
+contents: |
|
| 13 |
+ |
|
| 14 |
+00:11:22:33:44:55:66 192.168.0.255 |
|
| 15 |
+ |
|
| 16 |
+To wake that device, use the following command: |
|
| 17 |
+ |
|
| 18 |
+# wake leto |
|
| 19 |
+ |
|
| 20 |
+The available device names will be autocompleted, so: |
|
| 21 |
+ |
|
| 22 |
+# wake <tab> |
|
| 23 |
+ |
|
| 24 |
+...will suggest "leto", along with any other configuration files that were |
|
| 25 |
+placed in the ~/.wakeonlan directory. |
|
| 26 |
+ |
|
| 27 |
+For more information regarding the configuration file format, check the |
|
| 28 |
+wakeonlan man page. |
| 0 | 4 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,14 @@ |
| 0 |
+function wake() {
|
|
| 1 |
+ local config_file="$HOME/.wakeonlan/$1" |
|
| 2 |
+ if [[ ! -f "$config_file" ]]; then |
|
| 3 |
+ echo "ERROR: There is no configuration file at \"$config_file\"." |
|
| 4 |
+ return 1 |
|
| 5 |
+ fi |
|
| 6 |
+ |
|
| 7 |
+ if (( ! $+commands[wakeonlan] )); then |
|
| 8 |
+ echo "ERROR: Can't find \"wakeonlan\". Are you sure it's installed?" |
|
| 9 |
+ return 1 |
|
| 10 |
+ fi |
|
| 11 |
+ |
|
| 12 |
+ wakeonlan -f "$config_file" |
|
| 13 |
+} |
| ... | ... |
@@ -7,6 +7,10 @@ ZSH=$HOME/.oh-my-zsh |
| 7 | 7 |
# time that oh-my-zsh is loaded. |
| 8 | 8 |
ZSH_THEME="robbyrussell" |
| 9 | 9 |
|
| 10 |
+# Example aliases |
|
| 11 |
+# alias zshconfig="mate ~/.zshrc" |
|
| 12 |
+# alias ohmyzsh="mate ~/.oh-my-zsh" |
|
| 13 |
+ |
|
| 10 | 14 |
# Set to this to use case-sensitive completion |
| 11 | 15 |
# CASE_SENSITIVE="true" |
| 12 | 16 |
|
| ... | ... |
@@ -23,6 +27,7 @@ ZSH_THEME="robbyrussell" |
| 23 | 23 |
# COMPLETION_WAITING_DOTS="true" |
| 24 | 24 |
|
| 25 | 25 |
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) |
| 26 |
+# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ |
|
| 26 | 27 |
# Example format: plugins=(rails git textmate ruby lighthouse) |
| 27 | 28 |
plugins=(git) |
| 28 | 29 |
|
| ... | ... |
@@ -1,7 +1,14 @@ |
| 1 | 1 |
|
| 2 | 2 |
local user='%{$fg[magenta]%}%n@%{$fg[magenta]%}%m%{$reset_color%}'
|
| 3 | 3 |
local pwd='%{$fg[blue]%}%~%{$reset_color%}'
|
| 4 |
-local rvm='%{$fg[green]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
|
|
| 4 |
+local rvm='' |
|
| 5 |
+if which rvm-prompt &> /dev/null; then |
|
| 6 |
+ rvm='%{$fg[green]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
|
|
| 7 |
+else |
|
| 8 |
+ if which rbenv &> /dev/null; then |
|
| 9 |
+ rvm='%{$fg[green]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}'
|
|
| 10 |
+ fi |
|
| 11 |
+fi |
|
| 5 | 12 |
local return_code='%(?..%{$fg[red]%}%? ↵%{$reset_color%})'
|
| 6 | 13 |
local git_branch='$(git_prompt_status)%{$reset_color%}$(git_prompt_info)%{$reset_color%}'
|
| 7 | 14 |
|
| ... | ... |
@@ -19,4 +26,3 @@ ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭"
|
| 19 | 19 |
|
| 20 | 20 |
PROMPT="${user} ${pwd}$ "
|
| 21 | 21 |
RPROMPT="${return_code} ${git_branch} ${rvm}"
|
| 22 |
- |
| ... | ... |
@@ -2,7 +2,7 @@ function toon {
|
| 2 | 2 |
echo -n "" |
| 3 | 3 |
} |
| 4 | 4 |
|
| 5 |
-get_git_dirty() {
|
|
| 5 |
+get_git_dirty() {
|
|
| 6 | 6 |
git diff --quiet || echo '*' |
| 7 | 7 |
} |
| 8 | 8 |
|
| ... | ... |
@@ -18,9 +18,12 @@ zstyle ':vcs_info:*' formats \ |
| 18 | 18 |
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
|
| 19 | 19 |
zstyle ':vcs_info:*' enable git cvs svn |
| 20 | 20 |
|
| 21 |
-precmd () {
|
|
| 21 |
+theme_precmd () {
|
|
| 22 | 22 |
vcs_info |
| 23 | 23 |
} |
| 24 | 24 |
|
| 25 | 25 |
setopt prompt_subst |
| 26 | 26 |
PROMPT='%{$fg[magenta]%}$(toon)%{$reset_color%} %~/ %{$reset_color%}${vcs_info_msg_0_}%{$reset_color%}'
|
| 27 |
+ |
|
| 28 |
+autoload -U add-zsh-hook |
|
| 29 |
+add-zsh-hook precmd theme_precmd |
|
| 27 | 30 |
\ No newline at end of file |
| ... | ... |
@@ -3,7 +3,14 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
| 3 | 3 |
|
| 4 | 4 |
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
|
| 5 | 5 |
local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}'
|
| 6 |
-local rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
|
|
| 6 |
+local rvm_ruby='' |
|
| 7 |
+if which rvm-prompt &> /dev/null; then |
|
| 8 |
+ rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
|
|
| 9 |
+else |
|
| 10 |
+ if which rbenv &> /dev/null; then |
|
| 11 |
+ rvm_ruby='%{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}'
|
|
| 12 |
+ fi |
|
| 13 |
+fi |
|
| 7 | 14 |
local git_branch='$(git_prompt_info)%{$reset_color%}'
|
| 8 | 15 |
|
| 9 | 16 |
PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
|
| ... | ... |
@@ -29,7 +29,13 @@ ZSH_THEME_GIT_PROMPT_DIRTY=" $CRUNCH_GIT_DIRTY_COLOR✗" |
| 29 | 29 |
|
| 30 | 30 |
# Our elements: |
| 31 | 31 |
CRUNCH_TIME_="$CRUNCH_BRACKET_COLOR{$CRUNCH_TIME_COLOR%T$CRUNCH_BRACKET_COLOR}%{$reset_color%}"
|
| 32 |
-CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(~/.rvm/bin/rvm-prompt i v g)#ruby-}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}"
|
|
| 32 |
+if which rvm-prompt &> /dev/null; then |
|
| 33 |
+ CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(~/.rvm/bin/rvm-prompt i v g)#ruby-}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}"
|
|
| 34 |
+else |
|
| 35 |
+ if which rbenv &> /dev/null; then |
|
| 36 |
+ CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(rbenv version | sed -e 's/ (set.*$//' -e 's/^ruby-//')}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}"
|
|
| 37 |
+ fi |
|
| 38 |
+fi |
|
| 33 | 39 |
CRUNCH_DIR_="$CRUNCH_DIR_COLOR%~\$(git_prompt_info) " |
| 34 | 40 |
CRUNCH_PROMPT="$CRUNCH_BRACKET_COLOR➭ " |
| 35 | 41 |
|
| ... | ... |
@@ -3,7 +3,13 @@ |
| 3 | 3 |
# Grab the current date (%D) and time (%T) wrapped in {}: {%D %T}
|
| 4 | 4 |
DALLAS_CURRENT_TIME_="%{$fg[white]%}{%{$fg[yellow]%}%D %T%{$fg[white]%}}%{$reset_color%}"
|
| 5 | 5 |
# Grab the current version of ruby in use (via RVM): [ruby-1.8.7] |
| 6 |
-DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}"
|
|
| 6 |
+if which rvm-prompt &> /dev/null; then |
|
| 7 |
+ DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}"
|
|
| 8 |
+else |
|
| 9 |
+ if which rbenv &> /dev/null; then |
|
| 10 |
+ DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$fg[white]%}]%{$reset_color%}"
|
|
| 11 |
+ fi |
|
| 12 |
+fi |
|
| 7 | 13 |
# Grab the current machine name: muscato |
| 8 | 14 |
DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}"
|
| 9 | 15 |
# Grab the current filepath, use shortcuts: ~/Desktop |
| ... | ... |
@@ -1,6 +1,10 @@ |
| 1 | 1 |
#RVM settings |
| 2 | 2 |
if [[ -s ~/.rvm/scripts/rvm ]] ; then |
| 3 | 3 |
RPS1="%{$fg[yellow]%}rvm:%{$reset_color%}%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt)%{$reset_color%} $EPS1"
|
| 4 |
+else |
|
| 5 |
+ if which rbenv &> /dev/null; then |
|
| 6 |
+ RPS1="%{$fg[yellow]%}rbenv:%{$reset_color%}%{$fg[red]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$reset_color%} $EPS1"
|
|
| 7 |
+ fi |
|
| 4 | 8 |
fi |
| 5 | 9 |
|
| 6 | 10 |
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}["
|
| ... | ... |
@@ -25,7 +25,14 @@ function box_name {
|
| 25 | 25 |
} |
| 26 | 26 |
|
| 27 | 27 |
|
| 28 |
-local rvm_ruby='‹$(rvm-prompt i v g)›%{$reset_color%}'
|
|
| 28 |
+local rvm_ruby='' |
|
| 29 |
+if which rvm-prompt &> /dev/null; then |
|
| 30 |
+ rvm_ruby='‹$(rvm-prompt i v g)›%{$reset_color%}'
|
|
| 31 |
+else |
|
| 32 |
+ if which rbenv &> /dev/null; then |
|
| 33 |
+ rvm_ruby='‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}'
|
|
| 34 |
+ fi |
|
| 35 |
+fi |
|
| 29 | 36 |
local current_dir='${PWD/#$HOME/~}'
|
| 30 | 37 |
local git_info='$(git_prompt_info)' |
| 31 | 38 |
|
| ... | ... |
@@ -14,6 +14,12 @@ git_custom_status() {
|
| 14 | 14 |
#RVM and git settings |
| 15 | 15 |
if [[ -s ~/.rvm/scripts/rvm ]] ; then |
| 16 | 16 |
RPS1='$(git_custom_status)%{$fg[red]%}[`~/.rvm/bin/rvm-prompt`]%{$reset_color%} $EPS1'
|
| 17 |
+else |
|
| 18 |
+ if which rbenv &> /dev/null; then |
|
| 19 |
+ RPS1='$(git_custom_status)%{$fg[red]%}[`rbenv version | sed -e "s/ (set.*$//"`]%{$reset_color%} $EPS1'
|
|
| 20 |
+ else |
|
| 21 |
+ RPS1='$(git_custom_status) $EPS1' |
|
| 22 |
+ fi |
|
| 17 | 23 |
fi |
| 18 | 24 |
|
| 19 | 25 |
PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b '
|
| ... | ... |
@@ -1,19 +1,19 @@ |
| 1 |
-function precmd {
|
|
| 1 |
+function theme_precmd {
|
|
| 2 | 2 |
local TERMWIDTH |
| 3 | 3 |
(( TERMWIDTH = ${COLUMNS} - 1 ))
|
| 4 | 4 |
|
| 5 | 5 |
|
| 6 | 6 |
### |
| 7 | 7 |
# Truncate the path if it's too long. |
| 8 |
- |
|
| 8 |
+ |
|
| 9 | 9 |
PR_FILLBAR="" |
| 10 | 10 |
PR_PWDLEN="" |
| 11 |
- |
|
| 11 |
+ |
|
| 12 | 12 |
local promptsize=${#${(%):---(%n@%m:%l)---()--}}
|
| 13 |
- local rubyprompt=`rvm_prompt_info` |
|
| 13 |
+ local rubyprompt=`rvm_prompt_info || rbenv_prompt_info` |
|
| 14 | 14 |
local rubypromptsize=${#${rubyprompt}}
|
| 15 | 15 |
local pwdsize=${#${(%):-%~}}
|
| 16 |
- |
|
| 16 |
+ |
|
| 17 | 17 |
if [[ "$promptsize + $rubypromptsize + $pwdsize" -gt $TERMWIDTH ]]; then |
| 18 | 18 |
((PR_PWDLEN=$TERMWIDTH - $promptsize)) |
| 19 | 19 |
else |
| ... | ... |
@@ -24,7 +24,7 @@ function precmd {
|
| 24 | 24 |
|
| 25 | 25 |
|
| 26 | 26 |
setopt extended_glob |
| 27 |
-preexec () {
|
|
| 27 |
+theme_preexec () {
|
|
| 28 | 28 |
if [[ "$TERM" == "screen" ]]; then |
| 29 | 29 |
local CMD=${1[(wr)^(*=*|sudo|-*)]}
|
| 30 | 30 |
echo -n "\ek$CMD\e\\" |
| ... | ... |
@@ -69,7 +69,7 @@ setprompt () {
|
| 69 | 69 |
|
| 70 | 70 |
### |
| 71 | 71 |
# See if we can use extended characters to look nicer. |
| 72 |
- |
|
| 72 |
+ |
|
| 73 | 73 |
typeset -A altchar |
| 74 | 74 |
set -A altchar ${(s..)terminfo[acsc]}
|
| 75 | 75 |
PR_SET_CHARSET="%{$terminfo[enacs]%}"
|
| ... | ... |
@@ -81,10 +81,10 @@ setprompt () {
|
| 81 | 81 |
PR_LRCORNER=${altchar[j]:--}
|
| 82 | 82 |
PR_URCORNER=${altchar[k]:--}
|
| 83 | 83 |
|
| 84 |
- |
|
| 84 |
+ |
|
| 85 | 85 |
### |
| 86 | 86 |
# Decide if we need to set titlebar text. |
| 87 |
- |
|
| 87 |
+ |
|
| 88 | 88 |
case $TERM in |
| 89 | 89 |
xterm*) |
| 90 | 90 |
PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}'
|
| ... | ... |
@@ -96,8 +96,8 @@ setprompt () {
|
| 96 | 96 |
PR_TITLEBAR='' |
| 97 | 97 |
;; |
| 98 | 98 |
esac |
| 99 |
- |
|
| 100 |
- |
|
| 99 |
+ |
|
| 100 |
+ |
|
| 101 | 101 |
### |
| 102 | 102 |
# Decide whether to set a screen title |
| 103 | 103 |
if [[ "$TERM" == "screen" ]]; then |
| ... | ... |
@@ -105,15 +105,15 @@ setprompt () {
|
| 105 | 105 |
else |
| 106 | 106 |
PR_STITLE='' |
| 107 | 107 |
fi |
| 108 |
- |
|
| 109 |
- |
|
| 108 |
+ |
|
| 109 |
+ |
|
| 110 | 110 |
### |
| 111 | 111 |
# Finally, the prompt. |
| 112 | 112 |
|
| 113 | 113 |
PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\
|
| 114 | 114 |
$PR_CYAN$PR_SHIFT_IN$PR_ULCORNER$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\ |
| 115 | 115 |
$PR_GREEN%$PR_PWDLEN<...<%~%<<\ |
| 116 |
-$PR_GREY)`rvm_prompt_info`$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_HBAR${(e)PR_FILLBAR}$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\
|
|
| 116 |
+$PR_GREY)`rvm_prompt_info || rbenv_prompt_info`$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_HBAR${(e)PR_FILLBAR}$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\
|
|
| 117 | 117 |
$PR_CYAN%(!.%SROOT%s.%n)$PR_GREY@$PR_GREEN%m:%l\ |
| 118 | 118 |
$PR_GREY)$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_URCORNER$PR_SHIFT_OUT\ |
| 119 | 119 |
|
| ... | ... |
@@ -135,3 +135,7 @@ $PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT$PR_NO_COLOUR ' |
| 135 | 135 |
} |
| 136 | 136 |
|
| 137 | 137 |
setprompt |
| 138 |
+ |
|
| 139 |
+autoload -U add-zsh-hook |
|
| 140 |
+add-zsh-hook precmd theme_precmd |
|
| 141 |
+add-zsh-hook preexec theme_preexec |
|
| 138 | 142 |
\ No newline at end of file |
| ... | ... |
@@ -10,7 +10,7 @@ function josh_prompt {
|
| 10 | 10 |
prompt=" " |
| 11 | 11 |
|
| 12 | 12 |
branch=$(current_branch) |
| 13 |
- ruby_version=$(rvm_prompt_info) |
|
| 13 |
+ ruby_version=$(rvm_prompt_info || rbenv_prompt_info) |
|
| 14 | 14 |
path_size=${#PWD}
|
| 15 | 15 |
branch_size=${#branch}
|
| 16 | 16 |
ruby_size=${#ruby_version}
|
| ... | ... |
@@ -31,7 +31,7 @@ function josh_prompt {
|
| 31 | 31 |
prompt=" $prompt" |
| 32 | 32 |
done |
| 33 | 33 |
|
| 34 |
- prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info)%{$reset_color%} $(git_prompt_info)"
|
|
| 34 |
+ prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%} $(git_prompt_info)"
|
|
| 35 | 35 |
|
| 36 | 36 |
echo $prompt |
| 37 | 37 |
} |
| ... | ... |
@@ -7,7 +7,7 @@ zstyle ':vcs_info:*' unstagedstr '%F{yellow}●'
|
| 7 | 7 |
zstyle ':vcs_info:*' check-for-changes true |
| 8 | 8 |
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r'
|
| 9 | 9 |
zstyle ':vcs_info:*' enable git svn |
| 10 |
-precmd () {
|
|
| 10 |
+theme_precmd () {
|
|
| 11 | 11 |
if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] {
|
| 12 | 12 |
zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{green}]'
|
| 13 | 13 |
} else {
|
| ... | ... |
@@ -19,3 +19,6 @@ precmd () {
|
| 19 | 19 |
|
| 20 | 20 |
setopt prompt_subst |
| 21 | 21 |
PROMPT='%B%F{magenta}%c%B%F{green}${vcs_info_msg_0_}%B%F{magenta} %{$reset_color%}%% '
|
| 22 |
+ |
|
| 23 |
+autoload -U add-zsh-hook |
|
| 24 |
+add-zsh-hook precmd theme_precmd |
| ... | ... |
@@ -1,7 +1,14 @@ |
| 1 | 1 |
# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png |
| 2 | 2 |
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
| 3 | 3 |
|
| 4 |
-PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b '
|
|
| 4 |
+if which rvm-prompt &> /dev/null; then |
|
| 5 |
+ PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b '
|
|
| 6 |
+else |
|
| 7 |
+ if which rbenv &> /dev/null; then |
|
| 8 |
+ PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b '
|
|
| 9 |
+ fi |
|
| 10 |
+fi |
|
| 11 |
+ |
|
| 5 | 12 |
RPS1="${return_code}"
|
| 6 | 13 |
|
| 7 | 14 |
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
|
| ... | ... |
@@ -1,7 +1,13 @@ |
| 1 | 1 |
# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png |
| 2 | 2 |
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
| 3 | 3 |
|
| 4 |
-PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b '
|
|
| 4 |
+if which rvm-prompt &> /dev/null; then |
|
| 5 |
+ PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b '
|
|
| 6 |
+else |
|
| 7 |
+ if which rbenv &> /dev/null; then |
|
| 8 |
+ PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b '
|
|
| 9 |
+ fi |
|
| 10 |
+fi |
|
| 5 | 11 |
RPS1="${return_code}"
|
| 6 | 12 |
|
| 7 | 13 |
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
|
| 8 | 14 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,24 @@ |
| 0 |
+# mh theme |
|
| 1 |
+# preview: http://cl.ly/1y2x0W0E3t2C0F29043z |
|
| 2 |
+ |
|
| 3 |
+# features: |
|
| 4 |
+# path is autoshortened to ~30 characters |
|
| 5 |
+# displays git status (if applicable in current folder) |
|
| 6 |
+# turns username green if superuser, otherwise it is white |
|
| 7 |
+ |
|
| 8 |
+# if superuser make the username green |
|
| 9 |
+if [ $UID -eq 0 ]; then NCOLOR="green"; else NCOLOR="white"; fi |
|
| 10 |
+ |
|
| 11 |
+# prompt |
|
| 12 |
+PROMPT='[%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[red]%}%30<...<%~%<<%{$reset_color%}]%(!.#.$) '
|
|
| 13 |
+RPROMPT='$(git_prompt_info)' |
|
| 14 |
+ |
|
| 15 |
+# git theming |
|
| 16 |
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[gray]%}(%{$fg_no_bold[yellow]%}%B"
|
|
| 17 |
+ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[gray]%})%{$reset_color%} "
|
|
| 18 |
+ZSH_THEME_GIT_PROMPT_CLEAN="" |
|
| 19 |
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}✱"
|
|
| 20 |
+ |
|
| 21 |
+# LS colors, made with http://geoff.greer.fm/lscolors/ |
|
| 22 |
+export LSCOLORS="Gxfxcxdxbxegedabagacad" |
|
| 23 |
+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:' |
| 0 | 24 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,58 @@ |
| 0 |
+function my_git_prompt() {
|
|
| 1 |
+ tester=$(git rev-parse --git-dir 2> /dev/null) || return |
|
| 2 |
+ |
|
| 3 |
+ INDEX=$(git status --porcelain 2> /dev/null) |
|
| 4 |
+ STATUS="" |
|
| 5 |
+ |
|
| 6 |
+ # is branch ahead? |
|
| 7 |
+ if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then |
|
| 8 |
+ STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" |
|
| 9 |
+ fi |
|
| 10 |
+ |
|
| 11 |
+ # is anything staged? |
|
| 12 |
+ if $(echo "$INDEX" | grep -E -e '^(D[ M]|[MARC][ MD]) ' &> /dev/null); then |
|
| 13 |
+ STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED" |
|
| 14 |
+ fi |
|
| 15 |
+ |
|
| 16 |
+ # is anything unstaged? |
|
| 17 |
+ if $(echo "$INDEX" | grep -E -e '^[ MARC][MD] ' &> /dev/null); then |
|
| 18 |
+ STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED" |
|
| 19 |
+ fi |
|
| 20 |
+ |
|
| 21 |
+ # is anything untracked? |
|
| 22 |
+ if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then |
|
| 23 |
+ STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED" |
|
| 24 |
+ fi |
|
| 25 |
+ |
|
| 26 |
+ # is anything unmerged? |
|
| 27 |
+ if $(echo "$INDEX" | grep -E -e '^(A[AU]|D[DU]|U[ADU]) ' &> /dev/null); then |
|
| 28 |
+ STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED" |
|
| 29 |
+ fi |
|
| 30 |
+ |
|
| 31 |
+ if [[ -n $STATUS ]]; then |
|
| 32 |
+ STATUS=" $STATUS" |
|
| 33 |
+ fi |
|
| 34 |
+ |
|
| 35 |
+ echo "$ZSH_THEME_GIT_PROMPT_PREFIX$(my_current_branch)$STATUS$ZSH_THEME_GIT_PROMPT_SUFFIX" |
|
| 36 |
+} |
|
| 37 |
+ |
|
| 38 |
+function my_current_branch() {
|
|
| 39 |
+ echo $(current_branch || echo "(no branch)") |
|
| 40 |
+} |
|
| 41 |
+ |
|
| 42 |
+function ssh_connection() {
|
|
| 43 |
+ if [[ -n $SSH_CONNECTION ]]; then |
|
| 44 |
+ echo "%{$fg_bold[red]%}(ssh) "
|
|
| 45 |
+ fi |
|
| 46 |
+} |
|
| 47 |
+ |
|
| 48 |
+PROMPT=$'\n$(ssh_connection)%{$fg_bold[green]%}%n@%m%{$reset_color%}$(my_git_prompt) : %~\n%# '
|
|
| 49 |
+ |
|
| 50 |
+ZSH_THEME_PROMPT_RETURNCODE_PREFIX="%{$fg_bold[red]%}"
|
|
| 51 |
+ZSH_THEME_GIT_PROMPT_PREFIX=" $fg[white]‹ %{$fg_bold[yellow]%}"
|
|
| 52 |
+ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg_bold[magenta]%}↑"
|
|
| 53 |
+ZSH_THEME_GIT_PROMPT_STAGED="%{$fg_bold[green]%}●"
|
|
| 54 |
+ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg_bold[red]%}●"
|
|
| 55 |
+ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[white]%}●"
|
|
| 56 |
+ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg_bold[red]%}✕"
|
|
| 57 |
+ZSH_THEME_GIT_PROMPT_SUFFIX=" $fg_bold[white]›%{$reset_color%}"
|
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
| 2 | 2 |
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
|
| 3 | 3 |
local current_dir='%{$terminfo[bold]$fg[blue]%}%~%{$reset_color%}'
|
| 4 |
-local rvm_ruby='%{$fg[red]%}$(rvm_prompt_info)%{$reset_color%}'
|
|
| 4 |
+local rvm_ruby='%{$fg[red]%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%}'
|
|
| 5 | 5 |
local git_branch='%{$fg[blue]%}$(git_prompt_info)%{$reset_color%}'
|
| 6 | 6 |
|
| 7 | 7 |
PROMPT="${user_host}:${current_dir} ${rvm_ruby}
|
| ... | ... |
@@ -4,6 +4,10 @@ |
| 4 | 4 |
# Get the current ruby version in use with RVM: |
| 5 | 5 |
if [ -e ~/.rvm/bin/rvm-prompt ]; then |
| 6 | 6 |
RUBY_PROMPT_="%{$fg_bold[blue]%}rvm:(%{$fg[green]%}\$(~/.rvm/bin/rvm-prompt s i v g)%{$fg_bold[blue]%})%{$reset_color%} "
|
| 7 |
+else |
|
| 8 |
+ if which rbenv &> /dev/null; then |
|
| 9 |
+ RUBY_PROMPT_="%{$fg_bold[blue]%}rvm:(%{$fg[green]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$fg_bold[blue]%})%{$reset_color%} "
|
|
| 10 |
+ fi |
|
| 7 | 11 |
fi |
| 8 | 12 |
|
| 9 | 13 |
# Get the host name (first 4 chars) |
| 10 | 14 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,9 @@ |
| 0 |
+# Yay! High voltage and arrows! |
|
| 1 |
+ |
|
| 2 |
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}"
|
|
| 3 |
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
|
|
| 4 |
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}"
|
|
| 5 |
+ZSH_THEME_GIT_PROMPT_CLEAN="" |
|
| 6 |
+ |
|
| 7 |
+PROMPT='%{$fg[magenta]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}$(git_prompt_info)%{$fg[cyan]%}⇒%{$reset_color%} '
|
|
| 8 |
+ |
| ... | ... |
@@ -1,5 +1,11 @@ |
| 1 | 1 |
# Grab the current version of ruby in use (via RVM): [ruby-1.8.7] |
| 2 |
-JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}"
|
|
| 2 |
+if which rvm-prompt &> /dev/null; then |
|
| 3 |
+ JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}"
|
|
| 4 |
+else |
|
| 5 |
+ if which rbenv &> /dev/null; then |
|
| 6 |
+ JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$fg[white]%}]%{$reset_color%}"
|
|
| 7 |
+ fi |
|
| 8 |
+fi |
|
| 3 | 9 |
|
| 4 | 10 |
# Grab the current filepath, use shortcuts: ~/Desktop |
| 5 | 11 |
# Append the current git branch, if in a git repository |
| 6 | 12 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,30 @@ |
| 0 |
+function prompt_char {
|
|
| 1 |
+ git branch >/dev/null 2>/dev/null && echo '±' && return |
|
| 2 |
+ hg root >/dev/null 2>/dev/null && echo 'Hg' && return |
|
| 3 |
+ echo '○' |
|
| 4 |
+} |
|
| 5 |
+ |
|
| 6 |
+function virtualenv_info {
|
|
| 7 |
+ [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
|
|
| 8 |
+} |
|
| 9 |
+ |
|
| 10 |
+function collapse_pwd {
|
|
| 11 |
+ echo $(pwd | sed -e "s,^$HOME,~,") |
|
| 12 |
+} |
|
| 13 |
+ |
|
| 14 |
+if which rvm-prompt &> /dev/null; then |
|
| 15 |
+ PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) using %{$reset_color%}%{$fg[red]%}$(~/.rvm/bin/rvm-prompt)%{$reset_color%}
|
|
| 16 |
+$(virtualenv_info)$(prompt_char) ' |
|
| 17 |
+else |
|
| 18 |
+ if which rbenv &> /dev/null; then |
|
| 19 |
+ PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) using %{$reset_color%}%{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//")%{$reset_color%}
|
|
| 20 |
+$(virtualenv_info)$(prompt_char) ' |
|
| 21 |
+ fi |
|
| 22 |
+fi |
|
| 23 |
+ |
|
| 24 |
+ |
|
| 25 |
+ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}"
|
|
| 26 |
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
|
| 27 |
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!"
|
|
| 28 |
+ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?"
|
|
| 29 |
+ZSH_THEME_GIT_PROMPT_CLEAN="" |
| ... | ... |
@@ -2,4 +2,4 @@ ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}["
|
| 2 | 2 |
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%} "
|
| 3 | 3 |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%} x%{$fg_bold[blue]%}"
|
| 4 | 4 |
|
| 5 |
-PROMPT='%{$(git_prompt_info)%}%{$fg_bold[green]%}{%{$(rvm current)%}}%{$reset_color%} %{$fg[cyan]%}%c%{$reset_color%} '
|
|
| 5 |
+PROMPT='%{$(git_prompt_info)%}%{$fg_bold[green]%}{%{$(rvm current 2>/dev/null || rbenv version-name 2>/dev/null)%}}%{$reset_color%} %{$fg[cyan]%}%c%{$reset_color%} '
|
| 6 | 6 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,15 @@ |
| 0 |
+PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
|
|
| 1 |
+ |
|
| 2 |
+if which rvm-prompt &> /dev/null; then |
|
| 3 |
+ RPROMPT='%{$reset_color%} %{$fg[red]%}$(~/.rvm/bin/rvm-prompt i v g) %{$reset_color%}'
|
|
| 4 |
+else |
|
| 5 |
+ if which rbenv &> /dev/null; then |
|
| 6 |
+ RPROMPT='%{$reset_color%} %{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//") %{$reset_color%}'
|
|
| 7 |
+ fi |
|
| 8 |
+fi |
|
| 9 |
+ |
|
| 10 |
+ |
|
| 11 |
+ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[red]%}"
|
|
| 12 |
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
|
| 13 |
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
|
|
| 14 |
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
|
| ... | ... |
@@ -8,6 +8,12 @@ function _update_zsh_update() {
|
| 8 | 8 |
echo "LAST_EPOCH=$(_current_epoch)" > ~/.zsh-update |
| 9 | 9 |
} |
| 10 | 10 |
|
| 11 |
+function _upgrade_zsh() {
|
|
| 12 |
+ /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh |
|
| 13 |
+ # update the zsh file |
|
| 14 |
+ _update_zsh_update |
|
| 15 |
+} |
|
| 16 |
+ |
|
| 11 | 17 |
if [ -f ~/.zsh-update ] |
| 12 | 18 |
then |
| 13 | 19 |
. ~/.zsh-update |
| ... | ... |
@@ -19,17 +25,21 @@ then |
| 19 | 19 |
epoch_diff=$(($(_current_epoch) - $LAST_EPOCH)) |
| 20 | 20 |
if [ $epoch_diff -gt 6 ] |
| 21 | 21 |
then |
| 22 |
- echo "[Oh My Zsh] Would you like to check for updates?" |
|
| 23 |
- echo "Type Y to update oh-my-zsh: \c" |
|
| 24 |
- read line |
|
| 25 |
- if [ "$line" = Y ] || [ "$line" = y ] |
|
| 22 |
+ if [ "$DISABLE_UPDATE_PROMPT" = "true" ] |
|
| 26 | 23 |
then |
| 27 |
- /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh |
|
| 28 |
- # update the zsh file |
|
| 29 |
- _update_zsh_update |
|
| 24 |
+ _upgrade_zsh |
|
| 25 |
+ else |
|
| 26 |
+ echo "[Oh My Zsh] Would you like to check for updates?" |
|
| 27 |
+ echo "Type Y to update oh-my-zsh: \c" |
|
| 28 |
+ read line |
|
| 29 |
+ if [ "$line" = Y ] || [ "$line" = y ] |
|
| 30 |
+ then |
|
| 31 |
+ _upgrade_zsh |
|
| 32 |
+ fi |
|
| 30 | 33 |
fi |
| 31 | 34 |
fi |
| 32 | 35 |
else |
| 33 | 36 |
# create the zsh file |
| 34 | 37 |
_update_zsh_update |
| 35 | 38 |
fi |
| 39 |
+ |
| ... | ... |
@@ -1,12 +1,19 @@ |
| 1 | 1 |
current_path=`pwd` |
| 2 |
-echo -e "\033[0;34mUpgrading Oh My Zsh\033[0m" |
|
| 3 |
-( cd $ZSH && git pull origin master ) |
|
| 4 |
-echo -e "\033[0;32m"' __ __ '"\033[0m" |
|
| 5 |
-echo -e "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m" |
|
| 6 |
-echo -e "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m" |
|
| 7 |
-echo -e "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m" |
|
| 8 |
-echo -e "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m" |
|
| 9 |
-echo -e "\033[0;32m"' /____/ '"\033[0m" |
|
| 10 |
-echo -e "\033[0;34mHooray! Oh My Zsh has been updated and/or is at the current version.\033[0m" |
|
| 11 |
-echo -e "\033[0;34mTo keep up on the latest, be sure to follow Oh My Zsh on twitter: \033[1mhttp://twitter.com/ohmyzsh\033[0m" |
|
| 12 |
-cd "$current_path" |
|
| 2 |
+printf '\033[0;34m%s\033[0m\n' "Upgrading Oh My Zsh" |
|
| 3 |
+cd $ZSH |
|
| 4 |
+ |
|
| 5 |
+if git pull origin master |
|
| 6 |
+then |
|
| 7 |
+ printf '\033[0;32m%s\033[0m\n' ' __ __ ' |
|
| 8 |
+ printf '\033[0;32m%s\033[0m\n' ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' |
|
| 9 |
+ printf '\033[0;32m%s\033[0m\n' ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ ' |
|
| 10 |
+ printf '\033[0;32m%s\033[0m\n' '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / ' |
|
| 11 |
+ printf '\033[0;32m%s\033[0m\n' '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' |
|
| 12 |
+ printf '\033[0;32m%s\033[0m\n' ' /____/ ' |
|
| 13 |
+ printf '\033[0;34m%s\033[0m\n' 'Hooray! Oh My Zsh has been updated and/or is at the current version.' |
|
| 14 |
+ printf '\033[0;34m%s\033[1m%s\033[0m\n' 'To keep up on the latest, be sure to follow Oh My Zsh on twitter: ' 'http://twitter.com/ohmyzsh' |
|
| 15 |
+else |
|
| 16 |
+ printf '\033[0;31m%s\033[0m\n' 'There was an error updating. Try again later?' |
|
| 17 |
+fi |
|
| 18 |
+ |
|
| 19 |
+cd "$current_path" |
|
| 13 | 20 |
\ No newline at end of file |