mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-02 02:19:06 +01:00
finally back in sync with upstream
This commit is contained in:
parent
d3db100dbd
commit
9e18792790
52 changed files with 688 additions and 289 deletions
|
|
@ -32,19 +32,21 @@ 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
|
||||||
|
|
||||||
# Use caching so that commands like apt and dpkg complete are useable
|
# Use caching so that commands like apt and dpkg complete are useable
|
||||||
zstyle ':completion::complete:*' use-cache 1
|
zstyle ':completion::complete:*' use-cache 1
|
||||||
zstyle ':completion::complete:*' cache-path ~/.oh-my-zsh/cache/
|
zstyle ':completion::complete:*' cache-path $ZSH/cache/
|
||||||
|
|
||||||
# Don't complete uninteresting users
|
# Don't complete uninteresting users
|
||||||
zstyle ':completion:*:*:*:users' ignored-patterns \
|
zstyle ':completion:*:*:*:users' ignored-patterns \
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,9 @@ cd () {
|
||||||
|
|
||||||
alias md='mkdir -p'
|
alias md='mkdir -p'
|
||||||
alias rd=rmdir
|
alias rd=rmdir
|
||||||
alias d='dirs -v'
|
alias d='dirs -v | head -10'
|
||||||
|
|
||||||
# mkdir & cd to it
|
# mkdir & cd to it
|
||||||
function mcd() {
|
function mcd() {
|
||||||
mkdir -p "$1" && cd "$1";
|
mkdir -p "$1" && cd "$1";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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() {
|
||||||
|
|
|
||||||
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 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
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
bindkey -e
|
bindkey -e
|
||||||
bindkey '\ew' kill-region
|
bindkey '\ew' kill-region
|
||||||
bindkey -s '\el' "ls\n"
|
bindkey -s '\el' "ls\n"
|
||||||
bindkey -s '\e.' "..\n"
|
|
||||||
bindkey '^r' history-incremental-search-backward
|
bindkey '^r' history-incremental-search-backward
|
||||||
bindkey "^[[5~" up-line-or-history
|
bindkey "^[[5~" up-line-or-history
|
||||||
bindkey "^[[6~" down-line-or-history
|
bindkey "^[[6~" down-line-or-history
|
||||||
|
|
|
||||||
|
|
@ -9,5 +9,5 @@ bindkey "^[m" copy-prev-shell-word
|
||||||
setopt long_list_jobs
|
setopt long_list_jobs
|
||||||
|
|
||||||
## pager
|
## pager
|
||||||
export PAGER=less
|
export PAGER="less -R"
|
||||||
export LC_CTYPE=$LANG
|
export LC_CTYPE=$LANG
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,10 @@
|
||||||
#Fully support screen, iterm, and probably most modern xterm and rxvt
|
#Fully support screen, iterm, and probably most modern xterm and rxvt
|
||||||
#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
|
if [[ "$DISABLE_AUTO_TITLE" == "true" ]] || [[ "$EMACS" == *term* ]]; then
|
||||||
if [[ "$TERM" == screen* ]]; then
|
return
|
||||||
|
fi
|
||||||
|
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 +18,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
|
||||||
|
|
|
||||||
42
oh-my-zsh.sh
42
oh-my-zsh.sh
|
|
@ -1,7 +1,7 @@
|
||||||
# Check for updates on initial load...
|
# Check for updates on initial load...
|
||||||
if [ "$DISABLE_AUTO_UPDATE" != "true" ]
|
if [ "$DISABLE_AUTO_UPDATE" != "true" ]
|
||||||
then
|
then
|
||||||
/usr/bin/env zsh $ZSH/tools/check_for_upgrade.sh
|
/usr/bin/env ZSH=$ZSH zsh $ZSH/tools/check_for_upgrade.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Initializes Oh My Zsh
|
# Initializes Oh My Zsh
|
||||||
|
|
@ -13,25 +13,45 @@ 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
|
||||||
plugin=${plugin:=()}
|
# and plugins exists, or else we will use the default custom/
|
||||||
for plugin ($plugins) fpath=($ZSH/plugins/$plugin $fpath)
|
if [[ -z "$ZSH_CUSTOM" ]]; then
|
||||||
|
ZSH_CUSTOM="$ZSH/custom"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
is_plugin() {
|
||||||
|
local base_dir=$1
|
||||||
|
local name=$2
|
||||||
|
test -f $base_dir/plugins/$name/$name.plugin.zsh \
|
||||||
|
|| test -f $base_dir/plugins/$name/_$name
|
||||||
|
}
|
||||||
|
# Add all defined plugins to fpath. This must be done
|
||||||
|
# before running compinit.
|
||||||
|
for plugin ($plugins); do
|
||||||
|
if is_plugin $ZSH_CUSTOM $plugin; then
|
||||||
|
fpath=($ZSH_CUSTOM/plugins/$plugin $fpath)
|
||||||
|
elif is_plugin $ZSH $plugin; 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
|
||||||
|
|
||||||
|
|
||||||
# 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
|
||||||
if [ -f $ZSH/custom/plugins/$plugin/$plugin.plugin.zsh ]; then
|
if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then
|
||||||
source $ZSH/custom/plugins/$plugin/$plugin.plugin.zsh
|
source $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh
|
||||||
elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
|
elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
|
||||||
source $ZSH/plugins/$plugin/$plugin.plugin.zsh
|
source $ZSH/plugins/$plugin/$plugin.plugin.zsh
|
||||||
fi
|
fi
|
||||||
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" ]
|
||||||
|
|
@ -45,7 +65,11 @@ 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
|
||||||
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
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,9 @@
|
||||||
if [ -f `brew --prefix`/etc/autojump ]; then
|
if [ $commands[autojump] ]; then # check if autojump is installed
|
||||||
. `brew --prefix`/etc/autojump
|
if [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package
|
||||||
|
. /usr/share/autojump/autojump.zsh
|
||||||
|
elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation
|
||||||
|
. /etc/profile.d/autojump.zsh
|
||||||
|
elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump ]; then # mac os x with brew
|
||||||
|
. `brew --prefix`/etc/autojump
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
alias be="bundle exec"
|
alias be="bundle exec"
|
||||||
alias bi="bundle install"
|
alias bi="bundle install"
|
||||||
alias bl="bundle list"
|
alias bl="bundle list"
|
||||||
alias bu="bundle update"
|
|
||||||
alias bp="bundle package"
|
alias bp="bundle package"
|
||||||
|
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 guard heroku rackup rails rake rspec ruby shotgun spec spork thin unicorn unicorn_rails)
|
bundled_commands=(annotate cap capify cucumber foreman guard middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails)
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
|
|
||||||
|
|
@ -16,7 +16,7 @@ _bundler-installed() {
|
||||||
|
|
||||||
_within-bundled-project() {
|
_within-bundled-project() {
|
||||||
local check_dir=$PWD
|
local check_dir=$PWD
|
||||||
while [ "$(dirname $check_dir)" != "/" ]; do
|
while [ $check_dir != "/" ]; do
|
||||||
[ -f "$check_dir/Gemfile" ] && return
|
[ -f "$check_dir/Gemfile" ] && return
|
||||||
check_dir="$(dirname $check_dir)"
|
check_dir="$(dirname $check_dir)"
|
||||||
done
|
done
|
||||||
|
|
@ -33,5 +33,10 @@ _run-with-bundler() {
|
||||||
|
|
||||||
## Main program
|
## Main program
|
||||||
for cmd in $bundled_commands; do
|
for cmd in $bundled_commands; do
|
||||||
alias $cmd="_run-with-bundler $cmd"
|
eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}"
|
||||||
|
alias $cmd=bundled_$cmd
|
||||||
|
|
||||||
|
if which _$cmd > /dev/null 2>&1; then
|
||||||
|
compdef _$cmd bundled_$cmd=$cmd
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,22 @@
|
||||||
# Set this to 1 if you want to cache the tasks
|
# Set this to 1 if you want to cache the tasks
|
||||||
cache_task_list=1
|
_cake_cache_task_list=1
|
||||||
|
|
||||||
# Cache filename
|
# Cache filename
|
||||||
cache_file='.cake_task_cache'
|
_cake_task_cache_file='.cake_task_cache'
|
||||||
|
|
||||||
|
_cake_get_target_list () {
|
||||||
|
cake | grep '^cake ' | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$'
|
||||||
|
}
|
||||||
|
|
||||||
_cake_does_target_list_need_generating () {
|
_cake_does_target_list_need_generating () {
|
||||||
|
|
||||||
if [ $cache_task_list -eq 0 ]; then
|
if [ ${_cake_cache_task_list} -eq 0 ]; then
|
||||||
return 1;
|
return 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $cache_file ]; then return 0;
|
if [ ! -f ${_cake_task_cache_file} ]; then return 0;
|
||||||
else
|
else
|
||||||
accurate=$(stat -f%m $cache_file)
|
accurate=$(stat -f%m $_cake_task_cache_file)
|
||||||
changed=$(stat -f%m Cakefile)
|
changed=$(stat -f%m Cakefile)
|
||||||
return $(expr $accurate '>=' $changed)
|
return $(expr $accurate '>=' $changed)
|
||||||
fi
|
fi
|
||||||
|
|
@ -21,12 +25,12 @@ _cake_does_target_list_need_generating () {
|
||||||
_cake () {
|
_cake () {
|
||||||
if [ -f Cakefile ]; then
|
if [ -f Cakefile ]; then
|
||||||
if _cake_does_target_list_need_generating; then
|
if _cake_does_target_list_need_generating; then
|
||||||
cake | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$' > $cache_file
|
_cake_get_target_list > ${_cake_task_cache_file}
|
||||||
compadd `cat $cache_file`
|
compadd `cat ${_cake_task_cache_file}`
|
||||||
else
|
else
|
||||||
compadd `cake | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$'`
|
compadd `_cake_get_target_list`
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
compdef _cake cake
|
compdef _cake cake
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
# Aliases
|
|
||||||
alias as="aptitude -F \"* %p -> %d \n(%v/%V)\" \
|
|
||||||
--no-gui --disable-columns search" # search package
|
|
||||||
alias ad="sudo apt-get update" # update packages lists
|
|
||||||
alias au="sudo apt-get update && \
|
|
||||||
sudo apt-get dselect-upgrade" # upgrade packages
|
|
||||||
alias ai="sudo apt-get install" # install package
|
|
||||||
alias ar="sudo apt-get remove --purge && \
|
|
||||||
sudo apt-get autoremove --purge" # remove package
|
|
||||||
alias ap="apt-cache policy" # apt policy
|
|
||||||
alias av="apt-cache show" # show package info
|
|
||||||
alias acs="apt-cache search" # search package
|
|
||||||
alias ac="sudo apt-get clean && sudo apt-get autoclean" # clean apt cache
|
|
||||||
|
|
@ -1,53 +1,178 @@
|
||||||
# https://github.com/dbbolton/
|
# Authors:
|
||||||
|
# https://github.com/AlexBio
|
||||||
|
# https://github.com/dbb
|
||||||
#
|
#
|
||||||
# Debian-related zsh aliases and functions for zsh
|
# Debian-related zsh aliases and functions for zsh
|
||||||
|
|
||||||
|
# Use aptitude if installed, or apt-get if not.
|
||||||
|
# You can just set apt_pref='apt-get' to override it.
|
||||||
|
if [[ -e $( which aptitude ) ]]; then
|
||||||
|
apt_pref='aptitude'
|
||||||
|
else
|
||||||
|
apt_pref='apt-get'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use sudo by default if it's installed
|
||||||
|
if [[ -e $( which sudo ) ]]; then
|
||||||
|
use_sudo=1
|
||||||
|
fi
|
||||||
|
|
||||||
# Aliases ###################################################################
|
# Aliases ###################################################################
|
||||||
|
# These are for more obscure uses of apt-get and aptitude that aren't covered
|
||||||
|
# below.
|
||||||
|
alias ag='apt-get'
|
||||||
|
alias at='aptitude'
|
||||||
|
|
||||||
# Some self-explanatory aliases
|
# Some self-explanatory aliases
|
||||||
alias afs='apt-file search --regexp'
|
alias acs="apt-cache search"
|
||||||
alias aps='aptitude search'
|
alias aps='aptitude search'
|
||||||
alias apsrc='apt-get source'
|
alias as="aptitude -F \"* %p -> %d \n(%v/%V)\" \
|
||||||
alias apv='apt-cache policy'
|
--no-gui --disable-columns search" # search package
|
||||||
|
|
||||||
alias apdg='su -c "aptitude update && aptitude safe-upgrade"'
|
# apt-file
|
||||||
alias apud='su -c "aptitude update"'
|
alias afs='apt-file search --regexp'
|
||||||
alias apug='su -c "aptitude safe-upgrade"'
|
|
||||||
|
|
||||||
|
|
||||||
|
# These are apt-get only
|
||||||
|
alias asrc='apt-get source'
|
||||||
|
alias ap='apt-cache policy'
|
||||||
|
|
||||||
|
# superuser operations ######################################################
|
||||||
|
if [[ $use_sudo -eq 1 ]]; then
|
||||||
|
# commands using sudo #######
|
||||||
|
alias aac='sudo $apt_pref autoclean'
|
||||||
|
alias abd='sudo $apt_pref build-dep'
|
||||||
|
alias ac='sudo $apt_pref clean'
|
||||||
|
alias ad='sudo $apt_pref update'
|
||||||
|
alias adg='sudo $apt_pref update && sudo $apt_pref upgrade'
|
||||||
|
alias adu='sudo $apt_pref update && sudo $apt_pref dist-upgrade'
|
||||||
|
alias afu='sudo apt-file update'
|
||||||
|
alias ag='sudo $apt_pref upgrade'
|
||||||
|
alias ai='sudo $apt_pref install'
|
||||||
|
# Install all packages given on the command line while using only the first word of each line:
|
||||||
|
# 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
|
||||||
|
alias ads='sudo $apt_pref dselect-upgrade'
|
||||||
|
|
||||||
|
# Install all .deb files in the current directory.
|
||||||
|
# Warning: you will need to put the glob in single quotes if you use:
|
||||||
|
# glob_subst
|
||||||
|
alias di='sudo dpkg -i ./*.deb'
|
||||||
|
|
||||||
|
# Remove ALL kernel images and headers EXCEPT the one in use
|
||||||
|
alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \
|
||||||
|
?not(~n`uname -r`))'
|
||||||
|
|
||||||
|
|
||||||
|
# commands using su #########
|
||||||
|
else
|
||||||
|
alias aac='su -ls \'$apt_pref autoclean\' root'
|
||||||
|
abd() {
|
||||||
|
cmd="su -lc '$apt_pref build-dep $@' root"
|
||||||
|
print "$cmd"
|
||||||
|
eval "$cmd"
|
||||||
|
}
|
||||||
|
alias ac='su -ls \'$apt_pref clean\' root'
|
||||||
|
alias ad='su -lc \'$apt_pref update\' root'
|
||||||
|
alias adg='su -lc \'$apt_pref update && aptitude safe-upgrade\' root'
|
||||||
|
alias adu='su -lc \'$apt_pref update && aptitude dist-upgrade\' root'
|
||||||
|
alias afu='su -lc "apt-file update"'
|
||||||
|
alias ag='su -lc \'$apt_pref safe-upgrade\' root'
|
||||||
|
ai() {
|
||||||
|
cmd="su -lc 'aptitude -P install $@' root"
|
||||||
|
print "$cmd"
|
||||||
|
eval "$cmd"
|
||||||
|
}
|
||||||
|
ap() {
|
||||||
|
cmd="su -lc '$apt_pref -P purge $@' root"
|
||||||
|
print "$cmd"
|
||||||
|
eval "$cmd"
|
||||||
|
}
|
||||||
|
ar() {
|
||||||
|
cmd="su -lc '$apt_pref -P remove $@' root"
|
||||||
|
print "$cmd"
|
||||||
|
eval "$cmd"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Install all .deb files in the current directory
|
||||||
|
# Assumes glob_subst is off
|
||||||
|
alias di='su -lc "dpkg -i ./*.deb" root'
|
||||||
|
|
||||||
|
# Remove ALL kernel images and headers EXCEPT the one in use
|
||||||
|
alias kclean='su -lc '\''aptitude remove -P ?and(~i~nlinux-(ima|hea) \
|
||||||
|
?not(~n`uname -r`))'\'' root'
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Misc. #####################################################################
|
||||||
# print all installed packages
|
# print all installed packages
|
||||||
alias allpkgs='aptitude search -F "%p" --disable-columns ~i'
|
alias allpkgs='aptitude search -F "%p" --disable-columns ~i'
|
||||||
|
|
||||||
# Install all .deb files in the current directory.
|
|
||||||
# Warning: you will need to put the glob in single quotes if you use:
|
|
||||||
# glob_subst
|
|
||||||
alias di='su -c "dpkg -i ./*.deb"'
|
|
||||||
|
|
||||||
# Create a basic .deb package
|
# Create a basic .deb package
|
||||||
alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc'
|
alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc'
|
||||||
|
|
||||||
# Remove ALL kernel images and headers EXCEPT the one in use
|
|
||||||
alias kclean='su -c '\''aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n`uname -r`))'\'' root'
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# 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() {
|
||||||
print '#!/bin/sh'"\n" > apt-copy.sh
|
print '#!/bin/sh'"\n" > apt-copy.sh
|
||||||
|
|
||||||
list=$(perl -m'AptPkg::Cache' -e '$c=AptPkg::Cache->new; for (keys %$c){ push @a, $_ if $c->{$_}->{'CurrentState'} eq 'Installed';} print "$_ " for sort @a;')
|
cmd='$apt_pref install'
|
||||||
|
|
||||||
print 'aptitude install '"$list\n" >> apt-copy.sh
|
for p in ${(f)"$(aptitude search -F "%p" --disable-columns \~i)"}; {
|
||||||
|
cmd="${cmd} ${p}"
|
||||||
|
}
|
||||||
|
|
||||||
chmod +x apt-copy.sh
|
print $cmd "\n" >> 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
|
||||||
dbb-build () {
|
kerndeb () {
|
||||||
MAKEFLAGS='' # temporarily unset MAKEFLAGS ( '-j3' will fail )
|
# temporarily unset MAKEFLAGS ( '-j3' will fail )
|
||||||
|
MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' )
|
||||||
|
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
|
||||||
|
|
||||||
|
|
@ -57,4 +182,3 @@ dbb-build () {
|
||||||
"$revision" kernel_image kernel_headers
|
"$revision" kernel_image kernel_headers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ dirpersistinstall () {
|
||||||
if grep 'dirpersiststore' ~/.zlogout > /dev/null; then
|
if grep 'dirpersiststore' ~/.zlogout > /dev/null; then
|
||||||
else
|
else
|
||||||
if read -q \?"Would you like to set up your .zlogout file for use with dirspersist? (y/n) "; then
|
if read -q \?"Would you like to set up your .zlogout file for use with dirspersist? (y/n) "; then
|
||||||
echo "# Store dirs stack\n# See ~/.oh-my-zsh/plugins/dirspersist.plugin.zsh\ndirpersiststore" >> ~/.zlogout
|
echo "# Store dirs stack\n# See $ZSH/plugins/dirspersist.plugin.zsh\ndirpersiststore" >> ~/.zlogout
|
||||||
else
|
else
|
||||||
echo "If you don't want this message to appear, remove dirspersist from \$plugins"
|
echo "If you don't want this message to appear, remove dirspersist from \$plugins"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -220,3 +220,4 @@ _managepy() {
|
||||||
|
|
||||||
compdef _managepy manage.py
|
compdef _managepy manage.py
|
||||||
compdef _managepy django
|
compdef _managepy django
|
||||||
|
compdef _managepy django-manage
|
||||||
|
|
|
||||||
|
|
@ -78,8 +78,3 @@ function extract() {
|
||||||
|
|
||||||
alias x=extract
|
alias x=extract
|
||||||
|
|
||||||
# add extract completion function to path
|
|
||||||
fpath=($ZSH/plugins/extract $fpath)
|
|
||||||
autoload -U compinit
|
|
||||||
compinit -i
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,8 @@ __git-flow-release ()
|
||||||
-u'[Use the given GPG-key for the digital signature (implies -s)]'\
|
-u'[Use the given GPG-key for the digital signature (implies -s)]'\
|
||||||
-m'[Use the given tag message]'\
|
-m'[Use the given tag message]'\
|
||||||
-p'[Push to $ORIGIN after performing finish]'\
|
-p'[Push to $ORIGIN after performing finish]'\
|
||||||
|
-k'[Keep branch after performing finish]'\
|
||||||
|
-n"[Don't tag this release]"\
|
||||||
':version:__git_flow_version_list'
|
':version:__git_flow_version_list'
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
@ -162,6 +164,8 @@ __git-flow-hotfix ()
|
||||||
-u'[Use the given GPG-key for the digital signature (implies -s)]'\
|
-u'[Use the given GPG-key for the digital signature (implies -s)]'\
|
||||||
-m'[Use the given tag message]'\
|
-m'[Use the given tag message]'\
|
||||||
-p'[Push to $ORIGIN after performing finish]'\
|
-p'[Push to $ORIGIN after performing finish]'\
|
||||||
|
-k'[Keep branch after performing finish]'\
|
||||||
|
-n"[Don't tag this release]"\
|
||||||
':hotfix:__git_flow_hotfix_list'
|
':hotfix:__git_flow_hotfix_list'
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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'
|
||||||
|
|
@ -33,6 +34,10 @@ alias gss='git status -s'
|
||||||
compdef _git gss=git-status
|
compdef _git gss=git-status
|
||||||
alias ga='git add'
|
alias ga='git add'
|
||||||
compdef _git ga=git-add
|
compdef _git ga=git-add
|
||||||
|
alias gm='git merge'
|
||||||
|
compdef _git gm=git-merge
|
||||||
|
alias grh='git reset HEAD'
|
||||||
|
alias grhh='git reset HEAD --hard'
|
||||||
|
|
||||||
# Git and svn mix
|
# Git and svn mix
|
||||||
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
|
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
|
||||||
|
|
@ -49,6 +54,12 @@ function current_branch() {
|
||||||
echo ${ref#refs/heads/}
|
echo ${ref#refs/heads/}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function current_repository() {
|
||||||
|
|
||||||
|
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
|
||||||
|
echo $(git remote -v | cut -d':' -f 2)
|
||||||
|
}
|
||||||
|
|
||||||
# these aliases take advantage of the previous function
|
# these aliases take advantage of the previous function
|
||||||
alias ggpull='git pull origin $(current_branch)'
|
alias ggpull='git pull origin $(current_branch)'
|
||||||
compdef ggpull=git
|
compdef ggpull=git
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,70 @@
|
||||||
# hub alias from defunkt
|
# Setup hub function for git, if it is available; http://github.com/defunkt/hub
|
||||||
# https://github.com/defunkt/hub
|
if [ "$commands[(I)hub]" ] && [ "$commands[(I)ruby]" ]; then
|
||||||
if [ "$commands[(I)hub]" ]; then
|
|
||||||
# eval `hub alias -s zsh`
|
# eval `hub alias -s zsh`
|
||||||
function git(){hub "$@"}
|
function git(){
|
||||||
|
if ! (( $+_has_working_hub )); then
|
||||||
|
hub --version &> /dev/null
|
||||||
|
_has_working_hub=$(($? == 0))
|
||||||
|
fi
|
||||||
|
if (( $_has_working_hub )) ; then
|
||||||
|
hub "$@"
|
||||||
|
else
|
||||||
|
command git "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Functions #################################################################
|
||||||
|
|
||||||
|
# https://github.com/dbb
|
||||||
|
|
||||||
|
|
||||||
|
# empty_gh [NAME_OF_REPO]
|
||||||
|
#
|
||||||
|
# Use this when creating a new repo from scratch.
|
||||||
|
empty_gh() { # [NAME_OF_REPO]
|
||||||
|
repo = $1
|
||||||
|
ghuser=$( git config github.user )
|
||||||
|
|
||||||
|
mkdir "$repo"
|
||||||
|
cd "$repo"
|
||||||
|
git init
|
||||||
|
touch README
|
||||||
|
git add README
|
||||||
|
git commit -m 'Initial commit.'
|
||||||
|
git remote add origin git@github.com:${ghuser}/${repo}.git
|
||||||
|
git push -u origin master
|
||||||
|
}
|
||||||
|
|
||||||
|
# new_gh [DIRECTORY]
|
||||||
|
#
|
||||||
|
# Use this when you have a directory that is not yet set up for git.
|
||||||
|
# This function will add all non-hidden files to git.
|
||||||
|
new_gh() { # [DIRECTORY]
|
||||||
|
cd "$1"
|
||||||
|
ghuser=$( git config github.user )
|
||||||
|
|
||||||
|
git init
|
||||||
|
# add all non-dot files
|
||||||
|
print '.*'"\n"'*~' >> .gitignore
|
||||||
|
git add ^.*
|
||||||
|
git commit -m 'Initial commit.'
|
||||||
|
git remote add origin git@github.com:${ghuser}/${repo}.git
|
||||||
|
git push -u origin master
|
||||||
|
}
|
||||||
|
|
||||||
|
# exist_gh [DIRECTORY]
|
||||||
|
#
|
||||||
|
# Use this when you have a git repo that's ready to go and you want to add it
|
||||||
|
# to your GitHub.
|
||||||
|
exist_gh() { # [DIRECTORY]
|
||||||
|
cd "$1"
|
||||||
|
name=$( git config user.name )
|
||||||
|
ghuser=$( git config github.user )
|
||||||
|
|
||||||
|
git remote add origin git@github.com:${ghuser}/${repo}.git
|
||||||
|
git push -u origin master
|
||||||
|
}
|
||||||
|
|
||||||
|
# End Functions #############################################################
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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() {
|
||||||
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() {
|
||||||
|
|
||||||
# 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
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ alias iminurbase='finger'
|
||||||
alias btw='nice'
|
alias btw='nice'
|
||||||
alias obtw='nohup'
|
alias obtw='nohup'
|
||||||
|
|
||||||
alias nomz='ps -aux'
|
alias nomz='ps aux'
|
||||||
alias nomnom='killall'
|
alias nomnom='killall'
|
||||||
|
|
||||||
alias byes='exit'
|
alias byes='exit'
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
#compdef npm
|
|
||||||
|
|
||||||
# Node Package Manager 0.3.15 completion, letting npm do all the completion work
|
|
||||||
|
|
||||||
_npm() {
|
|
||||||
compadd -- $(_npm_complete $words)
|
|
||||||
}
|
|
||||||
|
|
||||||
# We want to show all errors of any substance, but never the "npm (not )ok" one.
|
|
||||||
# (Also doesn't consider "ERR! no match found" worth breaking the terminal for.)
|
|
||||||
_npm_complete() {
|
|
||||||
local ask_npm
|
|
||||||
ask_npm=(npm completion --color false --loglevel error -- $@)
|
|
||||||
{ _call_program npm $ask_npm 2>&1 >&3 \
|
|
||||||
| egrep -v '^(npm (not |)ok|ERR! no match found)$' >&2; \
|
|
||||||
} 3>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
_npm "$@"
|
|
||||||
|
|
@ -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
|
||||||
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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
fi
|
#
|
||||||
|
# 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
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
# View the standard out (puts) from any pow app
|
||||||
|
alias kaput="tail -f ~/Library/Logs/Pow/apps/*"
|
||||||
|
|
|
||||||
|
|
@ -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'
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,11 @@ alias rd='_rails_command destroy'
|
||||||
alias rdb='_rails_command dbconsole'
|
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 rgm='_rails_command generate migration'
|
||||||
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'
|
||||||
|
alias rdm='rake db:migrate'
|
||||||
|
alias rdr='rake db:rollback'
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
||||||
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"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
function svn_prompt_info {
|
function svn_prompt_info {
|
||||||
if [ in_svn ]; then
|
if [ $(in_svn) ]; then
|
||||||
echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\
|
echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\
|
||||||
$ZSH_THEME_REPO_NAME_COLOR$(svn_get_repo_name)$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$ZSH_PROMPT_BASE_COLOR"
|
$ZSH_THEME_REPO_NAME_COLOR$(svn_get_repo_name)$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$ZSH_PROMPT_BASE_COLOR"
|
||||||
fi
|
fi
|
||||||
|
|
@ -13,21 +13,21 @@ function in_svn() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function svn_get_repo_name {
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
function svn_get_rev_nr {
|
function svn_get_rev_nr {
|
||||||
if [ in_svn ]; then
|
if [ $(in_svn) ]; then
|
||||||
svn info 2> /dev/null | sed -n s/Revision:\ //p
|
svn info 2> /dev/null | sed -n s/Revision:\ //p
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function svn_dirty_choose {
|
function svn_dirty_choose {
|
||||||
if [ in_svn ]; then
|
if [ $(in_svn) ]; then
|
||||||
s=$(svn status|grep -E '^\s*[ACDIM!?L]' 2>/dev/null)
|
s=$(svn status|grep -E '^\s*[ACDIM!?L]' 2>/dev/null)
|
||||||
if [ $s ]; then
|
if [ $s ]; then
|
||||||
echo $1
|
echo $1
|
||||||
|
|
|
||||||
|
|
@ -1,37 +1,37 @@
|
||||||
#compdef task
|
#compdef task
|
||||||
#
|
|
||||||
# zsh completion for taskwarrior
|
# zsh completion for taskwarrior
|
||||||
#
|
#
|
||||||
|
# taskwarrior - a command line task list manager.
|
||||||
|
#
|
||||||
# Copyright 2010 - 2011 Johannes Schlatow
|
# Copyright 2010 - 2011 Johannes Schlatow
|
||||||
# Copyright 2009 P.C. Shyamshankar
|
# Copyright 2009 P.C. Shyamshankar
|
||||||
# All rights reserved.
|
|
||||||
#
|
#
|
||||||
# This script is part of the taskwarrior project.
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify it under
|
# The above copyright notice and this permission notice shall be included
|
||||||
# the terms of the GNU General Public License as published by the Free Software
|
# in all copies or substantial portions of the Software.
|
||||||
# Foundation; either version 2 of the License, or (at your option) any later
|
|
||||||
# version.
|
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
# details.
|
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License along with
|
# http://www.opensource.org/licenses/mit-license.php
|
||||||
# this program; if not, write to the
|
|
||||||
#
|
|
||||||
# Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor,
|
|
||||||
# Boston, MA
|
|
||||||
# 02110-1301
|
|
||||||
# USA
|
|
||||||
#
|
#
|
||||||
typeset -g _task_cmds _task_projects _task_tags _task_config _task_modifiers
|
typeset -g _task_cmds _task_projects _task_tags _task_config _task_modifiers
|
||||||
_task_projects=($(task _projects))
|
_task_projects=($(task _projects))
|
||||||
_task_tags=($(task _tags))
|
_task_tags=($(task _tags))
|
||||||
_task_ids=($(task _ids))
|
_task_ids=($(task _ids))
|
||||||
_task_config=($(task _config))
|
_task_config=($(task _config))
|
||||||
|
_task_columns=($(task _columns))
|
||||||
_task_modifiers=(
|
_task_modifiers=(
|
||||||
'before' \
|
'before' \
|
||||||
'after' \
|
'after' \
|
||||||
|
|
@ -46,39 +46,19 @@ _task_modifiers=(
|
||||||
'word' \
|
'word' \
|
||||||
'noword'
|
'noword'
|
||||||
)
|
)
|
||||||
|
_task_conjunctions=(
|
||||||
|
'and' \
|
||||||
|
'or' \
|
||||||
|
'xor' \
|
||||||
|
'\)'
|
||||||
|
'\('
|
||||||
|
)
|
||||||
_task_cmds=($(task _commands))
|
_task_cmds=($(task _commands))
|
||||||
_task_zshcmds=( ${(f)"$(task _zshcommands)"} )
|
_task_zshcmds=( ${(f)"$(task _zshcommands)"} )
|
||||||
|
|
||||||
|
|
||||||
_task_idCmds=(
|
|
||||||
'append' \
|
|
||||||
'prepend' \
|
|
||||||
'annotate' \
|
|
||||||
'denotate' \
|
|
||||||
'edit' \
|
|
||||||
'duplicate' \
|
|
||||||
'info' \
|
|
||||||
'start' \
|
|
||||||
'stop' \
|
|
||||||
'done'
|
|
||||||
)
|
|
||||||
|
|
||||||
_task_idCmdsDesc=(
|
|
||||||
'append:Appends more description to an existing task.' \
|
|
||||||
'prepend:Prepends more description to an existing task.' \
|
|
||||||
'annotate:Adds an annotation to an existing task.' \
|
|
||||||
'denotate:Deletes an annotation of an existing task.' \
|
|
||||||
'edit:Launches an editor to let you modify a task directly.' \
|
|
||||||
'duplicate:Duplicates the specified task, and allows modifications.' \
|
|
||||||
'info:Shows all data, metadata for specified task.' \
|
|
||||||
'start:Marks specified task as started.' \
|
|
||||||
'stop:Removes the start time from a task.' \
|
|
||||||
'done:Marks the specified task as completed.'
|
|
||||||
)
|
|
||||||
|
|
||||||
_task() {
|
_task() {
|
||||||
_arguments -s -S \
|
_arguments -s -S \
|
||||||
"*::task command:_task_commands"
|
"*::task default:_task_default"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -148,6 +128,7 @@ _regex_words values 'task frequencies' \
|
||||||
'weekly:Every week' \
|
'weekly:Every week' \
|
||||||
'biweekly:Every two weeks' \
|
'biweekly:Every two weeks' \
|
||||||
'fortnight:Every two weeks' \
|
'fortnight:Every two weeks' \
|
||||||
|
+ 'monthly:Every month' \
|
||||||
'quarterly:Every three months' \
|
'quarterly:Every three months' \
|
||||||
'semiannual:Every six months' \
|
'semiannual:Every six months' \
|
||||||
'annual:Every year' \
|
'annual:Every year' \
|
||||||
|
|
@ -196,22 +177,13 @@ _regex_arguments _task_attributes "${args[@]}"
|
||||||
|
|
||||||
## task commands
|
## task commands
|
||||||
|
|
||||||
# default completion
|
# filter completion
|
||||||
(( $+functions[_task_default] )) ||
|
(( $+functions[_task_filter] )) ||
|
||||||
_task_default() {
|
_task_filter() {
|
||||||
_task_attributes "$@"
|
_task_attributes "$@"
|
||||||
}
|
|
||||||
|
|
||||||
# commands expecting an ID
|
# TODO complete conjunctions only if the previous word is a filter expression, i.e. attribute, ID, any non-command
|
||||||
(( $+functions[_task_id] )) ||
|
_describe -t default 'task conjunctions' _task_conjunctions
|
||||||
_task_id() {
|
|
||||||
if (( CURRENT < 3 )); then
|
|
||||||
# update IDs
|
|
||||||
_task_zshids=( ${(f)"$(task _zshids)"} )
|
|
||||||
_describe -t values 'task IDs' _task_zshids
|
|
||||||
else
|
|
||||||
_task_attributes "$@"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# merge completion
|
# merge completion
|
||||||
|
|
@ -235,46 +207,42 @@ _task_pull() {
|
||||||
_files
|
_files
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# execute completion
|
||||||
|
(( $+functions[_task_execute] )) ||
|
||||||
|
_task_execute() {
|
||||||
|
_files
|
||||||
|
}
|
||||||
|
|
||||||
# modify (task [0-9]* ...) completion
|
# id-only completion
|
||||||
(( $+functions[_task_modify] )) ||
|
(( $+functions[_task_id] )) ||
|
||||||
_task_modify() {
|
_task_id() {
|
||||||
_describe -t commands 'task command' _task_idCmdsDesc
|
_describe -t values 'task IDs' _task_zshids
|
||||||
_task_attributes "$@"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
## first level completion => task sub-command completion
|
## first level completion => task sub-command completion
|
||||||
(( $+functions[_task_commands] )) ||
|
(( $+functions[_task_default] )) ||
|
||||||
_task_commands() {
|
_task_default() {
|
||||||
local cmd ret=1
|
local cmd ret=1
|
||||||
if (( CURRENT == 1 )); then
|
|
||||||
# update IDs
|
|
||||||
_task_zshids=( ${(f)"$(task _zshids)"} )
|
|
||||||
|
|
||||||
_describe -t commands 'task command' _task_zshcmds
|
integer i=1
|
||||||
_describe -t values 'task IDs' _task_zshids
|
while (( i < $#words ))
|
||||||
# TODO match more than one ID
|
do
|
||||||
elif [[ $words[1] =~ ^[0-9]*$ ]] then
|
cmd="${_task_cmds[(r)$words[$i]]}"
|
||||||
_call_function ret _task_modify
|
if (( $#cmd )); then
|
||||||
return ret
|
_call_function ret _task_${cmd} ||
|
||||||
else
|
_call_function ret _task_filter ||
|
||||||
# local curcontext="${curcontext}"
|
_message "No command remaining."
|
||||||
# cmd="${_task_cmds[(r)$words[1]:*]%%:*}"
|
return ret
|
||||||
cmd="${_task_cmds[(r)$words[1]]}"
|
fi
|
||||||
idCmd="${(M)_task_idCmds[@]:#$words[1]}"
|
(( i++ ))
|
||||||
if (( $#cmd )); then
|
done
|
||||||
# curcontext="${curcontext%:*:*}:task-${cmd}"
|
|
||||||
|
|
||||||
if (( $#idCmd )); then
|
# update IDs
|
||||||
_call_function ret _task_id
|
_task_zshids=( ${(f)"$(task _zshids)"} )
|
||||||
else
|
|
||||||
_call_function ret _task_${cmd} ||
|
_describe -t commands 'task command' _task_zshcmds
|
||||||
_call_function ret _task_default ||
|
_describe -t values 'task IDs' _task_zshids
|
||||||
_message "No command remaining."
|
_call_function ret _task_filter
|
||||||
fi
|
|
||||||
else
|
return ret
|
||||||
_message "Unknown subcommand ${cmd}"
|
|
||||||
fi
|
|
||||||
return ret
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
alias et='mate .'
|
alias et='mate .'
|
||||||
alias ett='mate app config lib db public spec test Rakefile Capfile Todo'
|
alias ett='mate Gemfile app config features lib db public spec test Rakefile Capfile Todo'
|
||||||
alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo'
|
alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo'
|
||||||
alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo'
|
alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,14 @@
|
||||||
alias ys="yum search" # search package
|
alias ys="yum search" # search package
|
||||||
alias yp="yum info" # show package info
|
alias yp="yum info" # show package info
|
||||||
alias yl="yum list" # list packages
|
alias yl="yum list" # list packages
|
||||||
|
alias ygl="yum grouplist" # list package groups
|
||||||
alias yli="yum list installed" # print all installed packages
|
alias yli="yum list installed" # print all installed packages
|
||||||
|
alias ymc="yum makecache" # rebuilds the yum package list
|
||||||
|
|
||||||
alias yu="sudo yum update" # upgrate packages
|
alias yu="sudo yum update" # upgrate packages
|
||||||
alias yi="sudo yum install" # install package
|
alias yi="sudo yum install" # install package
|
||||||
|
alias ygi="sudo yum groupinstall" # install package group
|
||||||
alias yr="sudo yum remove" # remove package
|
alias yr="sudo yum remove" # remove package
|
||||||
|
alias ygr="sudo yum groupremove" # remove pagage group
|
||||||
alias yrl="sudo yum remove --remove-leaves" # remove package and leaves
|
alias yrl="sudo yum remove --remove-leaves" # remove package and leaves
|
||||||
alias yc="sudo yum clean all" # clean cache
|
alias yc="sudo yum clean all" # clean cache
|
||||||
|
|
@ -7,6 +7,10 @@ ZSH=$HOME/.oh-my-zsh
|
||||||
# time that oh-my-zsh is loaded.
|
# time that oh-my-zsh is loaded.
|
||||||
ZSH_THEME="robbyrussell"
|
ZSH_THEME="robbyrussell"
|
||||||
|
|
||||||
|
# Example aliases
|
||||||
|
# alias zshconfig="mate ~/.zshrc"
|
||||||
|
# alias ohmyzsh="mate ~/.oh-my-zsh"
|
||||||
|
|
||||||
# Set to this to use case-sensitive completion
|
# Set to this to use case-sensitive completion
|
||||||
# CASE_SENSITIVE="true"
|
# CASE_SENSITIVE="true"
|
||||||
|
|
||||||
|
|
@ -23,6 +27,7 @@ ZSH_THEME="robbyrussell"
|
||||||
# COMPLETION_WAITING_DOTS="true"
|
# COMPLETION_WAITING_DOTS="true"
|
||||||
|
|
||||||
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
|
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
|
||||||
|
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
|
||||||
# Example format: plugins=(rails git textmate ruby lighthouse)
|
# Example format: plugins=(rails git textmate ruby lighthouse)
|
||||||
plugins=(git)
|
plugins=(git)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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}
|
||||||
|
|
|
||||||
|
|
@ -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]
|
||||||
DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}"
|
if which rvm-prompt &> /dev/null; then
|
||||||
|
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]%}["
|
||||||
|
|
|
||||||
|
|
@ -14,6 +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
|
||||||
|
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 '
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,19 @@
|
||||||
function precmd {
|
function theme_precmd {
|
||||||
local TERMWIDTH
|
local TERMWIDTH
|
||||||
(( TERMWIDTH = ${COLUMNS} - 1 ))
|
(( TERMWIDTH = ${COLUMNS} - 1 ))
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
# Truncate the path if it's too long.
|
# Truncate the path if it's too long.
|
||||||
|
|
||||||
PR_FILLBAR=""
|
PR_FILLBAR=""
|
||||||
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=${#${(%):-%~}}
|
||||||
|
|
||||||
if [[ "$promptsize + $rubypromptsize + $pwdsize" -gt $TERMWIDTH ]]; then
|
if [[ "$promptsize + $rubypromptsize + $pwdsize" -gt $TERMWIDTH ]]; then
|
||||||
((PR_PWDLEN=$TERMWIDTH - $promptsize))
|
((PR_PWDLEN=$TERMWIDTH - $promptsize))
|
||||||
else
|
else
|
||||||
|
|
@ -24,7 +24,7 @@ function precmd {
|
||||||
|
|
||||||
|
|
||||||
setopt extended_glob
|
setopt extended_glob
|
||||||
preexec () {
|
theme_preexec () {
|
||||||
if [[ "$TERM" == "screen" ]]; then
|
if [[ "$TERM" == "screen" ]]; then
|
||||||
local CMD=${1[(wr)^(*=*|sudo|-*)]}
|
local CMD=${1[(wr)^(*=*|sudo|-*)]}
|
||||||
echo -n "\ek$CMD\e\\"
|
echo -n "\ek$CMD\e\\"
|
||||||
|
|
@ -69,7 +69,7 @@ setprompt () {
|
||||||
|
|
||||||
###
|
###
|
||||||
# See if we can use extended characters to look nicer.
|
# See if we can use extended characters to look nicer.
|
||||||
|
|
||||||
typeset -A altchar
|
typeset -A altchar
|
||||||
set -A altchar ${(s..)terminfo[acsc]}
|
set -A altchar ${(s..)terminfo[acsc]}
|
||||||
PR_SET_CHARSET="%{$terminfo[enacs]%}"
|
PR_SET_CHARSET="%{$terminfo[enacs]%}"
|
||||||
|
|
@ -81,10 +81,10 @@ setprompt () {
|
||||||
PR_LRCORNER=${altchar[j]:--}
|
PR_LRCORNER=${altchar[j]:--}
|
||||||
PR_URCORNER=${altchar[k]:--}
|
PR_URCORNER=${altchar[k]:--}
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
# Decide if we need to set titlebar text.
|
# Decide if we need to set titlebar text.
|
||||||
|
|
||||||
case $TERM in
|
case $TERM in
|
||||||
xterm*)
|
xterm*)
|
||||||
PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}'
|
PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}'
|
||||||
|
|
@ -96,8 +96,8 @@ setprompt () {
|
||||||
PR_TITLEBAR=''
|
PR_TITLEBAR=''
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
# Decide whether to set a screen title
|
# Decide whether to set a screen title
|
||||||
if [[ "$TERM" == "screen" ]]; then
|
if [[ "$TERM" == "screen" ]]; then
|
||||||
|
|
@ -105,15 +105,15 @@ setprompt () {
|
||||||
else
|
else
|
||||||
PR_STITLE=''
|
PR_STITLE=''
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
# Finally, the prompt.
|
# Finally, the prompt.
|
||||||
|
|
||||||
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\
|
||||||
|
|
||||||
|
|
@ -135,3 +135,7 @@ $PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT$PR_NO_COLOUR '
|
||||||
}
|
}
|
||||||
|
|
||||||
setprompt
|
setprompt
|
||||||
|
|
||||||
|
autoload -U add-zsh-hook
|
||||||
|
add-zsh-hook precmd theme_precmd
|
||||||
|
add-zsh-hook preexec theme_preexec
|
||||||
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ zstyle ':vcs_info:*' unstagedstr '%F{yellow}●'
|
||||||
zstyle ':vcs_info:*' check-for-changes true
|
zstyle ':vcs_info:*' check-for-changes true
|
||||||
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r'
|
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r'
|
||||||
zstyle ':vcs_info:*' enable git svn
|
zstyle ':vcs_info:*' enable git svn
|
||||||
precmd () {
|
theme_precmd () {
|
||||||
if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] {
|
if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] {
|
||||||
zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{green}]'
|
zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{green}]'
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -19,3 +19,6 @@ precmd () {
|
||||||
|
|
||||||
setopt prompt_subst
|
setopt prompt_subst
|
||||||
PROMPT='%B%F{magenta}%c%B%F{green}${vcs_info_msg_0_}%B%F{magenta} %{$reset_color%}%% '
|
PROMPT='%B%F{magenta}%c%B%F{green}${vcs_info_msg_0_}%B%F{magenta} %{$reset_color%}%% '
|
||||||
|
|
||||||
|
autoload -U add-zsh-hook
|
||||||
|
add-zsh-hook precmd theme_precmd
|
||||||
|
|
|
||||||
|
|
@ -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%})"
|
||||||
|
|
||||||
PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b '
|
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 '
|
||||||
|
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%})"
|
||||||
|
|
||||||
PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b '
|
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 '
|
||||||
|
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]%}rbenv:(%{$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)
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ add-zsh-hook chpwd steeef_chpwd
|
||||||
function steeef_precmd {
|
function steeef_precmd {
|
||||||
if [[ -n "$PR_GIT_UPDATE" ]] ; then
|
if [[ -n "$PR_GIT_UPDATE" ]] ; then
|
||||||
# check for untracked files or updated submodules, since vcs_info doesn't
|
# check for untracked files or updated submodules, since vcs_info doesn't
|
||||||
if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
|
if git ls-files --other --exclude-standard --directory 2> /dev/null | grep -q "."; then
|
||||||
PR_GIT_UPDATE=1
|
PR_GIT_UPDATE=1
|
||||||
FMT_BRANCH="(%{$turquoise%}%b%u%c%{$hotpink%}●${PR_RST})"
|
FMT_BRANCH="(%{$turquoise%}%b%u%c%{$hotpink%}●${PR_RST})"
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -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]
|
||||||
JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}"
|
if which rvm-prompt &> /dev/null; then
|
||||||
|
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
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ PROMPT='%{$fg[green]%} %% '
|
||||||
# RPS1='%{$fg[blue]%}%~%{$reset_color%} '
|
# RPS1='%{$fg[blue]%}%~%{$reset_color%} '
|
||||||
RPS1='%{$fg[white]%}%2~$(git_prompt_info) %{$fg_bold[blue]%}%m%{$reset_color%}'
|
RPS1='%{$fg[white]%}%2~$(git_prompt_info) %{$fg_bold[blue]%}%m%{$reset_color%}'
|
||||||
|
|
||||||
ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[yellow]%}"
|
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[yellow]%}("
|
||||||
ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}"
|
ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}"
|
||||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%} ⚡%{$fg[yellow]%}"
|
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%} ⚡%{$fg[yellow]%}"
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,12 @@ function _update_zsh_update() {
|
||||||
echo "LAST_EPOCH=$(_current_epoch)" > ~/.zsh-update
|
echo "LAST_EPOCH=$(_current_epoch)" > ~/.zsh-update
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _upgrade_zsh() {
|
||||||
|
/usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh
|
||||||
|
# update the zsh file
|
||||||
|
_update_zsh_update
|
||||||
|
}
|
||||||
|
|
||||||
if [ -f ~/.zsh-update ]
|
if [ -f ~/.zsh-update ]
|
||||||
then
|
then
|
||||||
. ~/.zsh-update
|
. ~/.zsh-update
|
||||||
|
|
@ -17,19 +23,24 @@ 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
|
||||||
echo "[Oh My Zsh] Would you like to check for updates?"
|
if [ "$DISABLE_UPDATE_PROMPT" = "true" ]
|
||||||
echo "Type Y to update oh-my-zsh: \c"
|
|
||||||
read line
|
|
||||||
if [ "$line" = Y ] || [ "$line" = y ]
|
|
||||||
then
|
then
|
||||||
/bin/sh $ZSH/tools/upgrade.sh
|
_upgrade_zsh
|
||||||
# update the zsh file
|
else
|
||||||
_update_zsh_update
|
echo "[Oh My Zsh] Would you like to check for updates?"
|
||||||
|
echo "Type Y to update oh-my-zsh: \c"
|
||||||
|
read line
|
||||||
|
if [ "$line" = Y ] || [ "$line" = y ]; then
|
||||||
|
_upgrade_zsh
|
||||||
|
else
|
||||||
|
_update_zsh_update
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# create the zsh file
|
# create the zsh file
|
||||||
_update_zsh_update
|
_update_zsh_update
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,10 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "\033[0;34mCloning Oh My Zsh...\033[0m"
|
echo "\033[0;34mCloning Oh My Zsh...\033[0m"
|
||||||
/usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
|
hash git >/dev/null && /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh || {
|
||||||
|
echo "git not installed"
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
echo "\033[0;34mLooking for an existing zsh config...\033[0m"
|
echo "\033[0;34mLooking for an existing zsh config...\033[0m"
|
||||||
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]
|
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,19 @@
|
||||||
current_path=`pwd`
|
current_path=`pwd`
|
||||||
echo -e "\033[0;34mUpgrading Oh My Zsh\033[0m"
|
printf '\033[0;34m%s\033[0m\n' "Upgrading Oh My Zsh"
|
||||||
( cd $ZSH && git pull origin master )
|
cd $ZSH
|
||||||
echo -e "\033[0;32m"' __ __ '"\033[0m"
|
|
||||||
echo -e "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m"
|
if git pull origin master
|
||||||
echo -e "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m"
|
then
|
||||||
echo -e "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m"
|
printf '\033[0;32m%s\033[0m\n' ' __ __ '
|
||||||
echo -e "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m"
|
printf '\033[0;32m%s\033[0m\n' ' ____ / /_ ____ ___ __ __ ____ _____/ /_ '
|
||||||
echo -e "\033[0;32m"' /____/ '"\033[0m"
|
printf '\033[0;32m%s\033[0m\n' ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '
|
||||||
echo -e "\033[0;34mHooray! Oh My Zsh has been updated and/or is at the current version.\033[0m"
|
printf '\033[0;32m%s\033[0m\n' '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '
|
||||||
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"
|
printf '\033[0;32m%s\033[0m\n' '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '
|
||||||
cd "$current_path"
|
printf '\033[0;32m%s\033[0m\n' ' /____/ '
|
||||||
|
printf '\033[0;34m%s\033[0m\n' 'Hooray! Oh My Zsh has been updated and/or is at the current version.'
|
||||||
|
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'
|
||||||
|
else
|
||||||
|
printf '\033[0;31m%s\033[0m\n' 'There was an error updating. Try again later?'
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "$current_path"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue