mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-02 02:19:06 +01:00
Merge branch 'master' of git://github.com/robbyrussell/oh-my-zsh
This commit is contained in:
commit
f88ec8ed6b
29 changed files with 230 additions and 54 deletions
34
lib/git.zsh
34
lib/git.zsh
|
|
@ -4,15 +4,21 @@ function git_prompt_info() {
|
||||||
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Checks if working tree is dirty
|
# Checks if working tree is dirty
|
||||||
parse_git_dirty() {
|
parse_git_dirty() {
|
||||||
if [[ -n $(git status -s --ignore-submodules=dirty 2> /dev/null) ]]; then
|
local SUBMODULE_SYNTAX=''
|
||||||
|
if [[ $POST_1_7_2_GIT -gt 0 ]]; then
|
||||||
|
SUBMODULE_SYNTAX="--ignore-submodules=dirty"
|
||||||
|
fi
|
||||||
|
if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then
|
||||||
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
|
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
|
||||||
else
|
else
|
||||||
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
|
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Checks if there are commits ahead from remote
|
# Checks if there are commits ahead from remote
|
||||||
function git_prompt_ahead() {
|
function git_prompt_ahead() {
|
||||||
if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
|
if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
|
||||||
|
|
@ -62,3 +68,29 @@ git_prompt_status() {
|
||||||
fi
|
fi
|
||||||
echo $STATUS
|
echo $STATUS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#compare the provided version of git to the version installed and on path
|
||||||
|
#prints 1 if input version <= installed version
|
||||||
|
#prints -1 otherwise
|
||||||
|
function git_compare_version() {
|
||||||
|
local INPUT_GIT_VERSION=$1;
|
||||||
|
local INSTALLED_GIT_VERSION
|
||||||
|
INPUT_GIT_VERSION=(${(s/./)INPUT_GIT_VERSION});
|
||||||
|
INSTALLED_GIT_VERSION=($(git --version));
|
||||||
|
INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]});
|
||||||
|
|
||||||
|
for i in {1..3}; do
|
||||||
|
if [[ $INSTALLED_GIT_VERSION[$i] -lt $INPUT_GIT_VERSION[$i] ]]; then
|
||||||
|
echo -1
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo 1
|
||||||
|
}
|
||||||
|
|
||||||
|
#this is unlikely to change so make it all statically assigned
|
||||||
|
POST_1_7_2_GIT=$(git_compare_version "1.7.2")
|
||||||
|
#clean up the namespace slightly by removing the checker function
|
||||||
|
unset -f git_compare_version
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ for plugin ($plugins); do
|
||||||
done
|
done
|
||||||
|
|
||||||
# Load all of your custom configurations from custom/
|
# Load all of your custom configurations from custom/
|
||||||
for config_file ($ZSH_CUSTOM/*.zsh) source $config_file
|
for config_file ($ZSH_CUSTOM/*.zsh(.N)) source $config_file
|
||||||
|
|
||||||
# Load the theme
|
# Load the theme
|
||||||
if [ "$ZSH_THEME" = "random" ]
|
if [ "$ZSH_THEME" = "random" ]
|
||||||
|
|
@ -65,12 +65,11 @@ then
|
||||||
else
|
else
|
||||||
if [ ! "$ZSH_THEME" = "" ]
|
if [ ! "$ZSH_THEME" = "" ]
|
||||||
then
|
then
|
||||||
if [ -f "$ZSH/custom/$ZSH_THEME.zsh-theme" ]
|
if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]
|
||||||
then
|
then
|
||||||
source "$ZSH/custom/$ZSH_THEME.zsh-theme"
|
source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme"
|
||||||
else
|
else
|
||||||
source "$ZSH/themes/$ZSH_THEME.zsh-theme"
|
source "$ZSH/themes/$ZSH_THEME.zsh-theme"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ alias bu="bundle update"
|
||||||
|
|
||||||
# The following is based on https://github.com/gma/bundler-exec
|
# The following is based on https://github.com/gma/bundler-exec
|
||||||
|
|
||||||
bundled_commands=(annotate cap capify cucumber foreman guard heroku middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails)
|
bundled_commands=(annotate cap capify cucumber ey foreman guard middleman nanoc rackup rainbows rails rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails)
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,20 +40,23 @@ alias ap='apt-cache policy'
|
||||||
# superuser operations ######################################################
|
# superuser operations ######################################################
|
||||||
if [[ $use_sudo -eq 1 ]]; then
|
if [[ $use_sudo -eq 1 ]]; then
|
||||||
# commands using sudo #######
|
# commands using sudo #######
|
||||||
alias aac="sudo $apt_pref autoclean"
|
alias aac='sudo $apt_pref autoclean'
|
||||||
alias abd="sudo $apt_pref build-dep"
|
alias abd='sudo $apt_pref build-dep'
|
||||||
alias ac="sudo $apt_pref clean"
|
alias ac='sudo $apt_pref clean'
|
||||||
alias ad="sudo $apt_pref update"
|
alias ad='sudo $apt_pref update'
|
||||||
alias adg="sudo $apt_pref update && sudo $apt_pref upgrade"
|
alias adg='sudo $apt_pref update && sudo $apt_pref upgrade'
|
||||||
alias adu="sudo $apt_pref update && sudo $apt_pref dist-upgrade"
|
alias adu='sudo $apt_pref update && sudo $apt_pref dist-upgrade'
|
||||||
alias afu='sudo apt-file update'
|
alias afu='sudo apt-file update'
|
||||||
alias ag="sudo $apt_pref upgrade"
|
alias ag='sudo $apt_pref upgrade'
|
||||||
alias ai="sudo $apt_pref install"
|
alias ai='sudo $apt_pref install'
|
||||||
alias ap="sudo $apt_pref purge"
|
# Install all packages given on the command line while using only the first word of each line:
|
||||||
alias ar="sudo $apt_pref remove"
|
# acs ... | ail
|
||||||
|
alias ail="sed -e 's/ */ /g' -e 's/ *//' | cut -s -d ' ' -f 1 | "' xargs sudo $apt_pref install'
|
||||||
|
alias ap='sudo $apt_pref purge'
|
||||||
|
alias ar='sudo $apt_pref remove'
|
||||||
|
|
||||||
# apt-get only
|
# apt-get only
|
||||||
alias ads="sudo $apt_pref dselect-upgrade"
|
alias ads='sudo $apt_pref dselect-upgrade'
|
||||||
|
|
||||||
# Install all .deb files in the current directory.
|
# Install all .deb files in the current directory.
|
||||||
# Warning: you will need to put the glob in single quotes if you use:
|
# Warning: you will need to put the glob in single quotes if you use:
|
||||||
|
|
@ -67,18 +70,18 @@ if [[ $use_sudo -eq 1 ]]; then
|
||||||
|
|
||||||
# commands using su #########
|
# commands using su #########
|
||||||
else
|
else
|
||||||
alias aac='su -ls "'"$apt_pref"' autoclean" root'
|
alias aac='su -ls \'$apt_pref autoclean\' root'
|
||||||
abd() {
|
abd() {
|
||||||
cmd="su -lc '$apt_pref build-dep $@' root"
|
cmd="su -lc '$apt_pref build-dep $@' root"
|
||||||
print "$cmd"
|
print "$cmd"
|
||||||
eval "$cmd"
|
eval "$cmd"
|
||||||
}
|
}
|
||||||
alias ac='su -ls "'"$apt_pref"' clean" root'
|
alias ac='su -ls \'$apt_pref clean\' root'
|
||||||
alias ad='su -lc "'"$apt_pref"' update" root'
|
alias ad='su -lc \'$apt_pref update\' root'
|
||||||
alias adg='su -lc "'"$apt_pref"' update && aptitude safe-upgrade" root'
|
alias adg='su -lc \'$apt_pref update && aptitude safe-upgrade\' root'
|
||||||
alias adu='su -lc "'"$apt_pref"' update && aptitude dist-upgrade" root'
|
alias adu='su -lc \'$apt_pref update && aptitude dist-upgrade\' root'
|
||||||
alias afu='su -lc "apt-file update"'
|
alias afu='su -lc "apt-file update"'
|
||||||
alias ag='su -lc "'"$apt_pref"' safe-upgrade" root'
|
alias ag='su -lc \'$apt_pref safe-upgrade\' root'
|
||||||
ai() {
|
ai() {
|
||||||
cmd="su -lc 'aptitude -P install $@' root"
|
cmd="su -lc 'aptitude -P install $@' root"
|
||||||
print "$cmd"
|
print "$cmd"
|
||||||
|
|
@ -118,7 +121,7 @@ alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc'
|
||||||
apt-copy() {
|
apt-copy() {
|
||||||
print '#!/bin/sh'"\n" > apt-copy.sh
|
print '#!/bin/sh'"\n" > apt-copy.sh
|
||||||
|
|
||||||
cmd="$apt_pref install "
|
cmd='$apt_pref install'
|
||||||
|
|
||||||
for p in ${(f)"$(aptitude search -F "%p" --disable-columns \~i)"}; {
|
for p in ${(f)"$(aptitude search -F "%p" --disable-columns \~i)"}; {
|
||||||
cmd="${cmd} ${p}"
|
cmd="${cmd} ${p}"
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ alias gup='git fetch && git rebase'
|
||||||
compdef _git gup=git-fetch
|
compdef _git gup=git-fetch
|
||||||
alias gp='git push'
|
alias gp='git push'
|
||||||
compdef _git gp=git-push
|
compdef _git gp=git-push
|
||||||
gdv() { git-diff -w "$@" | view - }
|
gdv() { git diff -w "$@" | view - }
|
||||||
compdef _git gdv=git-diff
|
compdef _git gdv=git-diff
|
||||||
alias gc='git commit -v'
|
alias gc='git commit -v'
|
||||||
compdef _git gc=git-commit
|
compdef _git gc=git-commit
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,66 @@
|
||||||
# Thanks to Christopher Sexton
|
# Restart a rack app running under pow
|
||||||
# https://gist.github.com/965032
|
# http://pow.cx/
|
||||||
function kapow {
|
#
|
||||||
touch ~/.pow/$1/tmp/restart.txt
|
# Adds a kapow command that will restart an app
|
||||||
if [ $? -eq 0 ]; then
|
#
|
||||||
echo "$fg[yellow]Pow restarting $1...$reset_color"
|
# $ kapow myapp
|
||||||
|
#
|
||||||
|
# Supports command completion.
|
||||||
|
#
|
||||||
|
# If you are not already using completion you might need to enable it with
|
||||||
|
#
|
||||||
|
# autoload -U compinit compinit
|
||||||
|
#
|
||||||
|
# Changes:
|
||||||
|
#
|
||||||
|
# Defaults to the current application, and will walk up the tree to find
|
||||||
|
# a config.ru file and restart the corresponding app
|
||||||
|
#
|
||||||
|
# Will Detect if a app does not exist in pow and print a (slightly) helpful
|
||||||
|
# error message
|
||||||
|
|
||||||
|
rack_root_detect(){
|
||||||
|
setopt chaselinks
|
||||||
|
local orgdir=$(pwd)
|
||||||
|
local basedir=$(pwd)
|
||||||
|
|
||||||
|
while [[ $basedir != '/' ]]; do
|
||||||
|
test -e "$basedir/config.ru" && break
|
||||||
|
builtin cd ".." 2>/dev/null
|
||||||
|
basedir="$(pwd)"
|
||||||
|
done
|
||||||
|
|
||||||
|
builtin cd $orgdir 2>/dev/null
|
||||||
|
[[ ${basedir} == "/" ]] && return 1
|
||||||
|
echo `basename $basedir | sed -E "s/.(com|net|org)//"`
|
||||||
|
}
|
||||||
|
|
||||||
|
kapow(){
|
||||||
|
local vhost=$1
|
||||||
|
[ ! -n "$vhost" ] && vhost=$(rack_root_detect)
|
||||||
|
if [ ! -h ~/.pow/$vhost ]
|
||||||
|
then
|
||||||
|
echo "pow: This domain isn’t set up yet. Symlink your application to ${vhost} first."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ ! -d ~/.pow/${vhost}/tmp ] && mkdir -p ~/.pow/$vhost/tmp
|
||||||
|
touch ~/.pow/$vhost/tmp/restart.txt;
|
||||||
|
[ $? -eq 0 ] && echo "pow: restarting $vhost.dev"
|
||||||
|
}
|
||||||
|
compctl -W ~/.pow -/ kapow
|
||||||
|
|
||||||
|
powit(){
|
||||||
|
local basedir=$(pwd)
|
||||||
|
local vhost=$1
|
||||||
|
[ ! -n "$vhost" ] && vhost=$(rack_root_detect)
|
||||||
|
if [ ! -h ~/.pow/$vhost ]
|
||||||
|
then
|
||||||
|
echo "pow: Symlinking your app with pow. ${vhost}"
|
||||||
|
[ ! -d ~/.pow/${vhost} ] && ln -s $basedir ~/.pow/$vhost
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
compctl -W ~/.pow -/ kapow
|
# View the standard out (puts) from any pow app
|
||||||
|
alias kaput="tail -f ~/Library/Logs/Pow/apps/*"
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,7 @@
|
||||||
alias pyfind='find . -name "*.py"'
|
alias pyfind='find . -name "*.py"'
|
||||||
|
|
||||||
# Remove python compiled byte-code
|
# Remove python compiled byte-code
|
||||||
alias pyclean='find . -type f -name "*.py[co]" -exec rm -f \{\} \;'
|
alias pyclean='find . -type f -name "*.py[co]" -delete'
|
||||||
|
|
||||||
|
# Grep among .py files
|
||||||
|
alias pygrep='grep --include="*.py"'
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ alias ss='thin --stats "/thin/stats" start'
|
||||||
alias sg='ruby script/generate'
|
alias sg='ruby script/generate'
|
||||||
alias sd='ruby script/destroy'
|
alias sd='ruby script/destroy'
|
||||||
alias sp='ruby script/plugin'
|
alias sp='ruby script/plugin'
|
||||||
|
alias sr='ruby script/runner'
|
||||||
alias ssp='ruby script/spec'
|
alias ssp='ruby script/spec'
|
||||||
alias rdbm='rake db:migrate'
|
alias rdbm='rake db:migrate'
|
||||||
alias sc='ruby script/console'
|
alias sc='ruby script/console'
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ alias rdb='_rails_command dbconsole'
|
||||||
alias rdbm='rake db:migrate db:test:clone'
|
alias rdbm='rake db:migrate db:test:clone'
|
||||||
alias rg='_rails_command generate'
|
alias rg='_rails_command generate'
|
||||||
alias rp='_rails_command plugin'
|
alias rp='_rails_command plugin'
|
||||||
|
alias ru='_rails_command runner'
|
||||||
alias rs='_rails_command server'
|
alias rs='_rails_command server'
|
||||||
alias rsd='_rails_command server --debugger'
|
alias rsd='_rails_command server --debugger'
|
||||||
alias devlog='tail -f log/development.log'
|
alias devlog='tail -f log/development.log'
|
||||||
|
|
|
||||||
3
plugins/sublime/sublime.plugin.zsh
Normal file
3
plugins/sublime/sublime.plugin.zsh
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Sublime Text 2 Aliases
|
||||||
|
alias st='/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl'
|
||||||
|
alias stt='st .'
|
||||||
|
|
@ -16,7 +16,7 @@ function svn_get_repo_name {
|
||||||
if [ $(in_svn) ]; then
|
if [ $(in_svn) ]; then
|
||||||
svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT
|
svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT
|
||||||
|
|
||||||
svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p" | sed "s/\/.*$//"
|
svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,14 @@
|
||||||
|
|
||||||
local user='%{$fg[magenta]%}%n@%{$fg[magenta]%}%m%{$reset_color%}'
|
local user='%{$fg[magenta]%}%n@%{$fg[magenta]%}%m%{$reset_color%}'
|
||||||
local pwd='%{$fg[blue]%}%~%{$reset_color%}'
|
local pwd='%{$fg[blue]%}%~%{$reset_color%}'
|
||||||
local rvm='%{$fg[green]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
|
local rvm=''
|
||||||
|
if which rvm-prompt &> /dev/null; then
|
||||||
|
rvm='%{$fg[green]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
rvm='%{$fg[green]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
local return_code='%(?..%{$fg[red]%}%? ↵%{$reset_color%})'
|
local return_code='%(?..%{$fg[red]%}%? ↵%{$reset_color%})'
|
||||||
local git_branch='$(git_prompt_status)%{$reset_color%}$(git_prompt_info)%{$reset_color%}'
|
local git_branch='$(git_prompt_status)%{$reset_color%}$(git_prompt_info)%{$reset_color%}'
|
||||||
|
|
||||||
|
|
@ -19,4 +26,3 @@ ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭"
|
||||||
|
|
||||||
PROMPT="${user} ${pwd}$ "
|
PROMPT="${user} ${pwd}$ "
|
||||||
RPROMPT="${return_code} ${git_branch} ${rvm}"
|
RPROMPT="${return_code} ${git_branch} ${rvm}"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,14 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
||||||
|
|
||||||
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
|
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
|
||||||
local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}'
|
local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}'
|
||||||
local rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
|
local rvm_ruby=''
|
||||||
|
if which rvm-prompt &> /dev/null; then
|
||||||
|
rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
rvm_ruby='%{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
local git_branch='$(git_prompt_info)%{$reset_color%}'
|
local git_branch='$(git_prompt_info)%{$reset_color%}'
|
||||||
|
|
||||||
PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
|
PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,13 @@ ZSH_THEME_GIT_PROMPT_DIRTY=" $CRUNCH_GIT_DIRTY_COLOR✗"
|
||||||
|
|
||||||
# Our elements:
|
# Our elements:
|
||||||
CRUNCH_TIME_="$CRUNCH_BRACKET_COLOR{$CRUNCH_TIME_COLOR%T$CRUNCH_BRACKET_COLOR}%{$reset_color%}"
|
CRUNCH_TIME_="$CRUNCH_BRACKET_COLOR{$CRUNCH_TIME_COLOR%T$CRUNCH_BRACKET_COLOR}%{$reset_color%}"
|
||||||
|
if which rvm-prompt &> /dev/null; then
|
||||||
CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(~/.rvm/bin/rvm-prompt i v g)#ruby-}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}"
|
CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(~/.rvm/bin/rvm-prompt i v g)#ruby-}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}"
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(rbenv version | sed -e 's/ (set.*$//' -e 's/^ruby-//')}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
CRUNCH_DIR_="$CRUNCH_DIR_COLOR%~\$(git_prompt_info) "
|
CRUNCH_DIR_="$CRUNCH_DIR_COLOR%~\$(git_prompt_info) "
|
||||||
CRUNCH_PROMPT="$CRUNCH_BRACKET_COLOR➭ "
|
CRUNCH_PROMPT="$CRUNCH_BRACKET_COLOR➭ "
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,13 @@
|
||||||
# Grab the current date (%D) and time (%T) wrapped in {}: {%D %T}
|
# Grab the current date (%D) and time (%T) wrapped in {}: {%D %T}
|
||||||
DALLAS_CURRENT_TIME_="%{$fg[white]%}{%{$fg[yellow]%}%D %T%{$fg[white]%}}%{$reset_color%}"
|
DALLAS_CURRENT_TIME_="%{$fg[white]%}{%{$fg[yellow]%}%D %T%{$fg[white]%}}%{$reset_color%}"
|
||||||
# Grab the current version of ruby in use (via RVM): [ruby-1.8.7]
|
# Grab the current version of ruby in use (via RVM): [ruby-1.8.7]
|
||||||
|
if which rvm-prompt &> /dev/null; then
|
||||||
DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}"
|
DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}"
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$fg[white]%}]%{$reset_color%}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
# Grab the current machine name: muscato
|
# Grab the current machine name: muscato
|
||||||
DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}"
|
DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}"
|
||||||
# Grab the current filepath, use shortcuts: ~/Desktop
|
# Grab the current filepath, use shortcuts: ~/Desktop
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
#RVM settings
|
#RVM settings
|
||||||
if [[ -s ~/.rvm/scripts/rvm ]] ; then
|
if [[ -s ~/.rvm/scripts/rvm ]] ; then
|
||||||
RPS1="%{$fg[yellow]%}rvm:%{$reset_color%}%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt)%{$reset_color%} $EPS1"
|
RPS1="%{$fg[yellow]%}rvm:%{$reset_color%}%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt)%{$reset_color%} $EPS1"
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
RPS1="%{$fg[yellow]%}rbenv:%{$reset_color%}%{$fg[red]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$reset_color%} $EPS1"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}["
|
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}["
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,14 @@ function box_name {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
local rvm_ruby='‹$(rvm-prompt i v g)›%{$reset_color%}'
|
local rvm_ruby=''
|
||||||
|
if which rvm-prompt &> /dev/null; then
|
||||||
|
rvm_ruby='‹$(rvm-prompt i v g)›%{$reset_color%}'
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
rvm_ruby='‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
local current_dir='${PWD/#$HOME/~}'
|
local current_dir='${PWD/#$HOME/~}'
|
||||||
local git_info='$(git_prompt_info)'
|
local git_info='$(git_prompt_info)'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,12 @@ git_custom_status() {
|
||||||
#RVM and git settings
|
#RVM and git settings
|
||||||
if [[ -s ~/.rvm/scripts/rvm ]] ; then
|
if [[ -s ~/.rvm/scripts/rvm ]] ; then
|
||||||
RPS1='$(git_custom_status)%{$fg[red]%}[`~/.rvm/bin/rvm-prompt`]%{$reset_color%} $EPS1'
|
RPS1='$(git_custom_status)%{$fg[red]%}[`~/.rvm/bin/rvm-prompt`]%{$reset_color%} $EPS1'
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
RPS1='$(git_custom_status)%{$fg[red]%}[`rbenv version | sed -e "s/ (set.*$//"`]%{$reset_color%} $EPS1'
|
||||||
else
|
else
|
||||||
RPS1='$(git_custom_status) $EPS1'
|
RPS1='$(git_custom_status) $EPS1'
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b '
|
PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b '
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ function theme_precmd {
|
||||||
PR_PWDLEN=""
|
PR_PWDLEN=""
|
||||||
|
|
||||||
local promptsize=${#${(%):---(%n@%m:%l)---()--}}
|
local promptsize=${#${(%):---(%n@%m:%l)---()--}}
|
||||||
local rubyprompt=`rvm_prompt_info`
|
local rubyprompt=`rvm_prompt_info || rbenv_prompt_info`
|
||||||
local rubypromptsize=${#${rubyprompt}}
|
local rubypromptsize=${#${rubyprompt}}
|
||||||
local pwdsize=${#${(%):-%~}}
|
local pwdsize=${#${(%):-%~}}
|
||||||
|
|
||||||
|
|
@ -113,7 +113,7 @@ setprompt () {
|
||||||
PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\
|
PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\
|
||||||
$PR_CYAN$PR_SHIFT_IN$PR_ULCORNER$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\
|
$PR_CYAN$PR_SHIFT_IN$PR_ULCORNER$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\
|
||||||
$PR_GREEN%$PR_PWDLEN<...<%~%<<\
|
$PR_GREEN%$PR_PWDLEN<...<%~%<<\
|
||||||
$PR_GREY)`rvm_prompt_info`$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_HBAR${(e)PR_FILLBAR}$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\
|
$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(\
|
||||||
$PR_CYAN%(!.%SROOT%s.%n)$PR_GREY@$PR_GREEN%m:%l\
|
$PR_CYAN%(!.%SROOT%s.%n)$PR_GREY@$PR_GREEN%m:%l\
|
||||||
$PR_GREY)$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_URCORNER$PR_SHIFT_OUT\
|
$PR_GREY)$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_URCORNER$PR_SHIFT_OUT\
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ function josh_prompt {
|
||||||
prompt=" "
|
prompt=" "
|
||||||
|
|
||||||
branch=$(current_branch)
|
branch=$(current_branch)
|
||||||
ruby_version=$(rvm_prompt_info)
|
ruby_version=$(rvm_prompt_info || rbenv_prompt_info)
|
||||||
path_size=${#PWD}
|
path_size=${#PWD}
|
||||||
branch_size=${#branch}
|
branch_size=${#branch}
|
||||||
ruby_size=${#ruby_version}
|
ruby_size=${#ruby_version}
|
||||||
|
|
@ -31,7 +31,7 @@ function josh_prompt {
|
||||||
prompt=" $prompt"
|
prompt=" $prompt"
|
||||||
done
|
done
|
||||||
|
|
||||||
prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info)%{$reset_color%} $(git_prompt_info)"
|
prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%} $(git_prompt_info)"
|
||||||
|
|
||||||
echo $prompt
|
echo $prompt
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,14 @@
|
||||||
# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
|
# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
|
||||||
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
||||||
|
|
||||||
|
if which rvm-prompt &> /dev/null; then
|
||||||
PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b '
|
PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b '
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b '
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
RPS1="${return_code}"
|
RPS1="${return_code}"
|
||||||
|
|
||||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
|
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,13 @@
|
||||||
# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
|
# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
|
||||||
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
||||||
|
|
||||||
|
if which rvm-prompt &> /dev/null; then
|
||||||
PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b '
|
PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b '
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b '
|
||||||
|
fi
|
||||||
|
fi
|
||||||
RPS1="${return_code}"
|
RPS1="${return_code}"
|
||||||
|
|
||||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
|
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
||||||
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
|
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
|
||||||
local current_dir='%{$terminfo[bold]$fg[blue]%}%~%{$reset_color%}'
|
local current_dir='%{$terminfo[bold]$fg[blue]%}%~%{$reset_color%}'
|
||||||
local rvm_ruby='%{$fg[red]%}$(rvm_prompt_info)%{$reset_color%}'
|
local rvm_ruby='%{$fg[red]%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%}'
|
||||||
local git_branch='%{$fg[blue]%}$(git_prompt_info)%{$reset_color%}'
|
local git_branch='%{$fg[blue]%}$(git_prompt_info)%{$reset_color%}'
|
||||||
|
|
||||||
PROMPT="${user_host}:${current_dir} ${rvm_ruby}
|
PROMPT="${user_host}:${current_dir} ${rvm_ruby}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,10 @@
|
||||||
# Get the current ruby version in use with RVM:
|
# Get the current ruby version in use with RVM:
|
||||||
if [ -e ~/.rvm/bin/rvm-prompt ]; then
|
if [ -e ~/.rvm/bin/rvm-prompt ]; then
|
||||||
RUBY_PROMPT_="%{$fg_bold[blue]%}rvm:(%{$fg[green]%}\$(~/.rvm/bin/rvm-prompt s i v g)%{$fg_bold[blue]%})%{$reset_color%} "
|
RUBY_PROMPT_="%{$fg_bold[blue]%}rvm:(%{$fg[green]%}\$(~/.rvm/bin/rvm-prompt s i v g)%{$fg_bold[blue]%})%{$reset_color%} "
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
RUBY_PROMPT_="%{$fg_bold[blue]%}rvm:(%{$fg[green]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$fg_bold[blue]%})%{$reset_color%} "
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get the host name (first 4 chars)
|
# Get the host name (first 4 chars)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,11 @@
|
||||||
# Grab the current version of ruby in use (via RVM): [ruby-1.8.7]
|
# Grab the current version of ruby in use (via RVM): [ruby-1.8.7]
|
||||||
|
if which rvm-prompt &> /dev/null; then
|
||||||
JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}"
|
JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}"
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$fg[white]%}]%{$reset_color%}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Grab the current filepath, use shortcuts: ~/Desktop
|
# Grab the current filepath, use shortcuts: ~/Desktop
|
||||||
# Append the current git branch, if in a git repository
|
# Append the current git branch, if in a git repository
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,15 @@ function collapse_pwd {
|
||||||
echo $(pwd | sed -e "s,^$HOME,~,")
|
echo $(pwd | sed -e "s,^$HOME,~,")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if which rvm-prompt &> /dev/null; then
|
||||||
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%}
|
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%}
|
||||||
$(virtualenv_info)$(prompt_char) '
|
$(virtualenv_info)$(prompt_char) '
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
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%}
|
||||||
|
$(virtualenv_info)$(prompt_char) '
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}"
|
ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}"
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,4 @@ ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}["
|
||||||
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%} "
|
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%} "
|
||||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%} x%{$fg_bold[blue]%}"
|
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%} x%{$fg_bold[blue]%}"
|
||||||
|
|
||||||
PROMPT='%{$(git_prompt_info)%}%{$fg_bold[green]%}{%{$(rvm current)%}}%{$reset_color%} %{$fg[cyan]%}%c%{$reset_color%} '
|
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%} '
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,13 @@
|
||||||
PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
|
PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
|
||||||
|
|
||||||
|
if which rvm-prompt &> /dev/null; then
|
||||||
RPROMPT='%{$reset_color%} %{$fg[red]%}$(~/.rvm/bin/rvm-prompt i v g) %{$reset_color%}'
|
RPROMPT='%{$reset_color%} %{$fg[red]%}$(~/.rvm/bin/rvm-prompt i v g) %{$reset_color%}'
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
RPROMPT='%{$reset_color%} %{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//") %{$reset_color%}'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[red]%}"
|
ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[red]%}"
|
||||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
epoch_diff=$(($(_current_epoch) - $LAST_EPOCH))
|
epoch_diff=$(($(_current_epoch) - $LAST_EPOCH))
|
||||||
if [ $epoch_diff -gt 6 ]
|
if [ $epoch_diff -gt 13 ]
|
||||||
then
|
then
|
||||||
if [ "$DISABLE_UPDATE_PROMPT" = "true" ]
|
if [ "$DISABLE_UPDATE_PROMPT" = "true" ]
|
||||||
then
|
then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue