Commit d70e7329 authored by Bob Williams's avatar Bob Williams
Browse files

Merge remote-tracking branch 'upstream/master'

parents 5a586670 178b5224
locals.zsh
log/.zsh_history
projects.zsh
custom/*
!custom/example
custom
!custom/plugins/example
!custom/example.zsh
*.swp
!custom/example.zshcache
......
......@@ -59,7 +59,7 @@ If you installed manually or changed the install location, check ZSH in ~/.zshrc
h2. Usage
* enable the plugins you want in your @~/.zshrc@ (take a look at @plugins/@ to see what's possible)
* enable the plugins you want in your @~/.zshrc@ (take a look at the @plugins/@ directory and the "wiki":https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins to see what's possible)
** example: @plugins=(git osx ruby)@
* Theme support: Change the @ZSH_THEME@ environment variable in @~/.zshrc@.
** Take a look at the "current themes":https://wiki.github.com/robbyrussell/oh-my-zsh/themes that come bundled with _Oh My Zsh_.
......
......@@ -2,5 +2,11 @@
# Color grep results
# Examples: http://rubyurl.com/ZXv
#
export GREP_OPTIONS='--color=auto'
# avoid VCS folders
GREP_OPTIONS=
for PATTERN in .cvs .git .hg .svn; do
GREP_OPTIONS+="--exclude-dir=$PATTERN "
done
export GREP_OPTIONS+='--color=auto '
export GREP_COLOR='1;32'
\ No newline at end of file
......@@ -5,7 +5,6 @@ fi
HISTSIZE=10000
SAVEHIST=10000
setopt append_history
setopt extended_history
setopt hist_expire_dups_first
setopt hist_ignore_dups # ignore duplication command history list
......
......@@ -15,29 +15,49 @@ if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
zle -N zle-line-finish
fi
bindkey -e # Use emacs key bindings
bindkey -e # Use emacs key bindings
bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark
bindkey -s '\el' 'ls\n' # [Esc-l] - run command: ls
bindkey '^r' history-incremental-search-backward # [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line.
bindkey "${terminfo[kpp]}" up-line-or-history # [PageUp] - Up a line of history
bindkey "${terminfo[knp]}" down-line-or-history # [PageDown] - Down a line of history
bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark
bindkey -s '\el' 'ls\n' # [Esc-l] - run command: ls
bindkey '^r' history-incremental-search-backward # [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line.
if [[ "${terminfo[kpp]}" != "" ]]; then
bindkey "${terminfo[kpp]}" up-line-or-history # [PageUp] - Up a line of history
fi
if [[ "${terminfo[knp]}" != "" ]]; then
bindkey "${terminfo[knp]}" down-line-or-history # [PageDown] - Down a line of history
fi
bindkey "${terminfo[kcuu1]}" up-line-or-search # start typing + [Up-Arrow] - fuzzy find history forward
bindkey "${terminfo[kcud1]}" down-line-or-search # start typing + [Down-Arrow] - fuzzy find history backward
if [[ "${terminfo[kcuu1]}" != "" ]]; then
bindkey "${terminfo[kcuu1]}" up-line-or-search # start typing + [Up-Arrow] - fuzzy find history forward
fi
if [[ "${terminfo[kcud1]}" != "" ]]; then
bindkey "${terminfo[kcud1]}" down-line-or-search # start typing + [Down-Arrow] - fuzzy find history backward
fi
bindkey "${terminfo[khome]}" beginning-of-line # [Home] - Go to beginning of line
bindkey "${terminfo[kend]}" end-of-line # [End] - Go to end of line
if [[ "${terminfo[khome]}" != "" ]]; then
bindkey "${terminfo[khome]}" beginning-of-line # [Home] - Go to beginning of line
fi
if [[ "${terminfo[kend]}" != "" ]]; then
bindkey "${terminfo[kend]}" end-of-line # [End] - Go to end of line
fi
bindkey ' ' magic-space # [Space] - do history expansion
bindkey ' ' magic-space # [Space] - do history expansion
bindkey '^[[1;5C' forward-word # [Ctrl-RightArrow] - move forward one word
bindkey '^[[1;5D' backward-word # [Ctrl-LeftArrow] - move backward one word
bindkey '^[[1;5C' forward-word # [Ctrl-RightArrow] - move forward one word
bindkey '^[[1;5D' backward-word # [Ctrl-LeftArrow] - move backward one word
bindkey "${terminfo[kcbt]}" reverse-menu-complete # [Shift-Tab] - move through the completion menu backwards
if [[ "${terminfo[kdch1]}" != "" ]]; then
bindkey "${terminfo[kdch1]}" reverse-menu-complete # [Shift-Tab] - move through the completion menu backwards
fi
bindkey '^?' backward-delete-char # [Backspace] - delete backward
bindkey "${terminfo[kdch1]}" delete-char # [Delete] - delete forward
bindkey '^?' backward-delete-char # [Backspace] - delete backward
if [[ "${terminfo[kdch1]}" != "" ]]; then
bindkey "${terminfo[kdch1]}" delete-char # [Delete] - delete forward
else
bindkey "^[[3~" delete-char
bindkey "^[3;5~" delete-char
bindkey "\e[3~" delete-char
fi
# Edit the current command line in $EDITOR
autoload -U edit-command-line
......
#
# Your guess is as good as mine. Let's just assume that we will need this...
# - For more info visit... http://atom.io/
#
\ No newline at end of file
local _atom_paths > /dev/null 2>&1
_atom_paths=(
"$HOME/Applications/Atom.app"
"/Applications/Atom.app"
)
for _atom_path in $_atom_paths; do
if [[ -a $_atom_path ]]; then
alias at="open -a '$_atom_path'"
break
fi
done
alias att='at .'
......@@ -21,7 +21,7 @@ if [[ $(uname) == "Darwin" ]] ; then
function plugged_in() {
[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ Yes') -eq 1 ]
}
function battery_pct_remaining() {
if plugged_in ; then
echo "External Power"
......@@ -31,7 +31,7 @@ if [[ $(uname) == "Darwin" ]] ; then
}
function battery_time_remaining() {
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
if [[ $(echo $smart_battery_status | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
timeremaining=$(echo $smart_battery_status | grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //')
if [ $timeremaining -gt 720 ] ; then
......@@ -59,9 +59,9 @@ if [[ $(uname) == "Darwin" ]] ; then
echo "∞"
fi
}
function battery_is_charging() {
[[ $(ioreg -rc "AppleSmartBattery"| grep '^.*"IsCharging"\ =\ ' | sed -e 's/^.*"IsCharging"\ =\ //') == "Yes" ]]
[[ $(ioreg -rc "AppleSmartBattery"| grep '^.*"IsCharging"\ =\ ' | sed -e 's/^.*"IsCharging"\ =\ //') == "Yes" ]]
}
elif [[ $(uname) == "Linux" ]] ; then
......@@ -71,7 +71,9 @@ elif [[ $(uname) == "Linux" ]] ; then
}
function battery_pct() {
echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')"
if (( $+commands[acpi] )) ; then
echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')"
fi
}
function battery_pct_remaining() {
......@@ -103,7 +105,7 @@ elif [[ $(uname) == "Linux" ]] ; then
echo "∞"
fi
}
else
# Empty functions so we don't cause errors in prompts
function battery_pct_remaining() {
......@@ -136,7 +138,7 @@ function battery_level_gauge() {
if [[ $battery_remaining_percentage =~ [0-9]+ ]]; then
local filled=$(((( $battery_remaining_percentage + $gauge_slots - 1) / $gauge_slots)));
local empty=$(($gauge_slots - $filled));
if [[ $filled -gt $green_threshold ]]; then local gauge_color=$color_green;
elif [[ $filled -gt $yellow_threshold ]]; then local gauge_color=$color_yellow;
else local gauge_color=$color_red;
......@@ -144,10 +146,9 @@ function battery_level_gauge() {
else
local filled=$gauge_slots;
local empty=0;
filled_symbol=${BATTERY_UNKNOWN_SYMBOL:-'.'};
filled_symbol=${BATTERY_UNKNOWN_SYMBOL:-'.'};
fi
local charging=' ' && battery_is_charging && charging=$charging_symbol;
printf ${charging_color//\%/\%\%}$charging${color_reset//\%/\%\%}${battery_prefix//\%/\%\%}${gauge_color//\%/\%\%}
......
......@@ -6,7 +6,7 @@ alias bu="bundle update"
# The following is based on https://github.com/gma/bundler-exec
bundled_commands=(annotate berks cap capify cucumber foodcritic foreman guard jekyll kitchen knife mailcatcher middleman nanoc rackup rainbows rake rspec ruby shotgun spec spin spork strainer tailor taps thin thor unicorn unicorn_rails puma)
bundled_commands=(annotate berks cap capify cucumber foodcritic foreman guard irb jekyll kitchen knife mailcatcher middleman nanoc puma rackup rainbows rake rspec ruby shotgun spec spin spork strainer tailor taps thin thor unicorn unicorn_rails)
# Remove $UNBUNDLED_COMMANDS from the bundled_commands list
for cmd in $UNBUNDLED_COMMANDS; do
......
......@@ -71,7 +71,7 @@ if [ ${ZSH_VERSION//\./} -ge 420 ]; then
_image_fts=(jpg jpeg png gif mng tiff tif xpm)
for ft in $_image_fts ; do alias -s $ft=$XIVIEWER; done
_media_fts=(avi mpg mpeg ogm mp3 wav ogg ape rm mov mkv)
_media_fts=(ape avi flv mkv mov mp3 mpeg mpg ogg ogm rm wav webm)
for ft in $_media_fts ; do alias -s $ft=mplayer ; done
#read documents
......
#!/bin/zsh
#
# Make the dirstack more persistant
#
# Add dirpersist to $plugins in ~/.zshrc to load
#
# Save dirstack history to .zdirs
# adapted from:
# github.com/grml/grml-etc-core/blob/master/etc/zsh/zshrc#L1547
# $zdirstore is the file used to persist the stack
zdirstore=~/.zdirstore
DIRSTACKSIZE=${DIRSTACKSIZE:-20}
dirstack_file=${dirstack_file:-${HOME}/.zdirs}
dirpersistinstall () {
if grep 'dirpersiststore' ~/.zlogout > /dev/null; then
else
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 $ZSH/plugins/dirspersist.plugin.zsh\ndirpersiststore" >> ~/.zlogout
else
echo "If you don't want this message to appear, remove dirspersist from \$plugins"
fi
fi
}
dirpersiststore () {
dirs -p | perl -e 'foreach (reverse <STDIN>) {chomp;s/([& ])/\\$1/g ;print "if [ -d $_ ]; then pushd -q $_; fi\n"}' > $zdirstore
}
if [[ -f ${dirstack_file} ]] && [[ ${#dirstack[*]} -eq 0 ]] ; then
dirstack=( ${(f)"$(< $dirstack_file)"} )
# "cd -" won't work after login by just setting $OLDPWD, so
[[ -d $dirstack[1] ]] && cd $dirstack[1] && cd $OLDPWD
fi
dirpersistrestore () {
if [ -f $zdirstore ]; then
source $zdirstore
fi
chpwd() {
if (( $DIRSTACKSIZE <= 0 )) || [[ -z $dirstack_file ]]; then return; fi
local -ax my_stack
my_stack=( ${PWD} ${dirstack} )
builtin print -l ${(u)my_stack} >! ${dirstack_file}
}
DIRSTACKSIZE=10
setopt autopushd pushdminus pushdsilent pushdtohome pushdignoredups
dirpersistinstall
dirpersistrestore
# Make popd changes permanent without having to wait for logout
alias popd="popd;dirpersiststore"
......@@ -13,6 +13,7 @@ case $state in
cmds=(
"version:Prints Gas's version"
"use:Uses author"
"ssh:Creates a new ssh key for an existing gas author"
"show:Shows your current user"
"list:Lists your authors"
"import:Imports current user to gasconfig"
......@@ -25,8 +26,12 @@ case $state in
args)
case $line[1] in
(use|delete)
_values -S , 'authors' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0
;;
VERSION=$(gas -v)
if [[ $VERSION == <1->.*.* ]] || [[ $VERSION == 0.<2->.* ]] || [[ $VERSION == 0.1.<6-> ]] then
_values -S , 'authors' $(cat ~/.gas/gas.authors | sed -n -e 's/^.*\[\(.*\)\]/\1/p') && ret=0
else
_values -S , 'authors' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0
fi
esac
;;
esac
......
......@@ -56,6 +56,9 @@ if (( CURRENT == 1 )); then
fi
case "$words[1]" in
build)
_files -g "*.gemspec"
;;
list)
if [[ "$state" == forms ]]; then
_gem_installed
......
......@@ -149,7 +149,7 @@ function work_in_progress() {
fi
}
# these alias commit and uncomit wip branches
alias gwip='git add -A; git ls-files --deleted -z | xargs -0 git rm; git commit -m "--wip--"'
alias gwip='git add -A; git ls-files --deleted -z | xargs -r0 git rm; git commit -m "--wip--"'
alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1'
# these alias ignore changes to file
......
This diff is collapsed.
# if there is a user named 'glassfish' on the system, we'll assume
# that is the user asadmin should be run as
# grep -e '^glassfish' /etc/passwd > /dev/null && alias asadmin='sudo -u glassfish asadmin'
\ No newline at end of file
......@@ -31,7 +31,7 @@ _knife() {
case $state in
knifecmd)
compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" diff exec environment index node recipe role search ssh status upload windows $cloudproviders
compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" diff exec environment index node recipe role search ssh status upload vault windows $cloudproviders
;;
knifesubcmd)
case $words[2] in
......@@ -65,6 +65,9 @@ _knife() {
upload)
_arguments '*:file or directory:_files -g "*"'
;;
vault)
compadd -Q "$@" create decrypt delete edit remove "rotate all keys" "rotate keys" show update
;;
windows)
compadd "$@" bootstrap
;;
......
# Laravel4 basic command completion
_laravel4_get_command_list () {
php artisan --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }'
}
_laravel4 () {
if [ -f artisan ]; then
compadd `_laravel4_get_command_list`
fi
}
compdef _laravel4 artisan
compdef _laravel4 la4
#Alias
alias la4='php artisan'
alias la4dump='php artisan dump-autoload'
alias la4cache='php artisan cache:clear'
alias la4routes='php artisan routes'
......@@ -59,6 +59,7 @@ case "$words[1]" in
_arguments \
'(-U --upgrade)'{-U,--upgrade}'[upgrade all packages to the newest available version]' \
'(-f --find-links)'{-f,--find-links}'[URL for finding packages]' \
'(-r --requirement)'{-r,--requirement}'[Requirements file for packages to install]:File:_files' \
'(--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]' \
......
......@@ -8,18 +8,18 @@
# 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
# 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
# Will Detect if a app does not exist in pow and print a (slightly) helpful
# error message
rack_root_detect(){
rack_root(){
setopt chaselinks
local orgdir=$(pwd)
local basedir=$(pwd)
......@@ -32,6 +32,11 @@ rack_root_detect(){
builtin cd $orgdir 2>/dev/null
[[ ${basedir} == "/" ]] && return 1
echo $basedir
}
rack_root_detect(){
basedir=$(rack_root)
echo `basename $basedir | sed -E "s/.(com|net|org)//"`
}
......@@ -51,16 +56,30 @@ kapow(){
compctl -W ~/.pow -/ kapow
powit(){
local basedir=$(pwd)
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
then
echo "pow: Symlinking your app with pow. ${vhost}"
[ ! -d ~/.pow/${vhost} ] && ln -s $basedir ~/.pow/$vhost
return 1
fi
}
powed(){
local basedir=$(rack_root)
find ~/.pow/ -type l -lname "*$basedir*" -exec basename {}'.dev' \;
}
# Restart pow process
# taken from http://www.matthewratzloff.com/blog/2011/12/23/restarting-pow-when-dns-stops-responding
repow(){
lsof | grep 20560 | awk '{print $2}' | xargs kill -9
launchctl unload ~/Library/LaunchAgents/cx.pow.powd.plist
launchctl load ~/Library/LaunchAgents/cx.pow.powd.plist
echo "restarted pow"
}
# View the standard out (puts) from any pow app
alias kaput="tail -f ~/Library/Logs/Pow/apps/*"
alias kaput="tail -f ~/Library/Logs/Pow/apps/*"
\ No newline at end of file
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