Merge branch 'master' of https://github.com/robbyrussell/oh-my-zsh
commit
7199f8ced8
@ -0,0 +1,26 @@
|
||||
stat -f%m . > /dev/null 2>&1
|
||||
if [ "$?" = 0 ]; then
|
||||
stat_cmd=(stat -f%m)
|
||||
else
|
||||
stat_cmd=(stat -L --format=%y)
|
||||
fi
|
||||
|
||||
_ant_does_target_list_need_generating () {
|
||||
if [ ! -f .ant_targets ]; then return 0;
|
||||
else
|
||||
accurate=$($stat_cmd -f%m .ant_targets)
|
||||
changed=$($stat_cmd -f%m build.xml)
|
||||
return $(expr $accurate '>=' $changed)
|
||||
fi
|
||||
}
|
||||
|
||||
_ant () {
|
||||
if [ -f build.xml ]; then
|
||||
if _ant_does_target_list_need_generating; then
|
||||
sed -n '/<target/s/<target.*name="\([^"]*\).*$/\1/p' build.xml > .ant_targets
|
||||
fi
|
||||
compadd `cat .ant_targets`
|
||||
fi
|
||||
}
|
||||
|
||||
compdef _ant ant
|
@ -0,0 +1,3 @@
|
||||
if [ -f `brew --prefix`/etc/autojump ]; then
|
||||
. `brew --prefix`/etc/autojump
|
||||
fi
|
@ -0,0 +1,26 @@
|
||||
# Based on ssh-agent code
|
||||
|
||||
local GPG_ENV=$HOME/.gnupg/gpg-agent.env
|
||||
|
||||
function start_agent {
|
||||
/usr/bin/env gpg-agent --daemon --enable-ssh-support --write-env-file ${GPG_ENV} > /dev/null
|
||||
chmod 600 ${GPG_ENV}
|
||||
. ${GPG_ENV} > /dev/null
|
||||
}
|
||||
|
||||
# Source GPG agent settings, if applicable
|
||||
if [ -f "${GPG_ENV}" ]; then
|
||||
. ${GPG_ENV} > /dev/null
|
||||
ps -ef | grep ${SSH_AGENT_PID} | grep gpg-agent > /dev/null || {
|
||||
start_agent;
|
||||
}
|
||||
else
|
||||
start_agent;
|
||||
fi
|
||||
|
||||
export GPG_AGENT_INFO
|
||||
export SSH_AUTH_SOCK
|
||||
export SSH_AGENT_PID
|
||||
|
||||
GPG_TTY=$(tty)
|
||||
export GPG_TTY
|
@ -0,0 +1,5 @@
|
||||
# Open the node api for your current version to the optional section.
|
||||
# TODO: Make the section part easier to use.
|
||||
function node-docs {
|
||||
open "http://nodejs.org/docs/$(node --version)/api/all.html#$1"
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
# Thanks to Christopher Sexton
|
||||
# https://gist.github.com/965032
|
||||
function kapow {
|
||||
touch ~/.pow/$1/tmp/restart.txt
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "$fg[yellow]Pow restarting $1...$reset_color"
|
||||
fi
|
||||
}
|
||||
|
||||
compctl -W ~/.pow -/ kapow
|
@ -0,0 +1,147 @@
|
||||
#compdef rvm
|
||||
|
||||
local curcontext="$curcontext" state line cmds ret=1
|
||||
|
||||
_arguments -C \
|
||||
'(- 1 *)'{-v,--version}'[display version information]' \
|
||||
'(-l|--level)'{-l,--level}'+[patch level to use with rvm use / install]:number' \
|
||||
'(--prefix)--prefix[path for all rvm files (~/.rvm/), with trailing slash!]:path:_files' \
|
||||
'(--bin)--bin[path for binaries to be placed (~/.rvm/bin/)]:path:_files' \
|
||||
'(--source)--source[src directory to use (~/.rvm/src/)]:path:_files' \
|
||||
'(--archives)--archives[directory for downladed files (~/.rvm/archives/)]:path:_files' \
|
||||
'-S[Specify a script file to attempt to load and run (rubydo)]:file:_files' \
|
||||
'-e[Execute code from the command line]:code' \
|
||||
'(-G)-G[root gem path to use]:path:_files' \
|
||||
'(--gems)--gems[Used to set the gems_flag, use with remove to remove gems]' \
|
||||
'(--archive)--archive[Used to set the archive_flag, use with remove to remove archive]' \
|
||||
'(--patch)--patch[With MRI Rubies you may specify one or more full paths to patches]' \
|
||||
'(-C|--configure)'{-C,--configure}'=[custom configure options]' \
|
||||
'(--nice)--nice[process niceness (for slow computers, default 0)]:number' \
|
||||
'(--ree)--ree-options[Options passed directly to ree ./installer on the command line]:options' \
|
||||
'(--head)--head[with update, updates rvm to git head version]' \
|
||||
'(--rubygems)--rubygems[with update, updates rubygems for selected ruby]' \
|
||||
'(--default)--default[with ruby select, sets a default ruby for new shells]' \
|
||||
'(--debug)--debug[Toggle debug mode on for very verbose output]' \
|
||||
'(--trace)--trace[Toggle trace mode on to see EVERYTHING rvm is doing]' \
|
||||
'(--force)--force[Force install, removes old install & source before install]' \
|
||||
'(--summary)--summary[Used with rubydo to print out a summary of the commands run]' \
|
||||
'(--latest)--latest[with gemset --dump skips version strings for latest gem]' \
|
||||
'(--gems)--gems[with uninstall/remove removes gems with the interpreter]' \
|
||||
'(--docs)--docs[with install, attempt to generate ri after installation]' \
|
||||
'(--reconfigure)--reconfigure[Force ./configure on install even if Makefile already exists]' \
|
||||
'1: :->cmds' \
|
||||
'*: :->args' && ret=0
|
||||
|
||||
case $state in
|
||||
cmds)
|
||||
cmds=(
|
||||
"version:show the rvm version installed in rvm_path"
|
||||
"use:setup current shell to use a specific ruby version"
|
||||
"reload:reload rvm source itself (useful after changing rvm source)"
|
||||
"implode:(seppuku) removes the rvm installation completely. This means everything in $rvm_path (~/.rvm)."
|
||||
"update:upgrades rvm to the latest version."
|
||||
"reset:remove current and stored default & system settings."
|
||||
"info :show the *current* environment information for current ruby"
|
||||
"current:print the *current* ruby version and the name of any gemset being used."
|
||||
"debug:show info plus additional information for common issues"
|
||||
"install:install one or many ruby versions"
|
||||
"uninstall:uninstall one or many ruby versions, leaves their sources"
|
||||
"remove:uninstall one or many ruby versions and remove their sources"
|
||||
"migrate:Lets you migrate all gemsets from one ruby to another."
|
||||
"upgrade:Lets you upgrade from one version of a ruby to another, including migrating your gemsets semi-automatically."
|
||||
"wrapper:generates a set of wrapper executables for a given ruby with the specified ruby and gemset combination. Used under the hood for passenger support and the like."
|
||||
"cleanup:Lets you remove stale source folders / archives and other miscellaneous data associated with rvm."
|
||||
"repair:Lets you repair parts of your environment e.g. wrappers, env files and and similar files (e.g. general maintenance)."
|
||||
"snapshot:Lets your backup / restore an rvm installation in a lightweight manner."
|
||||
"disk-usage:Tells you how much disk space rvm install is using."
|
||||
"tools:Provides general information about the ruby environment, primarily useful when scripting rvm."
|
||||
"docs:Tools to make installing ri and rdoc documentation easier."
|
||||
"rvmrc:Tools related to managing rvmrc trust and loading."
|
||||
"exec:runs an arbitrary command as a set operation."
|
||||
"ruby:runs a named ruby file against specified and/or all rubies"
|
||||
"gem:runs a gem command using selected ruby's 'gem'"
|
||||
"rake:runs a rake task against specified and/or all rubies"
|
||||
"tests:runs 'rake test' across selected ruby versions"
|
||||
"specs:runs 'rake spec' across selected ruby versions"
|
||||
"monitor:Monitor cwd for testing, run rake {spec,test} on changes."
|
||||
"gemset:gemsets: http://rvm.beginrescueend.com/gemsets/"
|
||||
"rubygems:Switches the installed version of rubygems for the current ruby."
|
||||
"gemdir:display the path to the current gem directory (GEM_HOME)."
|
||||
"srcdir:display the path to rvm source directory (may be yanked)"
|
||||
"fetch:Performs an archive / src fetch only of the selected ruby."
|
||||
"list:show currently installed rubies, interactive output."
|
||||
"package:Install a dependency package {readline,iconv,zlib,openssl}"
|
||||
"notes:Display notes, with operating system specifics."
|
||||
"export:Temporarily set an environment variable in the current shell."
|
||||
"unexport:Undo changes made to the environment by 'rvm export'."
|
||||
)
|
||||
_describe -t commands 'rvm command' cmds && ret=0
|
||||
;;
|
||||
args)
|
||||
case $line[1] in
|
||||
(use|uninstall|remove|list)
|
||||
_values -S , 'rubies' $(rvm list strings | sed -e 's/ruby-\([^) ]*\)-\([^) ]*\)/ruby-\1-\2 \1-\2 \1/g') default system && ret=0
|
||||
;;
|
||||
(install|fetch)
|
||||
_values -S , 'rubies' $(rvm list known_strings) && ret=0
|
||||
;;
|
||||
gemset)
|
||||
if (( CURRENT == 3 )); then
|
||||
_values 'gemset_commands' \
|
||||
'import' \
|
||||
'export' \
|
||||
'create' \
|
||||
'copy' \
|
||||
'rename' \
|
||||
'empty' \
|
||||
'delete' \
|
||||
'name' \
|
||||
'dir' \
|
||||
'list' \
|
||||
'list_all' \
|
||||
'gemdir' \
|
||||
'install' \
|
||||
'pristine' \
|
||||
'clear' \
|
||||
'use' \
|
||||
'update' \
|
||||
'unpack' \
|
||||
'globalcache'
|
||||
else
|
||||
_values -S , 'gemsets' $(rvm gemset list | grep -v gemset 2>/dev/null)
|
||||
fi
|
||||
ret=0
|
||||
;;
|
||||
package)
|
||||
if (( CURRENT == 3 )); then
|
||||
_values 'package_commands' \
|
||||
'install' \
|
||||
'uninstall'
|
||||
else
|
||||
_values 'packages' \
|
||||
'readline' \
|
||||
'iconv' \
|
||||
'curl' \
|
||||
'openssl' \
|
||||
'zlib' \
|
||||
'autoconf' \
|
||||
'ncurses' \
|
||||
'pkgconfig' \
|
||||
'gettext' \
|
||||
'glib' \
|
||||
'mono' \
|
||||
'llvm' \
|
||||
'libxml2' \
|
||||
'libxslt' \
|
||||
'libyaml'
|
||||
fi
|
||||
ret=0
|
||||
;;
|
||||
*)
|
||||
(( ret )) && _message 'no more arguments'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
@ -0,0 +1,48 @@
|
||||
alias rubies='rvm list rubies'
|
||||
alias gemsets='rvm gemset list'
|
||||
|
||||
local ruby18='ruby-1.8.7-p334'
|
||||
local ruby19='ruby-1.9.2-p180'
|
||||
|
||||
function rb18 {
|
||||
if [ -z "$1" ]; then
|
||||
rvm use "$ruby18"
|
||||
else
|
||||
rvm use "$ruby18@$1"
|
||||
fi
|
||||
}
|
||||
|
||||
_rb18() {compadd `ls -1 $rvm_path/gems | grep "^$ruby18@" | sed -e "s/^$ruby18@//" | awk '{print $1}'`}
|
||||
compdef _rb18 rb18
|
||||
|
||||
function rb19 {
|
||||
if [ -z "$1" ]; then
|
||||
rvm use "$ruby19"
|
||||
else
|
||||
rvm use "$ruby19@$1"
|
||||
fi
|
||||
}
|
||||
|
||||
_rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`}
|
||||
compdef _rb19 rb19
|
||||
|
||||
function rvm-update {
|
||||
rvm get head
|
||||
rvm reload # TODO: Reload rvm completion?
|
||||
}
|
||||
|
||||
function rvm-link-completion {
|
||||
ln -s "$rvm_path/scripts/zsh/Completion/_rvm" "$ZSH/plugins/rvm/_rvm.official"
|
||||
}
|
||||
|
||||
# TODO: Make this usable w/o rvm.
|
||||
function gems {
|
||||
local current_ruby=`rvm-prompt i v p`
|
||||
local current_gemset=`rvm-prompt g`
|
||||
|
||||
gem list $@ | sed \
|
||||
-Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
|
||||
-Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \
|
||||
-Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
|
||||
-Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
#compdef thor
|
||||
#autoload
|
||||
|
||||
compadd `thor list | grep thor | cut -d " " -f 2`
|
@ -0,0 +1,6 @@
|
||||
PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[red]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
|
@ -0,0 +1,15 @@
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[white]%}["
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
|
||||
#Customized git status, oh-my-zsh currently does not allow render dirty status before branch
|
||||
git_custom_status() {
|
||||
local cb=$(current_branch)
|
||||
if [ -n "$cb" ]; then
|
||||
echo "- $ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
PROMPT='%2~ $(git_custom_status) »%b '
|
@ -0,0 +1,15 @@
|
||||
if [ "$(whoami)" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; fi
|
||||
|
||||
local return_code="%(?..%{$fg_bold[red]%}:( %?%{$reset_color%})"
|
||||
|
||||
PROMPT='
|
||||
%{$fg_bold[cyan]%}%n%{$reset_color%}%{$fg[yellow]%}@%{$reset_color%}%{$fg_bold[blue]%}%m%{$reset_color%}:%{${fg_bold[green]}%}%~%{$reset_color%}$(git_prompt_info)
|
||||
%{${fg[$CARETCOLOR]}%}%# %{${reset_color}%}'
|
||||
|
||||
RPS1='${return_code} %D - %*'
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[magenta]%}^%{$reset_color%}%{$fg_bold[yellow]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%} ±"
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ?"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[red]%} ♥"
|
@ -0,0 +1,6 @@
|
||||
PROMPT='%{$fg[green]%}%~%{$fg_bold[blue]%}$(git_prompt_info)%{$reset_color%} '
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="("
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY=" ✗"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=" ✔"
|
@ -0,0 +1,100 @@
|
||||
# prompt style and colors based on Steve Losh's Prose theme:
|
||||
# http://github.com/sjl/oh-my-zsh/blob/master/themes/prose.zsh-theme
|
||||
#
|
||||
# vcs_info modifications from Bart Trojanowski's zsh prompt:
|
||||
# http://www.jukie.net/bart/blog/pimping-out-zsh-prompt
|
||||
#
|
||||
# git untracked files modification from Brian Carper:
|
||||
# http://briancarper.net/blog/570/git-info-in-your-zsh-prompt
|
||||
|
||||
function virtualenv_info {
|
||||
[ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
|
||||
}
|
||||
PR_GIT_UPDATE=1
|
||||
|
||||
setopt prompt_subst
|
||||
autoload colors
|
||||
colors
|
||||
|
||||
autoload -U add-zsh-hook
|
||||
autoload -Uz vcs_info
|
||||
|
||||
#use extended color pallete if available
|
||||
if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then
|
||||
turquoise="%F{81}"
|
||||
orange="%F{166}"
|
||||
purple="%F{135}"
|
||||
hotpink="%F{161}"
|
||||
limegreen="%F{118}"
|
||||
else
|
||||
turquoise="$fg[cyan]"
|
||||
orange="$fg[yellow]"
|
||||
purple="$fg[magenta]"
|
||||
hotpink="$fg[red]"
|
||||
limegreen="$fg[green]"
|
||||
fi
|
||||
|
||||
# enable VCS systems you use
|
||||
zstyle ':vcs_info:*' enable git svn
|
||||
|
||||
# check-for-changes can be really slow.
|
||||
# you should disable it, if you work with large repositories
|
||||
zstyle ':vcs_info:*:prompt:*' check-for-changes true
|
||||
|
||||
# set formats
|
||||
# %b - branchname
|
||||
# %u - unstagedstr (see below)
|
||||
# %c - stagedstr (see below)
|
||||
# %a - action (e.g. rebase-i)
|
||||
# %R - repository path
|
||||
# %S - path in the repository
|
||||
PR_RST="%{${reset_color}%}"
|
||||
FMT_BRANCH="(%{$turquoise%}%b%u%c${PR_RST})"
|
||||
FMT_ACTION="(%{$limegreen%}%a${PR_RST})"
|
||||
FMT_UNSTAGED="%{$orange%}●"
|
||||
FMT_STAGED="%{$limegreen%}●"
|
||||
|
||||
zstyle ':vcs_info:*:prompt:*' unstagedstr "${FMT_UNSTAGED}"
|
||||
zstyle ':vcs_info:*:prompt:*' stagedstr "${FMT_STAGED}"
|
||||
zstyle ':vcs_info:*:prompt:*' actionformats "${FMT_BRANCH}${FMT_ACTION}"
|
||||
zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}"
|
||||
zstyle ':vcs_info:*:prompt:*' nvcsformats ""
|
||||
|
||||
|
||||
function steeef_preexec {
|
||||
case "$(history $HISTCMD)" in
|
||||
*git*)
|
||||
PR_GIT_UPDATE=1
|
||||
;;
|
||||
*svn*)
|
||||
PR_GIT_UPDATE=1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
add-zsh-hook preexec steeef_preexec
|
||||
|
||||
function steeef_chpwd {
|
||||
PR_GIT_UPDATE=1
|
||||
}
|
||||
add-zsh-hook chpwd steeef_chpwd
|
||||
|
||||
function steeef_precmd {
|
||||
if [[ -n "$PR_GIT_UPDATE" ]] ; then
|
||||
# check for untracked files or updated submodules, since vcs_info doesn't
|
||||
if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
|
||||
PR_GIT_UPDATE=1
|
||||
FMT_BRANCH="(%{$turquoise%}%b%u%c%{$hotpink%}●${PR_RST})"
|
||||
else
|
||||
FMT_BRANCH="(%{$turquoise%}%b%u%c${PR_RST})"
|
||||
fi
|
||||
zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}"
|
||||
|
||||
vcs_info 'prompt'
|
||||
PR_GIT_UPDATE=
|
||||
fi
|
||||
}
|
||||
add-zsh-hook precmd steeef_precmd
|
||||
|
||||
PROMPT=$'
|
||||
%{$purple%}%n%{$reset_color%} at %{$orange%}%m%{$reset_color%} in %{$limegreen%}%~%{$reset_color%} $vcs_info_msg_0_
|
||||
$(virtualenv_info)$ '
|
Loading…
Reference in new issue