Commit f5041025 authored by fred-o's avatar fred-o
Browse files
parents e24230cb 7a41498b
...@@ -8,6 +8,14 @@ h2. Setup ...@@ -8,6 +8,14 @@ h2. Setup
h3. The automatic installer... (do you trust me?) h3. The automatic installer... (do you trust me?)
You can install this via the command line with either `curl` or `wget`.
h4. via `curl`
@curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh@
h4. via `wget`
@wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh@ @wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh@
h3. The manual way h3. The manual way
......
...@@ -32,12 +32,14 @@ zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-dir ...@@ -32,12 +32,14 @@ zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-dir
cdpath=(.) cdpath=(.)
# use /etc/hosts and known_hosts for hostname completion # use /etc/hosts and known_hosts for hostname completion
[ -r /etc/ssh/ssh_known_hosts ] && _global_ssh_hosts=(${${${${(f)"$(</etc/ssh/ssh_known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=() [ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=() [ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
hosts=( hosts=(
"$_global_ssh_hosts[@]"
"$_ssh_hosts[@]" "$_ssh_hosts[@]"
"$_etc_hosts[@]" "$_etc_hosts[@]"
`hostname` "$HOST"
localhost localhost
) )
zstyle ':completion:*:hosts' hosts $hosts zstyle ':completion:*:hosts' hosts $hosts
......
...@@ -3,11 +3,11 @@ function zsh_stats() { ...@@ -3,11 +3,11 @@ function zsh_stats() {
} }
function uninstall_oh_my_zsh() { function uninstall_oh_my_zsh() {
/bin/sh $ZSH/tools/uninstall.sh /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/uninstall.sh
} }
function upgrade_oh_my_zsh() { function upgrade_oh_my_zsh() {
/bin/sh $ZSH/tools/upgrade.sh /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh
} }
function take() { function take() {
......
...@@ -6,7 +6,7 @@ function git_prompt_info() { ...@@ -6,7 +6,7 @@ function git_prompt_info() {
# Checks if working tree is dirty # Checks if working tree is dirty
parse_git_dirty() { parse_git_dirty() {
if [[ -n $(git status -s 2> /dev/null) ]]; then if [[ -n $(git status -s --ignore-submodules=dirty 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"
......
...@@ -3,14 +3,11 @@ HISTFILE=$HOME/.zsh_history ...@@ -3,14 +3,11 @@ HISTFILE=$HOME/.zsh_history
HISTSIZE=10000 HISTSIZE=10000
SAVEHIST=10000 SAVEHIST=10000
setopt hist_ignore_dups # ignore duplication command history list setopt append_history
setopt share_history # share command history data
setopt hist_verify
setopt inc_append_history
setopt extended_history setopt extended_history
setopt hist_expire_dups_first setopt hist_expire_dups_first
setopt hist_ignore_dups # ignore duplication command history list
setopt hist_ignore_space setopt hist_ignore_space
setopt hist_verify
setopt SHARE_HISTORY setopt inc_append_history
setopt APPEND_HISTORY setopt share_history # share command history data
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#Limited support for Apple Terminal (Terminal can't set window or tab separately) #Limited support for Apple Terminal (Terminal can't set window or tab separately)
function title { function title {
[ "$DISABLE_AUTO_TITLE" != "true" ] || return [ "$DISABLE_AUTO_TITLE" != "true" ] || return
if [[ "$TERM" == screen* ]]; then if [[ "$TERM" == screen* ]]; then
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
print -Pn "\e]2;$2:q\a" #set window name 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,14 +16,18 @@ ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD
ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~" ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~"
#Appears when you have the prompt #Appears when you have the prompt
function precmd { function omz_termsupport_precmd {
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
} }
#Appears at the beginning of (and during) of command execution #Appears at the beginning of (and during) of command execution
function preexec { function omz_termsupport_preexec {
emulate -L zsh emulate -L zsh
setopt extended_glob setopt extended_glob
local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
title "$CMD" "%100>...>$2%<<" title "$CMD" "%100>...>$2%<<"
} }
autoload -U add-zsh-hook
add-zsh-hook precmd omz_termsupport_precmd
add-zsh-hook preexec omz_termsupport_preexec
...@@ -13,20 +13,27 @@ fpath=($ZSH/functions $ZSH/completions $fpath) ...@@ -13,20 +13,27 @@ fpath=($ZSH/functions $ZSH/completions $fpath)
# TIP: Add files you don't want in git to .gitignore # TIP: Add files you don't want in git to .gitignore
for config_file ($ZSH/lib/*.zsh) source $config_file for config_file ($ZSH/lib/*.zsh) source $config_file
# Add all defined plugins to fpath # Set ZSH_CUSTOM to the path where your custom config files
# and plugins exists, or else we will use the default custom/
if [[ -z "$ZSH_CUSTOM" ]]; then
ZSH_CUSTOM="$ZSH/custom"
fi
# Add all defined plugins to fpath. This must be done
# before running compinit.
plugin=${plugin:=()} plugin=${plugin:=()}
for plugin ($plugins) fpath=($ZSH/plugins/$plugin $fpath) for plugin ($plugins); do
if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then
fpath=($ZSH_CUSTOM/plugins/$plugin $fpath)
elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
fpath=($ZSH/plugins/$plugin $fpath)
fi
done
# Load and run compinit # Load and run compinit
autoload -U compinit autoload -U compinit
compinit -i compinit -i
# Set ZSH_CUSTOM to the path where your custom config files
# and plugins exists, or else we will use the default custom/
if [ "$ZSH_CUSTOM" = "" ]
then
ZSH_CUSTOM="$ZSH/custom"
fi
# Load all of the plugins that were defined in ~/.zshrc # Load all of the plugins that were defined in ~/.zshrc
for plugin ($plugins); do for plugin ($plugins); do
...@@ -52,7 +59,12 @@ then ...@@ -52,7 +59,12 @@ then
else else
if [ ! "$ZSH_THEME" = "" ] if [ ! "$ZSH_THEME" = "" ]
then then
source "$ZSH/themes/$ZSH_THEME.zsh-theme" if [ -f "$ZSH/custom/$ZSH_THEME.zsh-theme" ]
then
source "$ZSH/custom/$ZSH_THEME.zsh-theme"
else
source "$ZSH/themes/$ZSH_THEME.zsh-theme"
fi
fi fi
fi fi
...@@ -9,6 +9,7 @@ if [[ -x `which yaourt` ]]; then ...@@ -9,6 +9,7 @@ if [[ -x `which yaourt` ]]; then
alias yaconf='yaourt -C' # Fix all configuration files with vimdiff alias yaconf='yaourt -C' # Fix all configuration files with vimdiff
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
alias yaupg='yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system. alias yaupg='yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
alias yasu='yaourt --sucre' # Same as yaupg, but without confirmation
alias yain='yaourt -S' # Install specific package(s) from the repositories alias yain='yaourt -S' # Install specific package(s) from the repositories
alias yains='yaourt -U' # Install specific package not from the repositories but from a file alias yains='yaourt -U' # Install specific package not from the repositories but from a file
alias yare='yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies alias yare='yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
......
if [ -f `brew --prefix`/etc/autojump ]; then if [ -f /opt/local/etc/profile.d/autojump.sh ]; then
. /opt/local/etc/profile.d/autojump.sh
elif [ -f `brew --prefix`/etc/autojump ]; then
. `brew --prefix`/etc/autojump . `brew --prefix`/etc/autojump
fi fi
if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
function battery_pct_remaining() { echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')" }
function battery_time_remaining() { echo $(acpi | cut -f3 -d ',') }
function battery_pct_prompt() {
b=$(battery_pct_remaining)
if [ $b -gt 50 ] ; then
color='green'
elif [ $b -gt 20 ] ; then
color='yellow'
else
color='red'
fi
echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
}
else
error_msg='no battery'
function battery_pct_remaining() { echo $error_msg }
function battery_time_remaining() { echo $error_msg }
function battery_pct_prompt() { echo '' }
fi
...@@ -10,7 +10,7 @@ alias bu="bundle update" ...@@ -10,7 +10,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=(cap capify cucumber foreman guard heroku nanoc rackup rails rainbows rake rspec ruby shotgun spec spork thin unicorn unicorn_rails) bundled_commands=(annotate cap capify cucumber foreman guard heroku nanoc rackup rainbows rake rspec ruby shotgun spec spork thin unicorn unicorn_rails)
## Functions ## Functions
...@@ -41,6 +41,6 @@ for cmd in $bundled_commands; do ...@@ -41,6 +41,6 @@ for cmd in $bundled_commands; do
alias $cmd=bundled_$cmd alias $cmd=bundled_$cmd
if which _$cmd > /dev/null 2>&1; then if which _$cmd > /dev/null 2>&1; then
compdef _$cmd bundled_$cmd compdef _$cmd bundled_$cmd=$cmd
fi fi
done done
...@@ -54,7 +54,7 @@ if [[ $use_sudo -eq 1 ]]; then ...@@ -54,7 +54,7 @@ if [[ $use_sudo -eq 1 ]]; then
# 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:
# glob_subst # glob_subst
...@@ -113,9 +113,6 @@ alias allpkgs='aptitude search -F "%p" --disable-columns ~i' ...@@ -113,9 +113,6 @@ alias allpkgs='aptitude search -F "%p" --disable-columns ~i'
alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc' alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc'
# Functions ################################################################# # Functions #################################################################
# create a simple script that can be used to 'duplicate' a system # create a simple script that can be used to 'duplicate' a system
apt-copy() { apt-copy() {
...@@ -132,11 +129,46 @@ apt-copy() { ...@@ -132,11 +129,46 @@ apt-copy() {
chmod +x apt-copy.sh chmod +x apt-copy.sh
} }
# Prints apt history
# Usage:
# apt-history install
# apt-history upgrade
# apt-history remove
# apt-history rollback
# apt-history list
# Based On: http://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html
apt-history () {
case "$1" in
install)
zgrep --no-filename 'install ' $(ls -rt /var/log/dpkg*)
;;
upgrade|remove)
zgrep --no-filename $1 $(ls -rt /var/log/dpkg*)
;;
rollback)
zgrep --no-filename upgrade $(ls -rt /var/log/dpkg*) | \
grep "$2" -A10000000 | \
grep "$3" -B10000000 | \
awk '{print $4"="$5}'
;;
list)
zcat $(ls -rt /var/log/dpkg*)
;;
*)
echo "Parameters:"
echo " install - Lists all packages that have been installed."
echo " upgrade - Lists all packages that have been upgraded."
echo " remove - Lists all packages that have been removed."
echo " rollback - Lists rollback information."
echo " list - Lists all contains of dpkg logs."
;;
esac
}
# Kernel-package building shortcut # Kernel-package building shortcut
kerndeb () { kerndeb () {
# temporarily unset MAKEFLAGS ( '-j3' will fail ) # temporarily unset MAKEFLAGS ( '-j3' will fail )
MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' ) MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' )
print '$MAKEFLAGS set to '"'$MAKEFLAGS'" print '$MAKEFLAGS set to '"'$MAKEFLAGS'"
appendage='-custom' # this shows up in $ (uname -r ) appendage='-custom' # this shows up in $ (uname -r )
revision=$(date +"%Y%m%d") # this shows up in the .deb file name revision=$(date +"%Y%m%d") # this shows up in the .deb file name
......
...@@ -17,6 +17,7 @@ alias gca='git commit -v -a' ...@@ -17,6 +17,7 @@ alias gca='git commit -v -a'
compdef _git gca=git-commit compdef _git gca=git-commit
alias gco='git checkout' alias gco='git checkout'
compdef _git gco=git-checkout compdef _git gco=git-checkout
alias gcm='git checkout master'
alias gb='git branch' alias gb='git branch'
compdef _git gb=git-branch compdef _git gb=git-branch
alias gba='git branch -a' alias gba='git branch -a'
......
#---oh-my-zsh plugin : task Autocomplete for Jake tool---
# Jake : https://github.com/mde/jake
# Warning : Jakefile should have the right case : Jakefile or jakefile
# Tested on : MacOSX 10.7 (Lion), Ubuntu 11.10
# Author : Alexandre Lacheze (@al3xstrat)
# Inspiration : http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh
function _jake () {
if [ -f Jakefile ]||[ -f jakefile ]; then
compadd `jake -T | cut -d " " -f 2 | sed -E "s/.\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"`
fi
}
compdef _jake jake
\ No newline at end of file
...@@ -26,7 +26,7 @@ _knife() { ...@@ -26,7 +26,7 @@ _knife() {
case $state in case $state in
knifecmd) knifecmd)
compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec index node recipe role search ssh status windows $cloudproviders compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec environment index node recipe role search ssh status windows $cloudproviders
;; ;;
knifesubcmd) knifesubcmd)
case $words[2] in case $words[2] in
...@@ -42,6 +42,9 @@ _knife() { ...@@ -42,6 +42,9 @@ _knife() {
cookbook) cookbook)
compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload
;; ;;
environment)
compadd -Q "$@" list create delete edit show "from file"
;;
node) node)
compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete" compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete"
;; ;;
...@@ -138,27 +141,31 @@ _knife_options3() { ...@@ -138,27 +141,31 @@ _knife_options3() {
# The chef_x_remote functions use knife to get a list of objects of type x on the server # The chef_x_remote functions use knife to get a list of objects of type x on the server
_chef_roles_remote() { _chef_roles_remote() {
(knife role list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') (knife role list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
} }
_chef_clients_remote() { _chef_clients_remote() {
(knife client list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') (knife client list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
} }
_chef_nodes_remote() { _chef_nodes_remote() {
(knife node list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') (knife node list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
} }
_chef_cookbooks_remote() { _chef_cookbooks_remote() {
(knife cookbook list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') (knife cookbook list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
} }
_chef_sitecookbooks_remote() { _chef_sitecookbooks_remote() {
(knife cookbook site list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') (knife cookbook site list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
} }
_chef_data_bags_remote() { _chef_data_bags_remote() {
(knife data bag list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') (knife data bag list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
}
_chef_environments_remote() {
(knife environment list | awk '{print $1}')
} }
# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server # The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server
......
...@@ -3,30 +3,43 @@ ...@@ -3,30 +3,43 @@
# pip zsh completion, based on homebrew completion # pip zsh completion, based on homebrew completion
_pip_all() {
# we cache the list of packages (originally from the macports plugin)
if (( ! $+piplist )); then
echo -n " (caching package index...)"
piplist=($(pip search * | cut -d ' ' -f 1 | tr '[A-Z]' '[a-z]'))
fi
}
_pip_installed() { _pip_installed() {
installed_pkgs=(`pip freeze`) installed_pkgs=(`pip freeze | cut -d '=' -f 1`)
} }
local -a _1st_arguments local -a _1st_arguments
_1st_arguments=( _1st_arguments=(
'bundle:Create pybundles (archives containing multiple packages)' 'bundle:create pybundles (archives containing multiple packages)'
'freeze:Output all currently installed packages (exact versions) to stdout' 'freeze:output all currently installed packages (exact versions) to stdout'
'help:Show available commands' 'help:show available commands'
'install:Install packages' 'install:install packages'
'search:Search PyPI' 'search:search PyPI'
'uninstall:Uninstall packages' 'uninstall:uninstall packages'
'unzip:Unzip individual packages' 'unzip:unzip individual packages'
'zip:Zip individual packages' 'zip:zip individual packages'
) )
local expl local expl
local -a pkgs installed_pkgs local -a all_pkgs installed_pkgs
_arguments \ _arguments \
'(--version)--version[Show version number of program and exit]' \ '(--version)--version[show version number of program and exit]' \
'(-v --verbose)'{-v,--verbose}'[Give more output]' \ '(-h --help)'{-h,--help}'[show help]' \
'(-q --quiet)'{-q,--quiet}'[Give less output]' \ '(-E --environment)'{-E,--environment}'[virtualenv environment to run pip in]' \
'(-h --help)'{-h,--help}'[Show help]' \ '(-s --enable-site-packages)'{-s,--enable-site-packages}'[include site-packages in virtualenv]' \
'(-v --verbose)'{-v,--verbose}'[give more output]' \
'(-q --quiet)'{-q,--quiet}'[give less output]' \
'(--log)--log[log file location]' \
'(--proxy)--proxy[proxy in form user:passwd@proxy.server:port]' \
'(--timeout)--timeout[socket timeout (default 15s)]' \
'*:: :->subcmds' && return 0 '*:: :->subcmds' && return 0
if (( CURRENT == 1 )); then if (( CURRENT == 1 )); then
...@@ -35,10 +48,25 @@ if (( CURRENT == 1 )); then ...@@ -35,10 +48,25 @@ if (( CURRENT == 1 )); then
fi fi
case "$words[1]" in case "$words[1]" in
list) search)
if [[ "$state" == forms ]]; then _arguments \
_pip_installed '(--index)--index[base URL of Python Package Index]' ;;
_requested installed_pkgs expl 'installed packages' compadd -a installed_pkgs freeze)
_arguments \
'(-l --local)'{-l,--local}'[report only virtualenv packages]' ;;
install)
_arguments \
'(-U --upgrade)'{-U,--upgrade}'[upgrade all packages to the newest available version]' \
'(-f --find-links)'{-f,--find-links}'[URL for finding packages]' \
'(--no-deps --no-dependencies)'{--no-deps,--no-dependencies}'[iIgnore package dependencies]' \
'(--no-install)--no-install[only download packages]' \
'(--no-download)--no-download[only install downloaded packages]' \
'(--install-option)--install-option[extra arguments to be supplied to the setup.py]' \
'1: :->packages' && return 0
if [[ "$state" == packages ]]; then
_pip_all
_wanted piplist expl 'packages' compadd -a piplist
fi ;; fi ;;
uninstall) uninstall)
_pip_installed _pip_installed
......
...@@ -17,3 +17,5 @@ alias rp='_rails_command plugin' ...@@ -17,3 +17,5 @@ alias rp='_rails_command plugin'
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'
alias rdm='rake db:migrate'
alias rdr='rake db:rollback'
FOUND_RBENV=0
for rbenvdir in "$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv" ; do
if [ -d $rbenvdir/bin -a $FOUND_RBENV -eq 0 ] ; then
FOUND_RBENV=1
export RBENV_ROOT=$rbenvdir
export PATH=${rbenvdir}/bin:$PATH
eval "$(rbenv init -)"
alias rubies="rbenv versions"
alias gemsets="rbenv gemset list"
function current_ruby() {
echo "$(rbenv version-name)"
}
function current_gemset() {
echo "$(rbenv gemset active 2&>/dev/null | sed -e ":a" -e '$ s/\n/+/gp;N;b a' | head -n1)"
}
function gems {
local rbenv_path=$(rbenv prefix)
gem list $@ | sed \
-Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
-Ee "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_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"
}
function rbenv_prompt_info() {
if [[ -n $(current_gemset) ]] ; then
echo "$(current_ruby)@$(current_gemset)"
else
echo "$(current_ruby)"
fi
}
fi
done
unset rbenvdir
if [ $FOUND_RBENV -eq 0 ] ; then
alias rubies='ruby -v'
function gemsets() { echo 'not supported' }
function rbenv_prompt_info() { echo "system: $(ruby -v | cut -f-2 -d ' ')" }
fi
...@@ -3,4 +3,4 @@ ...@@ -3,4 +3,4 @@
alias sgem='sudo gem' alias sgem='sudo gem'
# Find ruby file # Find ruby file
alias rfind='find . -name *.rb | xargs grep -n' alias rfind='find . -name "*.rb" | xargs grep -n'
...@@ -37,7 +37,7 @@ function gems { ...@@ -37,7 +37,7 @@ function gems {
local current_gemset=`rvm-prompt g` local current_gemset=`rvm-prompt g`
gem list $@ | sed \ gem list $@ | sed \
-Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \ -Ee "s/\([0-9, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \
-Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$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@global/$fg[yellow]&$reset_color/g" \
-Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g" -Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment