updated AAALL the configs

wayland
Norman Köhring 9 years ago
parent ccdabc366a
commit 2cd0786fb6

@ -5,11 +5,18 @@
! and others
! general settings:
Xft.antialias: true
Xft.antialias: 0
Xft.autohint: 0
Xft.lcdfilter: lcddefault
Xft.hintstyle: hintfull
Xft.hinting: 1
Xft.rgba: rgb
Xft.dpi: 96
! colors:
! color settings... since I want the same ones for xterm I decided to remove every "urxvt"
*foreground: #cccccc
*background: #191919
*font: xft:monofur-24
! Black + Dark Grey
! was #222222 and/or #333333
!*color0: [90]#191919
@ -80,76 +87,7 @@ urxvt.urlLauncher: /usr/bin/vimprobable2
urxvt.scrollstyle: plain
urxvt.scrollBar: false
URxvt.font: xft:monofur:pixelsize=16:,xft:AR PL UMing CN:pixelsize=12,xft:Arial Unicode MS:pixelsize=12,xft:Dejavu Sans:pixelsize=12:
!URxvt*font: -*-pixelcarnage monospace-*-*-*-*-*-*-*-*-*-*-*-*
!Rxvt*font: xft:Bitstream Vera Sans Mono:pixelsize=11
!Rxvt*font: -*-optismall-*-*-*-*-*-*-*-*-*-*-*-*
!URxvt*font: -artwiz-cure.de-*-*-*-*-*-*-*-*-*-*-*-*
!URxvt*font: 7x13
!URxvt.font: xft:inconsolata-g:pixelsize=12,xft:AR PL UMing CN:pixelsize=10
!URxvt*font: -*-pixelcarnage monospace-*-*-*-*-*-*-*-*-*-*-*-*
!URxvt.font: xft:Dejavu Sans Mono:pixelsize=12,xft:AR PL UMing CN:pixelsize=10,xft:Arial Unicode MS:pixelsize=12,xft:Dejavu Sans:pixelsize=12:
!urxvt.font: -*-proggytiny-*-*-*-*-*-*-*-*-*-*-*-*
URxvt*matcher.button: 3
!URxvt.keysym.C-minus: command:\033]50;xft:Monospace:size=10:antialias=true\007
URxvt.keysym.C-minus: perl:mark-yank-urls:activate_mark_mode
xosview*captions: True
xosview*font: -*-lucida-*-r-*-*-8-*-*-*-*-*-*-*
xosview*cpu: True
xosview*mem: True
xosview*net: True
xosview*disk: True
xosview*load: True
xosview*swap: True
xosview*page: True
xosview*gfx: True
xosview*NFSStats: False
xosview*NFSDStats: False
xosview*serial(0-9): True
xosview*interrupts: False
xosview*lmstemp: False
xosview*battery: True
xosview*RAID: False
xosview*foreground: #282828
xosview*background: #000000
xosview*borderwidth: 0
xosview*usedlabels: False
xosview*labels: True
xosview*meterLabelColor: #888888
xosview*usedLabelColor: #ffffff
xosview*memUsedFormat: autoscale
xosview*memUsedColor: #a9cc92
xosview*memFreeColor: #383838
xosview*memBufferColor: #181818
xosview*memCacheColor: #181818
xosview*swapUsedFormat: autoscale
xosview*swapUsedColor: #a9cc92
xosview*swapFreeColor: #383838
xosview*cpuUserColor: #a9cc92
xosview*cpuFreeColor: #383838
xosview*cpuNiceColor: #889955
xosview*cpuSystemColor: #889955
xosview*cpuInterruptColor: #ff0000
xosview*netIface: wlan0
xosview*netInColor: #a9cc92
xosview*netOutColor: #bb0000
xosview*netBackground: #383838
xosview*diskUsedColor: #a9cc92
xosview*diskWriteColor: #bb0000
xosview*diskReadColor: #00bb00
xosview*diskIdleColor: #383838
xosview*pageIdleColor: #383838
xosview*batteryUsedColor: #383838

@ -1,30 +0,0 @@
use_xft yes
xftfont 123:size=8
xftalpha 0.1
update_interval 2
total_run_times 0
own_window no
double_buffer yes
maximum_width 600
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color white
color1 FFA300
default_shade_color red
default_outline_color green
alignment bottom_right
gap_x 0
gap_y 100
no_buffers yes
uppercase no
cpu_avg_samples 2
net_avg_samples 1
override_utf8_locale yes
use_spacer right
TEXT
${voffset 20}${color EAEAEA}${font Philosopher:pixelsize=120}${time %H:%M}${font}${voffset -77}${offset 10}${color1}${font Philosopher:pixelsize=42}${time %d} ${voffset -15}${color EAEAEA}${font Philosopher:pixelsize=22}${time %B} ${time %Y}${font}${voffset 27}${font Philosopher:pixelsize=58}${offset -173}${time %A}${font}
${voffset 3}${offset 10}${font Ubuntu:pixelsize=13}${color1}ROOT $color${fs_used_perc /}%${offset 12}${color1}HOME $color${fs_used_perc /home}%${offset 12}${color1}RAM $color$memperc%${offset 12}${color1}LOAD $color${loadavg 1} ${offset 12}${color1}TMP $color${acpitemp}°C

@ -0,0 +1,34 @@
call plug#begin('~/.nvim/plugged')
Plug 'kchmck/vim-coffee-script'
Plug 'tpope/vim-haml'
Plug 'tpope/vim-speeddating'
Plug 'kien/ctrlp.vim'
Plug 'spolu/dwm.vim'
Plug 'mileszs/ack.vim'
Plug 'sunaku/xoria256.vim'
Plug 'mattn/emmet-vim'
Plug 'digitaltoad/vim-jade'
Plug 'wavded/vim-stylus'
Plug 'wting/rust.vim'
Plug 'farseer90718/vim-taskwarrior'
call plug#end()
let g:ackprg = 'ag --nogroup --nocolor --column'
colorscheme xoria256
set expandtab
set shiftwidth=4
set tabstop=4
set softtabstop=4
set encoding=utf-8
set textwidth=79
set colorcolumn=80
set scrolloff=5
set laststatus=2
set number
set wildmenu
set wildmode=list:longest,full
"set cryptmethod=blowfish
set t_Co=256

@ -1,21 +0,0 @@
The MIT License
Copyright (c) 2009-2013 Robby Russell and contributors (see https://github.com/robbyrussell/oh-my-zsh/contributors)
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:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 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.

@ -1,89 +0,0 @@
A handful of functions, auto-complete helpers, and stuff that makes you shout...
bq. "OH MY ZSHELL!"
h2. Setup
@oh-my-zsh@ should work with any recent release of "zsh":http://www.zsh.org/, the minimum recommended version is 4.3.9.
h3. The automatic installer... (do you trust me?)
You can install this via the command line with either `curl` or `wget`.
h4. via `curl`
@curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh@
h4. via `wget`
@wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh@
h3. The manual way
1. Clone the repository
@git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh@
2. *OPTIONAL* Backup your existing ~/.zshrc file
@cp ~/.zshrc ~/.zshrc.orig@
3. Create a new zsh config by copying the zsh template we've provided.
@cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc@
4. Set zsh as your default shell:
@chsh -s /bin/zsh@
5. Start / restart zsh (open a new terminal is easy enough...)
h3. Problems?
You _might_ need to modify your PATH in ~/.zshrc if you're not able to find some commands after switching to _Oh My Zsh_.
h2. Usage
* enable the plugins you want in your @~/.zshrc@ (take a look at @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_.
* much much more... take a look at @lib/@ what _Oh My Zsh_ offers...
h2. Useful
the "refcard":http://www.bash2zsh.com/zsh_refcard/refcard.pdf is pretty tasty for tips.
h3. Customization
If you want to override any of the default behavior, just add a new file (ending in @.zsh@) into the @custom/@ directory.
If you have many functions which go well together you can put them as a *.plugin.zsh file in the @custom/plugins/@ directory and then enable this plugin.
If you would like to override the functionality of a plugin distributed with oh-my-zsh, create a plugin of the same name in the @custom/plugins/@ directory and it will be loaded instead of the one in @plugins/@.
h3. Uninstalling
If you want to uninstall it, just run @uninstall_oh_my_zsh@ from the command line and it'll remove itself and revert you to bash (or your previous zsh config).
h2. Help out!
I'm far from being a zsh-expert and suspect there are many ways to improve. If you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests!
h3. (Don't) Send us your theme! (for now)
-I'm hoping to collect a bunch of themes for our command prompts. You can see existing ones in the @themes/@ directory.-
We have enough themes for the time being. Please fork the project and add on in there, you can let people know how to grab it from there.
h2. Contributors
This project wouldn't exist without all of our awesome users and contributors.
* "View our growing list of contributors":https://github.com/robbyrussell/oh-my-zsh/contributors
Thank you so much!

@ -1,5 +0,0 @@
# Add yourself some shortcuts to projects you often work on
# Example:
#
# brainstormr=/Users/robbyrussell/Projects/development/planetargon/brainstormr
#

@ -1,2 +0,0 @@
# Add your own custom plugins in the custom/plugins directory. Plugins placed
# here will override ones with the same name in the main plugins directory.

@ -1,10 +0,0 @@
setopt correct
alias man='nocorrect man'
alias mv='nocorrect mv'
alias mysql='nocorrect mysql'
alias mkdir='nocorrect mkdir'
alias gist='nocorrect gist'
alias heroku='nocorrect heroku'
alias ebuild='nocorrect ebuild'
alias hpodder='nocorrect hpodder'

@ -1,15 +0,0 @@
## Command history configuration
HISTFILE=$HOME/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt append_history
setopt extended_history
setopt hist_expire_dups_first
setopt hist_ignore_all_dups # ignore duplication command history list
setopt hist_ignore_space
setopt hist_reduce_blanks
setopt hist_save_no_dups
setopt hist_verify
setopt inc_append_history
setopt share_history # share command history data

@ -1,152 +0,0 @@
man-command ()
{
if [ -n "$BUFFER" ]
then
local FirstArg=`echo $BUFFER | awk '{print $1}'`
man $FirstArg
fi
}
sudo-command ()
{
if [ -n "$BUFFER" -a "${BUFFER:0:4}" != "sudo" ]
then
BUFFER="sudo $BUFFER"
zle end-of-line
fi
}
move-pointer-to-next-arg ()
{
if [ -n "$BUFFER" ]
then
CURSOR=`echo | awk '
{ curpos=5; arg=$BUFFER; orig=arg;
arg=substr(arg, curpos);
if (substr(arg, 1, 1) == "-") arg=substr(arg, 2);
curpos+=index(arg, "-");
print curpos; }'`
fi
}
move-pointer-after-command ()
{
if [ -n "$BUFFER" ]
then
local LenOfFirstArg=`echo $BUFFER | awk '{ print length($1) }'`
CURSOR=$LenOfFirstArg
fi
}
# bmi calculator and it doesn't care if you start width height or width
# eg: `bmi 65 1.8` and `bmi 1.8 65` is the same
bmi ()
{
local w=$1
local h=$2
if [[ $w -lt $h ]]
then
h=$1
w=$2
fi
echo $(($w/$h/$h))
}
zle -N man-command # shows the man-page of the written command
zle -N sudo-command # writes "sudo " in front of the buffer
zle -N move-pointer-after-command # moves the pointer between command and first parameter
zle -N move-pointer-to-next-arg
bindkey -e
bindkey '\ew' kill-region
bindkey -s '\el' "ls\n"
bindkey '^r' history-incremental-search-backward
bindkey '^[[1~' beginning-of-line # [Begin]
bindkey '^[[2~' overwrite-mode # [Insert]
bindkey '^[[3~' delete-char # [Delete]
bindkey '^[[4~' end-of-line # [End]
bindkey "^[[5~" up-line-or-history # [Page-Up]
bindkey "^[[6~" down-line-or-history # [Page-Down]
# make search up and down work, so partially type and hit up/down to find relevant stuff
bindkey '^[[A' up-line-or-search
bindkey '^[[B' down-line-or-search
bindkey "^[[H" beginning-of-line
bindkey "^[OH" beginning-of-line
bindkey "^[[F" end-of-line
bindkey "^[OF" end-of-line
bindkey ' ' magic-space # also do history expansion on space
#bindkey "^[[1;5C" forward-word
#bindkey "^[[1;5D" backward-word
#TODO: make keybindings ctrl+right and ctrl+left work
bindkey "^[[OC" move-pointer-to-next-arg
bindkey "^[[OD" move-pointer-after-command
bindkey '^[[Z' reverse-menu-complete
# Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~
bindkey '^?' backward-delete-char
bindkey "^[[3~" delete-char
bindkey "^[3;5~" delete-char
bindkey "\e[3~" delete-char
bindkey '^N' man-command
bindkey '^S' sudo-command
bindkey '^U' kill-whole-line
bindkey '^Q' push-input
bindkey '^P' yank
bindkey '^f' forward-word
bindkey '^b' backward-word
# some command shortcuts
alias ls='ls --color=always'
alias lh='ls -lh'
alias ls_sizesorted='ls -lSrah'
alias lad='ls -d .*(/)' # only show dot-directories
alias lsa='ls -a .*(.)' # only show dot-files
alias lss='ls -l *(s,S,t)' # only files with setgid/setuid/sticky flag
alias lsl='ls -l *(@[1,10])' # only symlinks
alias lsx='ls -l *(*[1,10])' # only executables
alias lsw='ls -ld *(R,W,X.^ND/)' # world-{readable,writable,executable} files
alias lsbig="ls -flh *(.OL[1,10])" # display the biggest files
alias lsd='ls -d ^.*(/)' # only show directories
alias lse='ls -d *(/^F)' # only show empty directories
alias lsnew="ls -drl *(Dom[1,10])" # display the newest files and directories
alias lsold="ls -rtlh *(Dom[1,10])" # display the oldest files and directories
alias lssmall="ls -Srl *(.oL[1,10])" # display the smallest files
alias screensaver='clear; for ((;;)); do echo -ne "\033[$((1+RANDOM%LINES));$((1+RANDOM%COLUMNS))H\033[$((RANDOM%2));3$((RANDOM%8))m$((RANDOM%10))"; sleep 0.1 ; done' # credits to lkj@commandlinefu.com
# global aliases like aliases working _behind_ the command
alias -g _C='|wc -l'
alias -g _G='|grep'
alias -g _H='|head'
alias -g _L='|less'
alias -g _N='&>/dev/null'
alias -g _R='| tr A-z N-za-m'
alias -g _T='|tail'
#
# Unbind c-s and c-q
stty -ixon
# consider emacs keybindings:
#bindkey -e ## emacs key bindings
#
#bindkey '^[[A' up-line-or-search
#bindkey '^[[B' down-line-or-search
#bindkey '^[^[[C' emacs-forward-word
#bindkey '^[^[[D' emacs-backward-word
#
#bindkey -s '^X^Z' '%-^M'
#bindkey '^[e' expand-cmd-path
#bindkey '^[^I' reverse-menu-complete
#bindkey '^X^N' accept-and-infer-next-history
#bindkey '^W' kill-region
#bindkey '^I' complete-word
## Fix weird sequence that rxvt produces
#bindkey -s '^[[Z' '\t'
#

@ -1,19 +0,0 @@
## smart urls
autoload -U url-quote-magic
zle -N self-insert url-quote-magic
## file rename magick
bindkey "^[m" copy-prev-shell-word
## jobs
setopt long_list_jobs
## redirect protection
unsetopt clobber
## pager
export PAGER="less"
export LESS="-R"
export EDITOR="vim"
export LC_CTYPE=$LANG

@ -1,26 +0,0 @@
# Push and pop directories on directory stack
alias pu='pushd'
alias po='popd'
# Basic directory operations
alias ...='cd ../..'
alias -- -='cd -'
# Super user
alias _='sudo'
alias please='sudo'
#alias g='grep -in'
# Show history
alias history='fc -l 1'
# List direcory contents
alias lsa='ls -lah'
alias l='ls -lA1'
alias ll='ls -l'
alias la='ls -lA'
alias sl=ls # often screw this up
alias afind='ack-grep -il'

@ -1,74 +0,0 @@
# fixme - the load process here seems a bit bizarre
unsetopt menu_complete # do not autoselect the first completion entry
unsetopt flowcontrol
setopt auto_menu # show completion menu on succesive tab press
setopt complete_in_word
setopt always_to_end
WORDCHARS=''
zmodload -i zsh/complist
## case-insensitive (all),partial-word and then substring completion
if [ "x$CASE_SENSITIVE" = "xtrue" ]; then
zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
unset CASE_SENSITIVE
else
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
fi
zstyle ':completion:*' list-colors ''
# should this be in keybindings?
bindkey -M menuselect '^o' accept-and-infer-next-history
zstyle ':completion:*:*:*:*:*' menu select
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
#zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w"
#zstyle ':completion:*:*:kill:*:processes' command "ps -u `whoami` --forest -e -o pid,user,tty,cmd"
zstyle ':completion:*:*:kill:*:processes' command "ps xfo pid,user,tty,cmd"
# disable named-directories autocompletion
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
cdpath=(.)
# use /etc/hosts and known_hosts for hostname completion
[ -r /etc/ssh/ssh_known_hosts ] && _global_ssh_hosts=(${${${${(f)"$(</etc/ssh/ssh_known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _global_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=()
hosts=(
"$_global_ssh_hosts[@]"
"$_ssh_hosts[@]"
"$_etc_hosts[@]"
"$HOST"
localhost
)
zstyle ':completion:*:hosts' hosts $hosts
# Use caching so that commands like apt and dpkg complete are useable
zstyle ':completion::complete:*' use-cache 1
zstyle ':completion::complete:*' cache-path $ZSH/cache/
# Don't complete uninteresting users
zstyle ':completion:*:*:*:users' ignored-patterns \
adm amanda apache avahi beaglidx bin cacti canna clamav daemon \
dbus distcache dovecot fax ftp games gdm gkrellmd gopher \
hacluster haldaemon halt hsqldb ident junkbust ldap lp mail \
mailman mailnull mldonkey mysql nagios \
named netdump news nfsnobody nobody nscd ntp nut nx openvpn \
operator pcap postfix postgres privoxy pulse pvm quagga radvd \
rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs
# ... unless we really want to.
zstyle '*' single-ignored show
if [ "x$COMPLETION_WAITING_DOTS" = "xtrue" ]; then
expand-or-complete-with-dots() {
echo -n "\e[31m......\e[0m"
zle expand-or-complete
zle redisplay
}
zle -N expand-or-complete-with-dots
bindkey "^I" expand-or-complete-with-dots
fi

@ -1 +0,0 @@
/home/nk/.oh-my-zsh/custom/lib/correction.zsh

@ -1,10 +0,0 @@
setopt correct
alias man='nocorrect man'
alias mv='nocorrect mv'
alias mysql='nocorrect mysql'
alias mkdir='nocorrect mkdir'
alias gist='nocorrect gist'
alias heroku='nocorrect heroku'
alias ebuild='nocorrect ebuild'
alias hpodder='nocorrect hpodder'

@ -1,39 +0,0 @@
# Changing/making/removing directory
setopt auto_name_dirs
setopt auto_pushd
setopt pushd_ignore_dups
alias ..='cd ..'
alias cd..='cd ..'
alias cd...='cd ../..'
alias cd....='cd ../../..'
alias cd.....='cd ../../../..'
alias cd/='cd /'
alias 1='cd -'
alias 2='cd +2'
alias 3='cd +3'
alias 4='cd +4'
alias 5='cd +5'
alias 6='cd +6'
alias 7='cd +7'
alias 8='cd +8'
alias 9='cd +9'
cd () {
if [[ "x$*" == "x..." ]]; then
cd ../..
elif [[ "x$*" == "x...." ]]; then
cd ../../..
elif [[ "x$*" == "x....." ]]; then
cd ../../../..
elif [[ "x$*" == "x......" ]]; then
cd ../../../../..
else
builtin cd "$@"
fi
}
alias md='mkdir -p'
alias rd=rmdir
alias d='dirs -v | head -10'

@ -1,3 +0,0 @@
autoload -U edit-command-line
zle -N edit-command-line
bindkey '\C-x\C-e' edit-command-line

@ -1,17 +0,0 @@
function zsh_stats() {
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n20
}
function uninstall_oh_my_zsh() {
/usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/uninstall.sh
}
function upgrade_oh_my_zsh() {
/usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh
}
function take() {
mkdir -p $1
cd $1
}

@ -1,132 +0,0 @@
# get the name of the branch we are on
function git_prompt_info() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
}
# Checks if working tree is dirty
parse_git_dirty() {
local SUBMODULE_SYNTAX=''
if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then
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"
else
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
fi
fi
}
# get the difference between the local and remote branches
git_remote_status() {
remote=${$(git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/}
if [[ -n ${remote} ]] ; then
ahead=$(git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
behind=$(git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
if [ $ahead -eq 0 ] && [ $behind -gt 0 ]
then
echo "$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE"
elif [ $ahead -gt 0 ] && [ $behind -eq 0 ]
then
echo "$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE"
elif [ $ahead -gt 0 ] && [ $behind -gt 0 ]
then
echo "$ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE"
fi
fi
}
# Checks if there are commits ahead from remote
function git_prompt_ahead() {
if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
echo "$ZSH_THEME_GIT_PROMPT_AHEAD"
fi
}
# Formats prompt string for current git commit short SHA
function git_prompt_short_sha() {
SHA=$(git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
}
# Formats prompt string for current git commit long SHA
function git_prompt_long_sha() {
SHA=$(git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
}
# Get the status of the working tree
git_prompt_status() {
INDEX=$(git status --porcelain -b 2> /dev/null)
STATUS=""
if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS"
fi
if $(echo "$INDEX" | grep '^A ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
elif $(echo "$INDEX" | grep '^M ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
fi
if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
fi
if $(echo "$INDEX" | grep '^R ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS"
fi
if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
elif $(echo "$INDEX" | grep '^D ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
fi
if $(git rev-parse --verify refs/stash >/dev/null 2>&1); then
STATUS="$ZSH_THEME_GIT_PROMPT_STASHED$STATUS"
fi
if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
fi
if $(echo "$INDEX" | grep '^## .*ahead' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_AHEAD$STATUS"
fi
if $(echo "$INDEX" | grep '^## .*behind' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_BEHIND$STATUS"
fi
if $(echo "$INDEX" | grep '^## .*diverged' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_DIVERGED$STATUS"
fi
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

@ -1,6 +0,0 @@
#
# Color grep results
# Examples: http://rubyurl.com/ZXv
#
export GREP_OPTIONS='--color=auto'
export GREP_COLOR='1;32'

@ -1 +0,0 @@
/home/nk/.oh-my-zsh/custom/lib/history.zsh

@ -1,13 +0,0 @@
## Command history configuration
HISTFILE=$HOME/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt append_history
setopt extended_history
setopt hist_expire_dups_first
setopt hist_ignore_dups # ignore duplication command history list
setopt hist_ignore_space
setopt hist_verify
setopt inc_append_history
setopt share_history # share command history data

@ -1 +0,0 @@
/home/nk/.oh-my-zsh/custom/lib/key-bindings.zsh

@ -1,50 +0,0 @@
# TODO: Explain what some of this does..
bindkey -e
bindkey '\ew' kill-region
bindkey -s '\el' "ls\n"
bindkey '^r' history-incremental-search-backward
bindkey "^[[5~" up-line-or-history
bindkey "^[[6~" down-line-or-history
# make search up and down work, so partially type and hit up/down to find relevant stuff
bindkey '^[[A' up-line-or-search
bindkey '^[[B' down-line-or-search
bindkey "^[[H" beginning-of-line
bindkey "^[[1~" beginning-of-line
bindkey "^[OH" beginning-of-line
bindkey "^[[F" end-of-line
bindkey "^[[4~" end-of-line
bindkey "^[OF" end-of-line
bindkey ' ' magic-space # also do history expansion on space
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
bindkey '^[[Z' reverse-menu-complete
# Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~
bindkey '^?' backward-delete-char
bindkey "^[[3~" delete-char
bindkey "^[3;5~" delete-char
bindkey "\e[3~" delete-char
# consider emacs keybindings:
#bindkey -e ## emacs key bindings
#
#bindkey '^[[A' up-line-or-search
#bindkey '^[[B' down-line-or-search
#bindkey '^[^[[C' emacs-forward-word
#bindkey '^[^[[D' emacs-backward-word
#
#bindkey -s '^X^Z' '%-^M'
#bindkey '^[e' expand-cmd-path
#bindkey '^[^I' reverse-menu-complete
#bindkey '^X^N' accept-and-infer-next-history
#bindkey '^W' kill-region
#bindkey '^I' complete-word
## Fix weird sequence that rxvt produces
#bindkey -s '^[[Z' '\t'
#

@ -1 +0,0 @@
/home/nk/.oh-my-zsh/custom/lib/misc.zsh

@ -1,15 +0,0 @@
## smart urls
autoload -U url-quote-magic
zle -N self-insert url-quote-magic
## file rename magick
bindkey "^[m" copy-prev-shell-word
## jobs
setopt long_list_jobs
## pager
export PAGER="less"
export LESS="-R"
export LC_CTYPE=$LANG

@ -1,8 +0,0 @@
# get the name of the ruby version
function rvm_prompt_info() {
[ -f $HOME/.rvm/bin/rvm-prompt ] || return
local rvm_prompt
rvm_prompt=$($HOME/.rvm/bin/rvm-prompt ${ZSH_THEME_RVM_PROMPT_OPTIONS} 2>/dev/null)
[[ "${rvm_prompt}x" == "x" ]] && return
echo "${ZSH_THEME_RVM_PROMPT_PREFIX:=(}${rvm_prompt}${ZSH_THEME_RVM_PROMPT_SUFFIX:=)}"
}

@ -1,28 +0,0 @@
#! /bin/zsh
# A script to make using 256 colors in zsh less painful.
# P.C. Shyamshankar <sykora@lucentbeing.com>
# Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
typeset -Ag FX FG BG
FX=(
reset "%{%}"
bold "%{%}" no-bold "%{%}"
italic "%{%}" no-italic "%{%}"
underline "%{%}" no-underline "%{%}"
blink "%{%}" no-blink "%{%}"
reverse "%{%}" no-reverse "%{%}"
)
for color in {000..255}; do
FG[$color]="%{[38;5;${color}m%}"
BG[$color]="%{[48;5;${color}m%}"
done
# Show all 256 colors with color number
function spectrum_ls() {
for code in {000..255}; do
print -P -- "$code: %F{$code}Test%f"
done
}

@ -1,35 +0,0 @@
#usage: title short_tab_title looooooooooooooooooooooggggggg_windows_title
#http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1
#Fully support screen, iterm, and probably most modern xterm and rxvt
#Limited support for Apple Terminal (Terminal can't set window or tab separately)
function title {
if [[ "$DISABLE_AUTO_TITLE" == "true" ]] || [[ "$EMACS" == *term* ]]; then
return
fi
if [[ "$TERM" == screen* ]]; then
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
print -Pn "\e]2;$2:q\a" #set window name
print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal)
fi
}
ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD
ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~"
#Appears when you have the prompt
function omz_termsupport_precmd {
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
}
#Appears at the beginning of (and during) of command execution
function omz_termsupport_preexec {
emulate -L zsh
setopt extended_glob
local CMD=${1[(wr)^(*=*|sudo|ssh|rake|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
title "$CMD" "%100>...>${2:gs/%/%%}%<<"
}
autoload -U add-zsh-hook
add-zsh-hook precmd omz_termsupport_precmd
add-zsh-hook preexec omz_termsupport_preexec

@ -1,36 +0,0 @@
# ls colors
autoload colors; colors;
export LSCOLORS="Gxfxcxdxbxegedabagacad"
#export LS_COLORS
# Enable ls colors
if [ "$DISABLE_LS_COLORS" != "true" ]
then
# Find the option for using colors in ls, depending on the version: Linux or BSD
ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
fi
#setopt no_beep
setopt auto_cd
setopt multios
setopt cdablevarS
if [[ x$WINDOW != x ]]
then
SCREEN_NO="%B$WINDOW%b "
else
SCREEN_NO=""
fi
# Apply theming defaults
PS1="%n@%m:%~%# "
# git theming default: Variables for theming the git info prompt
ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of the prompt, before the branch name
ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt
ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty
ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean
# Setup the prompt with pretty colors
setopt prompt_subst

@ -1,4 +0,0 @@
This file is only here so that Git will keep a log directory as .gitignore is ignoring all the log files within it.
feel free to add love notes for people here.

@ -1,80 +0,0 @@
# Check for updates on initial load...
if [ "$DISABLE_AUTO_UPDATE" != "true" ]
then
/usr/bin/env ZSH=$ZSH zsh $ZSH/tools/check_for_upgrade.sh
fi
# Initializes Oh My Zsh
# add a function path
fpath=($ZSH/functions $ZSH/completions $fpath)
# Load all of the config files in ~/oh-my-zsh that end in .zsh
# TIP: Add files you don't want in git to .gitignore
for config_file ($ZSH/lib/*.zsh); do
source $config_file
done
# Set ZSH_CUSTOM to the path where your custom config files
# and plugins exists, or else we will use the default custom/
if [[ -z "$ZSH_CUSTOM" ]]; then
ZSH_CUSTOM="$ZSH/custom"
fi
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
autoload -U compinit
compinit -i
# Load all of the plugins that were defined in ~/.zshrc
for plugin ($plugins); do
if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then
source $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh
elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
source $ZSH/plugins/$plugin/$plugin.plugin.zsh
fi
done
# Load all of your custom configurations from custom/
for config_file ($ZSH_CUSTOM/*.zsh(N)); do
source $config_file
done
unset config_file
# Load the theme
if [ "$ZSH_THEME" = "random" ]
then
themes=($ZSH/themes/*zsh-theme)
N=${#themes[@]}
((N=(RANDOM%N)+1))
RANDOM_THEME=${themes[$N]}
source "$RANDOM_THEME"
echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
else
if [ ! "$ZSH_THEME" = "" ]
then
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

@ -1,26 +0,0 @@
stat -f%m . > /dev/null 2>&1
if [ "$?" = 0 ]; then
stat_cmd=(stat -f%m)
else
stat_cmd=(stat -L --format=%Y)
fi
_ant_does_target_list_need_generating () {
if [ ! -f .ant_targets ]; then return 0;
else
accurate=$($stat_cmd .ant_targets)
changed=$($stat_cmd build.xml)
return $(expr $accurate '>=' $changed)
fi
}
_ant () {
if [ -f build.xml ]; then
if _ant_does_target_list_need_generating; then
sed -n '/<target/s/<target.*name="\([^"]*\).*$/\1/p' build.xml > .ant_targets
fi
compadd `cat .ant_targets`
fi
}
compdef _ant ant

@ -1,6 +0,0 @@
# commands to control local apache2 server installation
# paths are for osx installation via macports
alias apache2start='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start'
alias apache2stop='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper stop'
alias apache2restart='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper restart'

@ -1,93 +0,0 @@
# Archlinux zsh aliases and functions
# Usage is also described at https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins
# Look for yaourt, and add some useful functions if we have it.
if [[ -x `which yaourt` ]]; then
upgrade () {
yaourt -Syu
}
alias yaconf='yaourt -C' # Fix all configuration files with vimdiff
# 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 yasu='yaourt --sucre' # Same as yaupg, but without confirmation
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 yare='yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
alias yarem='yaourt -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
alias yarep='yaourt -Si' # Display information about a given package in the repositories
alias yareps='yaourt -Ss' # Search for package(s) in the repositories
alias yaloc='yaourt -Qi' # Display information about a given package in the local database
alias yalocs='yaourt -Qs' # Search for package(s) in the local database
# Additional yaourt alias examples
if [[ -x `which abs` ]]; then
alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
else
alias yaupd='yaourt -Sy' # Update and refresh the local package and ABS databases against repositories
fi
alias yainsd='yaourt -S --asdeps' # Install given package(s) as dependencies of another package
alias yamir='yaourt -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
else
upgrade() {
sudo pacman -Syu
}
fi
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
alias pacupg='sudo pacman -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
alias pacin='sudo pacman -S' # Install specific package(s) from the repositories
alias pacins='sudo pacman -U' # Install specific package not from the repositories but from a file
alias pacre='sudo pacman -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
alias pacrem='sudo pacman -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
alias pacrep='pacman -Si' # Display information about a given package in the repositories
alias pacreps='pacman -Ss' # Search for package(s) in the repositories
alias pacloc='pacman -Qi' # Display information about a given package in the local database
alias paclocs='pacman -Qs' # Search for package(s) in the local database
# Additional pacman alias examples
if [[ -x `which abs` ]]; then
alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
else
alias pacupd='sudo pacman -Sy' # Update and refresh the local package and ABS databases against repositories
fi
alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies of another package
alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
# https://bbs.archlinux.org/viewtopic.php?id=93683
paclist() {
sudo pacman -Qei $(pacman -Qu|cut -d" " -f 1)|awk ' BEGIN {FS=":"}/^Name/{printf("\033[1;36m%s\033[1;37m", $2)}/^Description/{print $2}'
}
alias paclsorphans='sudo pacman -Qdt'
alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
pacdisowned() {
tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
db=$tmp/db
fs=$tmp/fs
mkdir "$tmp"
trap 'rm -rf "$tmp"' EXIT
pacman -Qlq | sort -u > "$db"
find /bin /etc /lib /sbin /usr \
! -name lost+found \
\( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
comm -23 "$fs" "$db"
}
pacmanallkeys() {
# Get all keys for developers and trusted users
curl https://www.archlinux.org/{developers,trustedusers}/ |
awk -F\" '(/pgp.mit.edu/) {sub(/.*search=0x/,"");print $1}' |
xargs sudo pacman-key --recv-keys
}
pacmansignkeys() {
for key in $*; do
sudo pacman-key --recv-keys $key
sudo pacman-key --lsign-key $key
printf 'trust\n3\n' | sudo gpg --homedir /etc/pacman.d/gnupg \
--no-permission-warning --command-fd 0 --edit-key $key
done
}

@ -1,13 +0,0 @@
if [ $commands[autojump] ]; then # check if autojump is installed
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 [ -f $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation
. $HOME/.autojump/etc/profile.d/autojump.zsh
elif [ -f /opt/local/etc/profile.d/autojump.zsh ]; then # mac os x with ports
. /opt/local/etc/profile.d/autojump.zsh
elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.zsh ]; then # mac os x with brew
. `brew --prefix`/etc/autojump.zsh
fi
fi

@ -1,71 +0,0 @@
###########################################
# Battery plugin for oh-my-zsh #
# Original Author: Peter hoeg (peterhoeg) #
# Email: peter@speartail.com #
###########################################
# Author: Sean Jones (neuralsandwich) #
# Email: neuralsandwich@gmail.com #
# Modified to add support for Apple Mac #
###########################################
if [[ $(uname) == "Darwin" ]] ; then
function battery_pct_remaining() {
if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
typeset -F maxcapacity=$(ioreg -rc "AppleSmartBattery"| grep '^.*"MaxCapacity"\ =\ ' | sed -e 's/^.*"MaxCapacity"\ =\ //')
typeset -F currentcapacity=$(ioreg -rc "AppleSmartBattery"| grep '^.*"CurrentCapacity"\ =\ ' | sed -e 's/^.*CurrentCapacity"\ =\ //')
integer i=$(((currentcapacity/maxcapacity) * 100))
echo $i
else
echo "External Power"
fi
}
function battery_time_remaining() {
if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
timeremaining=$(ioreg -rc "AppleSmartBattery"| grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //')
echo "~$((timeremaining / 60)):$((timeremaining % 60))"
else
echo "∞"
fi
}
function battery_pct_prompt () {
if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
b=$(battery_pct_remaining)
if [ $b -gt 50 ] ; then
color='green'
elif [ $b -gt 20 ] ; then
color='yellow'
else
color='red'
fi
echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
else
echo ""
fi
}
elif [[ $(uname) == "Linux" ]] ; then
if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
function battery_pct_remaining() { echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')" }
function battery_time_remaining() { echo $(acpi | cut -f3 -d ',') }
function battery_pct_prompt() {
b=$(battery_pct_remaining)
if [ $b -gt 50 ] ; then
color='green'
elif [ $b -gt 20 ] ; then
color='yellow'
else
color='red'
fi
echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
}
else
error_msg='no battery'
function battery_pct_remaining() { echo $error_msg }
function battery_time_remaining() { echo $error_msg }
function battery_pct_prompt() { echo '' }
fi
fi

@ -1,80 +0,0 @@
#compdef brew
#autoload
# imported from the latest homebrew contributions
_brew_all_formulae() {
formulae=(`brew search`)
}
_brew_installed_formulae() {
installed_formulae=(`brew list`)
}
local -a _1st_arguments
_1st_arguments=(
'cat:display formula file for a formula'
'cleanup:uninstall unused and old versions of packages'
'create:create a new formula'
'deps:list dependencies and dependants of a formula'
'doctor:audits your installation for common issues'
'edit:edit a formula'
'home:visit the homepage of a formula or the brew project'
'info:information about a formula'
'install:install a formula'
'link:link a formula'
'list:list files in a formula or not-installed formulae'
'log:git commit log for a formula'
'missing:check all installed formuale for missing dependencies.'
'outdated:list formulas for which a newer version is available'
'prune:remove dead links'
'remove:remove a formula'
'search:search for a formula (/regex/ or string)'
'server:start a local web app that lets you browse formulae (requires Sinatra)'
'unlink:unlink a formula'
'update:freshen up links'
'upgrade:upgrade outdated formulae'
'uses:show formulas which depend on a formula'
)
local expl
local -a formulae installed_formulae
_arguments \
'(-v)-v[verbose]' \
'(--cellar)--cellar[brew cellar]' \
'(--config)--config[brew configuration]' \
'(--env)--env[brew environment]' \
'(--repository)--repository[brew repository]' \
'(--version)--version[version information]' \
'(--prefix)--prefix[where brew lives on this system]' \
'(--cache)--cache[brew cache]' \
'*:: :->subcmds' && return 0
if (( CURRENT == 1 )); then
_describe -t commands "brew subcommand" _1st_arguments
return
fi
case "$words[1]" in
search|-S)
_arguments \
'(--macports)--macports[search the macports repository]' \
'(--fink)--fink[search the fink repository]' ;;
list|ls)
_arguments \
'(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \
'(--versions)--versions[list all installed versions of a formula]' \
'1: :->forms' && return 0
if [[ "$state" == forms ]]; then
_brew_installed_formulae
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae
fi ;;
install|home|homepage|log|info|abv|uses|cat|deps|edit|options)
_brew_all_formulae
_wanted formulae expl 'all formulae' compadd -a formulae ;;
remove|rm|uninstall|unlink|cleanup|link|ln)
_brew_installed_formulae
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;;
esac

@ -1 +0,0 @@
alias brews='brew list -1'

@ -1,82 +0,0 @@
#compdef bundle
local curcontext="$curcontext" state line _gems _opts ret=1
_arguments -C -A "-v" -A "--version" \
'(- 1 *)'{-v,--version}'[display version information]' \
'1: :->cmds' \
'*:: :->args' && ret=0
case $state in
cmds)
_values "bundle command" \
"install[Install the gems specified by the Gemfile or Gemfile.lock]" \
"update[Update dependencies to their latest versions]" \
"package[Package the .gem files required by your application]" \
"exec[Execute a script in the context of the current bundle]" \
"config[Specify and read configuration options for bundler]" \
"check[Determine whether the requirements for your application are installed]" \
"list[Show all of the gems in the current bundle]" \
"show[Show the source location of a particular gem in the bundle]" \
"console[Start an IRB session in the context of the current bundle]" \
"open[Open an installed gem in the editor]" \
"viz[Generate a visual representation of your dependencies]" \
"init[Generate a simple Gemfile, placed in the current directory]" \
"gem[Create a simple gem, suitable for development with bundler]" \
"help[Describe available tasks or one specific task]"
ret=0
;;
args)
case $line[1] in
help)
_values 'commands' \
'install' \
'update' \
'package' \
'exec' \
'config' \
'check' \
'list' \
'show' \
'console' \
'open' \
'viz' \
'init' \
'gem' \
'help' && ret=0
;;
install)
_arguments \
'(--no-color)--no-color[disable colorization in output]' \
'(--local)--local[do not attempt to connect to rubygems.org]' \
'(--quiet)--quiet[only output warnings and errors]' \
'(--gemfile)--gemfile=-[use the specified gemfile instead of Gemfile]:gemfile' \
'(--system)--system[install to the system location]' \
'(--deployment)--deployment[install using defaults tuned for deployment environments]' \
'(--frozen)--frozen[do not allow the Gemfile.lock to be updated after this install]' \
'(--path)--path=-[specify a different path than the system default]:path:_files' \
'(--binstubs)--binstubs=-[generate bin stubs for bundled gems to ./bin]:directory:_files' \
'(--without)--without=-[exclude gems that are part of the specified named group]:groups'
ret=0
;;
exec)
_normal && ret=0
;;
(open|show)
_gems=( $(bundle show 2> /dev/null | sed -e '/^ \*/!d; s/^ \* \([^ ]*\) .*/\1/') )
if [[ $_gems != "" ]]; then
_values 'gems' $_gems && ret=0
fi
;;
*)
_opts=( $(bundle help $line[1] | sed -e '/^ \[-/!d; s/^ \[\(-[^=]*\)=.*/\1/') )
_opts+=( $(bundle help $line[1] | sed -e '/^ -/!d; s/^ \(-.\), \[\(-[^=]*\)=.*/\1 \2/') )
if [[ $_opts != "" ]]; then
_values 'options' $_opts && ret=0
fi
;;
esac
;;
esac
return ret

@ -1,43 +0,0 @@
alias be="bundle exec"
alias bi="bundle install"
alias bl="bundle list"
alias bp="bundle package"
alias bu="bundle update"
# The following is based on https://github.com/gma/bundler-exec
bundled_commands=(annotate cap capify cucumber foreman guard middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails puma zeus)
## Functions
_bundler-installed() {
which bundle > /dev/null 2>&1
}
_within-bundled-project() {
local check_dir=$PWD
while [ $check_dir != "/" ]; do
[ -f "$check_dir/Gemfile" ] && return
check_dir="$(dirname $check_dir)"
done
false
}
_run-with-bundler() {
if _bundler-installed && _within-bundled-project; then
bundle exec $@
else
$@
fi
}
## Main program
for cmd in $bundled_commands; do
eval "function unbundled_$cmd () { $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

@ -1,13 +0,0 @@
#
# Requires http://www.bruji.com/bwana/
#
if [[ -e /Applications/Bwana.app ]] ||
( system_profiler -detailLevel mini SPApplicationsDataType | grep -q Bwana )
then
function man() {
open "man:$1"
}
else
echo "Bwana lets you read man files in Safari through a man: URI scheme"
echo "To use it within Zsh, install it from http://www.bruji.com/bwana/"
fi

@ -1,36 +0,0 @@
# Set this to 1 if you want to cache the tasks
_cake_cache_task_list=1
# Cache filename
_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 () {
if [ ${_cake_cache_task_list} -eq 0 ]; then
return 1;
fi
if [ ! -f ${_cake_task_cache_file} ]; then return 0;
else
accurate=$(stat -f%m $_cake_task_cache_file)
changed=$(stat -f%m Cakefile)
return $(expr $accurate '>=' $changed)
fi
}
_cake () {
if [ -f Cakefile ]; then
if _cake_does_target_list_need_generating; then
_cake_get_target_list > ${_cake_task_cache_file}
compadd `cat ${_cake_task_cache_file}`
else
compadd `_cake_get_target_list`
fi
fi
}
compdef _cake cake

@ -1,10 +0,0 @@
#compdef cap
#autoload
if [ -f config/deploy.rb ]; then
if [[ ! -f .cap_tasks~ || config/deploy.rb -nt .cap_tasks~ ]]; then
echo "\nGenerating .cap_tasks~..." > /dev/stderr
cap --tasks | grep '#' | cut -d " " -f 2 > .cap_tasks~
fi
compadd `cat .cap_tasks~`
fi

@ -1,2 +0,0 @@
#!/bin/zsh
alias cloudapp=$ZSH/plugins/cloudapp/cloudapp.rb

@ -1,60 +0,0 @@
#!/usr/bin/env ruby
#
# cloudapp
# Zach Holman / @holman
#
# Uploads a file from the command line to CloudApp, drops it into your
# clipboard (on a Mac, at least).
#
# Example:
#
# cloudapp drunk-blake.png
#
# This requires Aaron Russell's cloudapp_api gem:
#
# gem install cloudapp_api
#
# Requires you set your CloudApp credentials in ~/.cloudapp as a simple file of:
#
# email
# password
require 'rubygems'
begin
require 'cloudapp_api'
rescue LoadError
puts "You need to install cloudapp_api: gem install cloudapp_api"
exit!(1)
end
config_file = "#{ENV['HOME']}/.cloudapp"
unless File.exist?(config_file)
puts "You need to type your email and password (one per line) into "+
"`~/.cloudapp`"
exit!(1)
end
email,password = File.read(config_file).split("\n")
class HTTParty::Response
# Apparently HTTPOK.ok? IS NOT OKAY WTFFFFFFFFFFUUUUUUUUUUUUUU
# LETS MONKEY PATCH IT I FEEL OKAY ABOUT IT
def ok? ; true end
end
if ARGV[0].nil?
puts "You need to specify a file to upload."
exit!(1)
end
CloudApp.authenticate(email,password)
url = CloudApp::Item.create(:upload, {:file => ARGV[0]}).url
# Say it for good measure.
puts "Uploaded to #{url}."
# Get the embed link.
url = "#{url}/#{ARGV[0].split('/').last}"
# Copy it to your (Mac's) clipboard.
`echo '#{url}' | tr -d "\n" | pbcopy`

@ -1,71 +0,0 @@
#compdef coffee
# ------------------------------------------------------------------------------
# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for Coffee.js v0.6.11 (http://coffeejs.org)
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Mario Fernandez (https://github.com/sirech)
#
# ------------------------------------------------------------------------------
local curcontext="$curcontext" state line ret=1
typeset -A opt_args
_arguments -C \
'(- *)'{-h,--help}'[display this help message]' \
'(- *)'{-v,--version}'[display the version number]' \
'(-b --bare)'{-b,--bare}'[compile without a top-level function wrapper]' \
'(-e --eval)'{-e,--eval}'[pass a string from the command line as input]:Inline Script' \
'(-i --interactive)'{-i,--interactive}'[run an interactive CoffeeScript REPL]' \
'(-j --join)'{-j,--join}'[concatenate the source CoffeeScript before compiling]:Destination JS file:_files -g "*.js"' \
'(-l --lint)'{-l,--lint}'[pipe the compiled JavaScript through JavaScript Lint]' \
'(--nodejs)--nodejs[pass options directly to the "node" binary]' \
'(-c --compile)'{-c,--compile}'[compile to JavaScript and save as .js files]' \
'(-o --output)'{-o,--output}'[set the output directory for compiled JavaScript]:Output Directory:_files -/' \
'(-n -t -p)'{-n,--nodes}'[print out the parse tree that the parser produces]' \
'(-n -t -p)'{-p,--print}'[print out the compiled JavaScript]' \
'(-n -t -p)'{-t,--tokens}'[print out the tokens that the lexer/rewriter produce]' \
'(-r --require)'{-r,--require}'[require a library before executing your script]:library' \
'(-s --stdio)'{-s,--stdio}'[listen for and compile scripts over stdio]' \
'(-w --watch)'{-w,--watch}'[watch scripts for changes and rerun commands]' \
'*:script or directory:_files' && ret=0
return ret
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

@ -1,6 +0,0 @@
n forw-line
e back-line
k repeat-search
\ek repeat-search-all
K reverse-search
\eK reverse-search-all

@ -1,22 +0,0 @@
# ctrl-j newline
bindkey '^n' accept-line
bindkey -a '^n' accept-line
# another rotation to match qwerty
bindkey -a 'n' down-line-or-history
bindkey -a 'e' up-line-or-history
bindkey -a 'i' vi-forward-char
# make qwerty
bindkey -a 'k' vi-repeat-search
bindkey -a 'K' vi-rev-repeat-search
bindkey -a 'u' vi-insert
bindkey -a 'U' vi-insert-bol
bindkey -a 'l' vi-undo-change
bindkey -a 'N' vi-join
# spare
bindkey -a 'j' vi-forward-word-end
bindkey -a 'J' vi-forward-blank-word-end
lesskey $ZSH_CUSTOM/plugins/colemak/colemak-less

@ -1,5 +0,0 @@
# Uses the command-not-found package zsh support
# as seen in http://www.porcheron.info/command-not-found-for-zsh/
# this is installed in Ubuntu
[[ -e /etc/zsh_command_not_found ]] && source /etc/zsh_command_not_found

@ -1,20 +0,0 @@
# ------------------------------------------------------------------------------
# FILE: compleat.plugin.zsh
# DESCRIPTION: oh-my-zsh plugin file.
# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com)
# VERSION: 1.0.0
# ------------------------------------------------------------------------------
if (( ${+commands[compleat]} )); then
local prefix="${commands[compleat]:h:h}"
local setup="${prefix}/share/compleat-1.0/compleat_setup"
if [[ -f "$setup" ]]; then
if ! bashcompinit >/dev/null 2>&1; then
autoload -U bashcompinit
bashcompinit -i
fi
source "$setup"
fi
fi

@ -1,29 +0,0 @@
# ------------------------------------------------------------------------------
# FILE: composer.plugin.zsh
# DESCRIPTION: oh-my-zsh composer plugin file.
# AUTHOR: Daniel Gomes (me@danielcsgomes.com)
# VERSION: 1.0.0
# ------------------------------------------------------------------------------
# Composer basic command completion
_composer_get_command_list () {
composer --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }'
}
_composer () {
if [ -f composer.json ]; then
compadd `_composer_get_command_list`
fi
}
compdef _composer composer
# Aliases
alias c='composer'
alias csu='composer self-update'
alias cu='composer update'
alias ci='composer install'
alias ccp='composer create-project'
# install composer in the current directory
alias cget='curl -s https://getcomposer.org/installer | php'

@ -1,14 +0,0 @@
#Show progress while file is copying
# Rsync options are:
# -p - preserve permissions
# -o - preserve owner
# -g - preserve group
# -h - output in human-readable format
# --progress - display progress
# -b - instead of just overwriting an existing file, save the original
# --backup-dir=/tmp/rsync - move backup copies to "/tmp/rsync"
# -e /dev/null - only work on local files
# -- - everything after this is an argument, even if it looks like an option
alias cpv="rsync -poghb --backup-dir=/tmp/rsync -e /dev/null --progress --"

@ -1,67 +0,0 @@
#compdef cpanm
##
# cpanminus Z Shell completion script
##
#
# Current supported cpanm version: 1.4000 (Tue Mar 8 01:00:49 PST 2011)
#
# The latest code is always located at:
# https://github.com/rshhh/cpanminus/blob/master/etc/_cpanm
#
local arguments curcontext="$curcontext"
typeset -A opt_args
arguments=(
# Commands
# '(--install -i)'{--install,-i}'[Installs the modules]'
'(- :)--self-upgrade[Upgrades itself]'
'(- :)--info[Displays distribution info on CPAN]'
'(--installdeps)--installdeps[Only install dependencies]'
'(--look)--look[Download/unpack the distribution and then open the directory with your shell]'
'(- :)'{--help,-h}'[Displays help information]'
'(- :)'{--version,-V}'[Displays software version]'
# Options
{--force,-f}'[Force install]'
{--notest,-n}'[Do not run unit tests]'
{--sudo,-S}'[sudo to run install commands]'
'(-v --verbose --quiet -q)'{--verbose,-v}'[Turns on chatty output]'
'(-q --quiet --verbose -v)'{--quiet,-q}'[Turns off all output]'
{--local-lib,-l}'[Specify the install base to install modules]'
{--local-lib-contained,-L}'[Specify the install base to install all non-core modules]'
'--mirror[Specify the base URL for the mirror (e.g. http://cpan.cpantesters.org/)]:URLs:_urls'
'--mirror-only[Use the mirror\''s index file instead of the CPAN Meta DB]'
'--prompt[Prompt when configure/build/test fails]'
'--reinstall[Reinstall the distribution even if you already have the latest version installed]'
'--interactive[Turn on interactive configure]'
'--scandeps[Scan the depencencies of given modules and output the tree in a text format]'
'--format[Specify what format to display the scanned dependency tree]:scandeps format:(tree json yaml dists)'
'--save-dists[Specify the optional directory path to copy downloaded tarballs]'
# '--uninst-shadows[Uninstalls the shadow files of the distribution that you\''re installing]'
'--auto-cleanup[Number of days that cpanm\''s work directories expire in. Defaults to 7]'
'(--no-man-pages)--man-pages[Generates man pages for executables (man1) and libraries (man3)]'
'(--man-pages)--no-man-pages[Do not generate man pages]'
# Note: Normally with "--lwp", "--wget" and "--curl" options set to true (which is the default) cpanm tries LWP,
# Wget, cURL and HTTP::Tiny (in that order) and uses the first one available.
# (So that the exclusions are not enabled here for the completion)
'(--lwp)--lwp[Use LWP module to download stuff]'
'(--wget)--wget[Use GNU Wget (if available) to download stuff]'
'(--curl)--curl[Use cURL (if available) to download stuff]'
# Other completions
'*:Local directory or archive:_files -/ -g "*.(tar.gz|tgz|tar.bz2|zip)(-.)"'
# '*::args: _normal' # this looks for default files (any files)
)
_arguments -s $arguments \
&& return 0
return 1

@ -1,186 +0,0 @@
# Authors:
# https://github.com/AlexBio
# https://github.com/dbb
#
# 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 2>&1 ) ]]; then
apt_pref='aptitude'
else
apt_pref='apt-get'
fi
# Use sudo by default if it's installed
if [[ -e $( which sudo 2>&1 ) ]]; then
use_sudo=1
fi
# Aliases ###################################################################
# These are for more obscure uses of apt-get and aptitude that aren't covered
# below.
alias ag='apt-get'
alias ap='aptitude'
# Some self-explanatory aliases
alias acs="apt-cache search"
alias aps='aptitude search'
alias as="aptitude -F \"* %p -> %d \n(%v/%V)\" \
--no-gui --disable-columns search" # search package
# apt-file
alias afs='apt-file search --regexp'
# These are apt-get only
alias asrc='apt-get source'
alias app='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 dia='sudo dpkg -i ./*.deb'
alias di='sudo dpkg -i'
# 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 dia='su -lc "dpkg -i ./*.deb" root'
alias di='su -lc "dpkg -i" 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
alias allpkgs='aptitude search -F "%p" --disable-columns ~i'
# Create a basic .deb package
alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc'
# Functions #################################################################
# create a simple script that can be used to 'duplicate' a system
apt-copy() {
print '#!/bin/sh'"\n" > apt-copy.sh
cmd='$apt_pref install'
for p in ${(f)"$(aptitude search -F "%p" --disable-columns \~i)"}; {
cmd="${cmd} ${p}"
}
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
kerndeb () {
# 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 )
revision=$(date +"%Y%m%d") # this shows up in the .deb file name
make-kpkg clean
time fakeroot make-kpkg --append-to-version "$appendage" --revision \
"$revision" kernel_image kernel_headers
}

@ -1,10 +0,0 @@
##
# dircycle plugin: enables cycling through the directory
# stack using Ctrl+Shift+Left/Right
eval "insert-cycledleft () { zle push-line; LBUFFER='pushd -q +1'; zle accept-line }"
zle -N insert-cycledleft
bindkey "\e[1;6D" insert-cycledleft
eval "insert-cycledright () { zle push-line; LBUFFER='pushd -q -0'; zle accept-line }"
zle -N insert-cycledright
bindkey "\e[1;6C" insert-cycledright

@ -1,39 +0,0 @@
#!/bin/zsh
#
# Make the dirstack more persistant
#
# Add dirpersist to $plugins in ~/.zshrc to load
#
# $zdirstore is the file used to persist the stack
zdirstore=~/.zdirstore
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
}
dirpersistrestore () {
if [ -f $zdirstore ]; then
source $zdirstore
fi
}
DIRSTACKSIZE=10
setopt autopushd pushdminus pushdsilent pushdtohome pushdignoredups
dirpersistinstall
dirpersistrestore
# Make popd changes permanent without having to wait for logout
alias popd="popd;dirpersiststore"

@ -1,223 +0,0 @@
#compdef manage.py
typeset -ga nul_args
nul_args=(
'--settings=-[the Python path to a settings module.]:file:_files'
'--pythonpath=-[a directory to add to the Python path.]::directory:_directories'
'--traceback[print traceback on exception.]'
"--version[show program's version number and exit.]"
{-h,--help}'[show this help message and exit.]'
)
_managepy-adminindex(){
_arguments -s : \
$nul_args \
'*::directory:_directories' && ret=0
}
_managepy-createcachetable(){
_arguments -s : \
$nul_args && ret=0
}
_managepy-dbshell(){
_arguments -s : \
$nul_args && ret=0
}
_managepy-diffsettings(){
_arguments -s : \
$nul_args && ret=0
}
_managepy-dumpdata(){
_arguments -s : \
'--format=-[specifies the output serialization format for fixtures.]:format:(json yaml xml)' \
'--indent=-[specifies the indent level to use when pretty-printing output.]:' \
$nul_args \
'*::appname:_applist' && ret=0
}
_managepy-flush(){
_arguments -s : \
'--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \
'--noinput[tells Django to NOT prompt the user for input of any kind.]' \
$nul_args && ret=0
}
_managepy-help(){
_arguments -s : \
'*:command:_managepy_cmds' \
$nul_args && ret=0
}
_managepy_cmds(){
local line
local -a cmd
_call_program help-command ./manage.py help \
|& sed -n '/^ /s/[(), ]/ /gp' \
| while read -A line; do cmd=($line $cmd) done
_describe -t managepy-command 'manage.py command' cmd
}
_managepy-inspectdb(){
_arguments -s : \
$nul_args && ret=0
}
_managepy-loaddata(){
_arguments -s : \
'--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \
'*::file:_files' \
$nul_args && ret=0
}
_managepy-reset(){
_arguments -s : \
'--noinput[tells Django to NOT prompt the user for input of any kind.]' \
'*::appname:_applist' \
$nul_args && ret=0
}
_managepy-runfcgi(){
local state
local fcgi_opts
fcgi_opts=(
'protocol[fcgi, scgi, ajp, ... (default fcgi)]:protocol:(fcgi scgi ajp)'
'host[hostname to listen on..]:'
'port[port to listen on.]:'
'socket[UNIX socket to listen on.]::file:_files'
'method[prefork or threaded (default prefork)]:method:(prefork threaded)'
'maxrequests[number of requests a child handles before it is killed and a new child is forked (0 = no limit).]:'
'maxspare[max number of spare processes / threads.]:'
'minspare[min number of spare processes / threads.]:'
'maxchildren[hard limit number of processes / threads.]:'
'daemonize[whether to detach from terminal.]:boolean:(False True)'
'pidfile[write the spawned process-id to this file.]:file:_files'
'workdir[change to this directory when daemonizing.]:directory:_files'
'outlog[write stdout to this file.]:file:_files'
'errlog[write stderr to this file.]:file:_files'
)
_arguments -s : \
$nul_args \
'*: :_values "FCGI Setting" $fcgi_opts' && ret=0
}
_managepy-runserver(){
_arguments -s : \
'--noreload[tells Django to NOT use the auto-reloader.]' \
'--adminmedia[specifies the directory from which to serve admin media.]:directory:_files' \
$nul_args && ret=0
}
_managepy-shell(){
_arguments -s : \
'--plain[tells Django to use plain Python, not IPython.]' \
$nul_args && ret=0
}
_managepy-sql(){}
_managepy-sqlall(){}
_managepy-sqlclear(){}
_managepy-sqlcustom(){}
_managepy-sqlflush(){}
_managepy-sqlindexes(){}
_managepy-sqlinitialdata(){}
_managepy-sqlreset(){}
_managepy-sqlsequencereset(){}
_managepy-startapp(){}
_managepy-syncdb() {
_arguments -s : \
'--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \
'--noinput[tells Django to NOT prompt the user for input of any kind.]' \
$nul_args && ret=0
}
_managepy-test() {
_arguments -s : \
'--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \
'--noinput[tells Django to NOT prompt the user for input of any kind.]' \
'*::appname:_applist' \
$nul_args && ret=0
}
_managepy-testserver() {
_arguments -s : \
'--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \
'--addrport=-[port number or ipaddr:port to run the server on.]' \
'*::fixture:_files' \
$nul_args && ret=0
}
_managepy-validate() {
_arguments -s : \
$nul_args && ret=0
}
_managepy-commands() {
local -a commands
commands=(
'adminindex:prints the admin-index template snippet for the given app name(s).'
'createcachetable:creates the table needed to use the SQL cache backend.'
'dbshell:runs the command-line client for the current DATABASE_ENGINE.'
"diffsettings:displays differences between the current settings.py and Django's default settings."
'dumpdata:Output the contents of the database as a fixture of the given format.'
'flush:Executes ``sqlflush`` on the current database.'
'help:manage.py help.'
'inspectdb:Introspects the database tables in the given database and outputs a Django model module.'
'loaddata:Installs the named fixture(s) in the database.'
'reset:Executes ``sqlreset`` for the given app(s) in the current database.'
'runfcgi:Run this project as a fastcgi (or some other protocol supported by flup) application,'
'runserver:Starts a lightweight Web server for development.'
'shell:Runs a Python interactive interpreter.'
'sql:Prints the CREATE TABLE SQL statements for the given app name(s).'
'sqlall:Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for the given model module name(s).'
'sqlclear:Prints the DROP TABLE SQL statements for the given app name(s).'
'sqlcustom:Prints the custom table modifying SQL statements for the given app name(s).'
'sqlflush:Returns a list of the SQL statements required to return all tables in the database to the state they were in just after they were installed.'
'sqlindexes:Prints the CREATE INDEX SQL statements for the given model module name(s).'
"sqlinitialdata:RENAMED: see 'sqlcustom'"
'sqlreset:Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given app name(s).'
'sqlsequencereset:Prints the SQL statements for resetting sequences for the given app name(s).'
"startapp:Creates a Django app directory structure for the given app name in this project's directory."
"syncdb:Create the database tables for all apps in INSTALLED_APPS whose tables haven't already been created."
'test:Runs the test suite for the specified applications, or the entire site if no apps are specified.'
'testserver:Runs a development server with data from the given fixture(s).'
'validate:Validates all installed models.'
)
_describe -t commands 'manage.py command' commands && ret=0
}
_applist() {
local line
local -a apps
_call_program help-command "python -c \"import os.path as op, re, django.conf, sys;\\
bn=op.basename(op.abspath(op.curdir));[sys\\
.stdout.write(str(re.sub(r'^%s\.(.*?)$' %
bn, r'\1', i)) + '\n') for i in django.conf.settings.\\
INSTALLED_APPS if re.match(r'^%s' % bn, i)]\"" \
| while read -A line; do apps=($line $apps) done
_values 'Application' $apps && ret=0
}
_managepy() {
local curcontext=$curcontext ret=1
if ((CURRENT == 2)); then
_managepy-commands
else
shift words
(( CURRENT -- ))
curcontext="${curcontext%:*:*}:managepy-$words[1]:"
_call_function ret _managepy-$words[1]
fi
}
compdef _managepy manage.py
compdef _managepy django
compdef _managepy django-manage

@ -1,4 +0,0 @@
encode64(){ echo -n $1 | base64 }
decode64(){ echo -n $1 | base64 -D }
alias e64=encode64
alias d64=decode64

@ -1,8 +0,0 @@
#compdef extract
#autoload
_arguments \
'(-r --remove)'{-r,--remove}'[Remove archive.]' \
"*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|rar|7z|deb)(-.)'" && return 0

@ -1,80 +0,0 @@
# ------------------------------------------------------------------------------
# FILE: extract.plugin.zsh
# DESCRIPTION: oh-my-zsh plugin file.
# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com)
# VERSION: 1.0.1
# ------------------------------------------------------------------------------
function extract() {
local remove_archive
local success
local file_name
local extract_dir
if (( $# == 0 )); then
echo "Usage: extract [-option] [file ...]"
echo
echo Options:
echo " -r, --remove Remove archive."
echo
echo "Report bugs to <sorin.ionescu@gmail.com>."
fi
remove_archive=1
if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then
remove_archive=0
shift
fi
while (( $# > 0 )); do
if [[ ! -f "$1" ]]; then
echo "extract: '$1' is not a valid file" 1>&2
shift
continue
fi
success=0
file_name="$( basename "$1" )"
extract_dir="$( echo "$file_name" | sed "s/\.${1##*.}//g" )"
case "$1" in
(*.tar.gz|*.tgz) tar xvzf "$1" ;;
(*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;;
(*.tar.xz|*.txz) tar --xz --help &> /dev/null \
&& tar --xz -xvf "$1" \
|| xzcat "$1" | tar xvf - ;;
(*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \
&& tar --lzma -xvf "$1" \
|| lzcat "$1" | tar xvf - ;;
(*.tar) tar xvf "$1" ;;
(*.gz) gunzip "$1" ;;
(*.bz2) bunzip2 "$1" ;;
(*.xz) unxz "$1" ;;
(*.lzma) unlzma "$1" ;;
(*.Z) uncompress "$1" ;;
(*.zip) unzip "$1" -d $extract_dir ;;
(*.rar) unrar e -ad "$1" ;;
(*.7z) 7za x "$1" ;;
(*.deb)
mkdir -p "$extract_dir/control"
mkdir -p "$extract_dir/data"
cd "$extract_dir"; ar vx "../${1}" > /dev/null
cd control; tar xzvf ../control.tar.gz
cd ../data; tar xzvf ../data.tar.gz
cd ..; rm *.tar.gz debian-binary
cd ..
;;
(*)
echo "extract: '$1' cannot be extracted" 1>&2
success=1
;;
esac
(( success = $success > 0 ? $success : $? ))
(( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1"
shift
done
}
alias x=extract

@ -1,6 +0,0 @@
if [ $commands[fasd] ]; then # check if fasd is installed
eval "$(fasd --init auto)"
alias v='f -e vim'
alias o='a -e open'
fi

@ -1,44 +0,0 @@
# Open folder in ForkLift.app from console
# Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
#
# Usage:
# fl [<folder>]
#
# Opens specified directory or current working directory in ForkLift.app
#
# Notes:
# It assumes Shift+Cmd+G launches go to folder panel and Cmd+N opens new
# app window.
#
# https://gist.github.com/3313481
function fl {
if [ ! -z "$1" ]; then
DIR=$1
if [ ! -d "$DIR" ]; then
DIR=$(dirname $DIR)
fi
if [ "$DIR" != "." ]; then
PWD=`cd "$DIR";pwd`
fi
fi
osascript 2>&1 1>/dev/null <<END
tell application "ForkLift"
activate
end tell
tell application "System Events"
tell application process "ForkLift"
try
set topWindow to window 1
on error
keystroke "n" using command down
set topWindow to window 1
end try
keystroke "g" using {command down, shift down}
tell sheet 1 of topWindow
set value of text field 1 to "$PWD"
keystroke return
end tell
end tell
end tell
END
}

@ -1,34 +0,0 @@
#compdef gas
local curcontext="$curcontext" state line cmds ret=1
_arguments -C \
'(- 1 *)'{-v,--version}'[display version information]' \
'(-h|--help)'{-h,--help}'[show help information]' \
'1: :->cmds' \
'*: :->args' && ret=0
case $state in
cmds)
cmds=(
"version:Prints Gas's version"
"use:Uses author"
"show:Shows your current user"
"list:Lists your authors"
"import:Imports current user to gasconfig"
"help:Describe available tasks or one specific task"
"delete:Deletes author"
"add:Adds author to gasconfig"
)
_describe -t commands 'gas command' cmds && ret=0
;;
args)
case $line[1] in
(use|delete)
_values -S , 'authors' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0
;;
esac
;;
esac
return ret

@ -1,64 +0,0 @@
#compdef gem
#autoload
# gem zsh completion, based on homebrew completion
_gem_installed() {
installed_gems=(`gem list --local --no-versions`)
}
local -a _1st_arguments
_1st_arguments=(
'cert:Manage RubyGems certificates and signing settings'
'check:Check installed gems'
'cleanup:Clean up old versions of installed gems in the local repository'
'contents:Display the contents of the installed gems'
'dependency:Show the dependencies of an installed gem'
'environment:Display information about the RubyGems environment'
'fetch:Download a gem and place it in the current directory'
'generate_index:Generates the index files for a gem server directory'
'help:Provide help on the `gem` command'
'install:Install a gem into the local repository'
'list:Display gems whose name starts with STRING'
'lock:Generate a lockdown list of gems'
'mirror:Mirror a gem repository'
'outdated:Display all gems that need updates'
'owner:Manage gem owners on RubyGems.org.'
'pristine:Restores installed gems to pristine condition from files located in the gem cache'
'push:Push a gem up to RubyGems.org'
'query:Query gem information in local or remote repositories'
'rdoc:Generates RDoc for pre-installed gems'
'search:Display all gems whose name contains STRING'
'server:Documentation and gem repository HTTP server'
'sources:Manage the sources and cache file RubyGems uses to search for gems'
'specification:Display gem specification (in yaml)'
'stale:List gems along with access times'
'uninstall:Uninstall gems from the local repository'
'unpack:Unpack an installed gem to the current directory'
'update:Update the named gems (or all installed gems) in the local repository'
'which:Find the location of a library file you can require'
)
local expl
local -a gems installed_gems
_arguments \
'(-v --version)'{-v,--version}'[show version]' \
'(-h --help)'{-h,--help}'[show help]' \
'*:: :->subcmds' && return 0
if (( CURRENT == 1 )); then
_describe -t commands "gem subcommand" _1st_arguments
return
fi
case "$words[1]" in
list)
if [[ "$state" == forms ]]; then
_gem_installed
_requested installed_gems expl 'installed gems' compadd -a installed_gems
fi ;;
uninstall|update)
_gem_installed
_wanted installed_gems expl 'installed gems' compadd -a installed_gems ;;
esac

@ -1,285 +0,0 @@
#compdef git
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for git-extras (http://github.com/visionmedia/git-extras).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Alexis GRIMALDI (https://github.com/agrimaldi)
#
# ------------------------------------------------------------------------------
# Inspirations
# -----------
#
# * git-extras (http://github.com/visionmedia/git-extras)
# * git-flow-completion (http://github.com/bobthecow/git-flow-completion)
#
# ------------------------------------------------------------------------------
__git_command_successful () {
if (( ${#pipestatus:#0} > 0 )); then
_message 'not a git repository'
return 1
fi
return 0
}
__git_tag_names() {
local expl
declare -a tag_names
tag_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/})
__git_command_successful || return
_wanted tag-names expl tag-name compadd $* - $tag_names
}
__git_branch_names() {
local expl
declare -a branch_names
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
__git_command_successful || return
_wanted branch-names expl branch-name compadd $* - $branch_names
}
__git_feature_branch_names() {
local expl
declare -a branch_names
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/feature 2>/dev/null)"}#refs/heads/feature/})
__git_command_successful || return
_wanted branch-names expl branch-name compadd $* - $branch_names
}
__git_refactor_branch_names() {
local expl
declare -a branch_names
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/refactor 2>/dev/null)"}#refs/heads/refactor/})
__git_command_successful || return
_wanted branch-names expl branch-name compadd $* - $branch_names
}
__git_bug_branch_names() {
local expl
declare -a branch_names
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/bug 2>/dev/null)"}#refs/heads/bug/})
__git_command_successful || return
_wanted branch-names expl branch-name compadd $* - $branch_names
}
__git_submodule_names() {
local expl
declare -a submodule_names
submodule_names=(${(f)"$(_call_program branchrefs git submodule status | awk '{print $2}')"})
__git_command_successful || return
_wanted submodule-names expl submodule-name compadd $* - $submodule_names
}
__git_author_names() {
local expl
declare -a author_names
author_names=(${(f)"$(_call_program branchrefs git log --format='%aN' | sort -u)"})
__git_command_successful || return
_wanted author-names expl author-name compadd $* - $author_names
}
_git-changelog() {
_arguments \
'(-l --list)'{-l,--list}'[list commits]' \
}
_git-effort() {
_arguments \
'--above[ignore file with less than x commits]' \
}
_git-contrib() {
_arguments \
':author:__git_author_names'
}
_git-count() {
_arguments \
'--all[detailed commit count]'
}
_git-delete-branch() {
_arguments \
':branch-name:__git_branch_names'
}
_git-delete-submodule() {
_arguments \
':submodule-name:__git_submodule_names'
}
_git-delete-tag() {
_arguments \
':tag-name:__git_tag_names'
}
_git-extras() {
local curcontext=$curcontext state line ret=1
declare -A opt_args
_arguments -C \
': :->command' \
'*:: :->option-or-argument' && ret=0
case $state in
(command)
declare -a commands
commands=(
'update:update git-extras'
)
_describe -t commands command commands && ret=0
;;
esac
_arguments \
'(-v --version)'{-v,--version}'[show current version]' \
}
_git-graft() {
_arguments \
':src-branch-name:__git_branch_names' \
':dest-branch-name:__git_branch_names'
}
_git-squash() {
_arguments \
':branch-name:__git_branch_names'
}
_git-feature() {
local curcontext=$curcontext state line ret=1
declare -A opt_args
_arguments -C \
': :->command' \
'*:: :->option-or-argument' && ret=0
case $state in
(command)
declare -a commands
commands=(
'finish:merge feature into the current branch'
)
_describe -t commands command commands && ret=0
;;
(option-or-argument)
curcontext=${curcontext%:*}-$line[1]:
case $line[1] in
(finish)
_arguments -C \
':branch-name:__git_feature_branch_names'
;;
esac
esac
}
_git-refactor() {
local curcontext=$curcontext state line ret=1
declare -A opt_args
_arguments -C \
': :->command' \
'*:: :->option-or-argument' && ret=0
case $state in
(command)
declare -a commands
commands=(
'finish:merge refactor into the current branch'
)
_describe -t commands command commands && ret=0
;;
(option-or-argument)
curcontext=${curcontext%:*}-$line[1]:
case $line[1] in
(finish)
_arguments -C \
':branch-name:__git_refactor_branch_names'
;;
esac
esac
}
_git-bug() {
local curcontext=$curcontext state line ret=1
declare -A opt_args
_arguments -C \
': :->command' \
'*:: :->option-or-argument' && ret=0
case $state in
(command)
declare -a commands
commands=(
'finish:merge bug into the current branch'
)
_describe -t commands command commands && ret=0
;;
(option-or-argument)
curcontext=${curcontext%:*}-$line[1]:
case $line[1] in
(finish)
_arguments -C \
':branch-name:__git_bug_branch_names'
;;
esac
esac
}
zstyle ':completion:*:*:git:*' user-commands \
changelog:'populate changelog file with commits since the previous tag' \
contrib:'display author contributions' \
count:'count commits' \
delete-branch:'delete local and remote branch' \
delete-submodule:'delete submodule' \
delete-tag:'delete local and remote tag' \
extras:'git-extras' \
graft:'merge commits from source branch to destination branch' \
squash:'merge commits from source branch into the current one as a single commit' \
feature:'create a feature branch' \
refactor:'create a refactor branch' \
bug:'create a bug branch' \
summary:'repository summary' \
effort:'display effort statistics' \
repl:'read-eval-print-loop' \
commits-since:'list commits since a given date' \
release:'release commit with the given tag' \
alias:'define, search and show aliases' \
ignore:'add patterns to .gitignore' \
info:'show info about the repository' \
create-branch:'create local and remote branch' \
fresh-branch:'create empty local branch' \
undo:'remove the latest commit' \
setup:'setup a git repository' \
touch:'one step creation of new files' \
obliterate:'Completely remove a file from the repository, including past commits and tags' \
local-commits:'list unpushed commits on the local branch' \

@ -1,337 +0,0 @@
#!zsh
#
# Installation
# ------------
#
# To achieve git-flow completion nirvana:
#
# 0. Update your zsh's git-completion module to the newest verion.
# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD
#
# 1. Install this file. Either:
#
# a. Place it in your .zshrc:
#
# b. Or, copy it somewhere (e.g. ~/.git-flow-completion.zsh) and put the following line in
# your .zshrc:
#
# source ~/.git-flow-completion.zsh
#
# c. Or, use this file as a oh-my-zsh plugin.
#
_git-flow ()
{
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(
'init:Initialize a new git repo with support for the branching model.'
'feature:Manage your feature branches.'
'release:Manage your release branches.'
'hotfix:Manage your hotfix branches.'
'support:Manage your support branches.'
'version:Shows version information.'
)
_describe -t commands 'git flow' subcommands
;;
(options)
case $line[1] in
(init)
_arguments \
-f'[Force setting of gitflow branches, even if already configured]'
;;
(version)
;;
(hotfix)
__git-flow-hotfix
;;
(release)
__git-flow-release
;;
(feature)
__git-flow-feature
;;
esac
;;
esac
}
__git-flow-release ()
{
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(
'start:Start a new release branch.'
'finish:Finish a release branch.'
'list:List all your release branches. (Alias to `git flow release`)'
)
_describe -t commands 'git flow release' subcommands
_arguments \
-v'[Verbose (more) output]'
;;
(options)
case $line[1] in
(start)
_arguments \
-F'[Fetch from origin before performing finish]'\
':version:__git_flow_version_list'
;;
(finish)
_arguments \
-F'[Fetch from origin before performing finish]' \
-s'[Sign the release tag cryptographically]'\
-u'[Use the given GPG-key for the digital signature (implies -s)]'\
-m'[Use the given tag message]'\
-p'[Push to $ORIGIN after performing finish]'\
-k'[Keep branch after performing finish]'\
-n"[Don't tag this release]"\
':version:__git_flow_version_list'
;;
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
}
__git-flow-hotfix ()
{
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(
'start:Start a new hotfix branch.'
'finish:Finish a hotfix branch.'
'list:List all your hotfix branches. (Alias to `git flow hotfix`)'
)
_describe -t commands 'git flow hotfix' subcommands
_arguments \
-v'[Verbose (more) output]'
;;
(options)
case $line[1] in
(start)
_arguments \
-F'[Fetch from origin before performing finish]'\
':hotfix:__git_flow_version_list'\
':branch-name:__git_branch_names'
;;
(finish)
_arguments \
-F'[Fetch from origin before performing finish]' \
-s'[Sign the release tag cryptographically]'\
-u'[Use the given GPG-key for the digital signature (implies -s)]'\
-m'[Use the given tag message]'\
-p'[Push to $ORIGIN after performing finish]'\
-k'[Keep branch after performing finish]'\
-n"[Don't tag this release]"\
':hotfix:__git_flow_hotfix_list'
;;
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
}
__git-flow-feature ()
{
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(
'start:Start a new feature branch.'
'finish:Finish a feature branch.'
'list:List all your feature branches. (Alias to `git flow feature`)'
'publish: publish'
'track: track'
'diff: diff'
'rebase: rebase'
'checkout: checkout'
'pull: pull'
)
_describe -t commands 'git flow feature' subcommands
_arguments \
-v'[Verbose (more) output]'
;;
(options)
case $line[1] in
(start)
_arguments \
-F'[Fetch from origin before performing finish]'\
':feature:__git_flow_feature_list'\
':branch-name:__git_branch_names'
;;
(finish)
_arguments \
-F'[Fetch from origin before performing finish]' \
-r'[Rebase instead of merge]'\
-k'[Keep branch after performing finish]'\
':feature:__git_flow_feature_list'
;;
(publish)
_arguments \
':feature:__git_flow_feature_list'\
;;
(track)
_arguments \
':feature:__git_flow_feature_list'\
;;
(diff)
_arguments \
':branch:__git_flow_feature_list'\
;;
(rebase)
_arguments \
-i'[Do an interactive rebase]' \
':branch:__git_flow_feature_list'
;;
(checkout)
_arguments \
':branch:__git_flow_feature_list'\
;;
(pull)
_arguments \
':remote:__git_remotes'\
':branch:__git_flow_feature_list'
;;
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
}
__git_flow_version_list ()
{
local expl
declare -a versions
versions=(${${(f)"$(_call_program versions git flow release list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return
_wanted versions expl 'version' compadd $versions
}
__git_flow_feature_list ()
{
local expl
declare -a features
features=(${${(f)"$(_call_program features git flow feature list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return
_wanted features expl 'feature' compadd $features
}
__git_remotes () {
local expl gitdir remotes
gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null)
__git_command_successful || return
remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]})
__git_command_successful || return
# TODO: Should combine the two instead of either or.
if (( $#remotes > 0 )); then
_wanted remotes expl remote compadd $* - $remotes
else
_wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*"
fi
}
__git_flow_hotfix_list ()
{
local expl
declare -a hotfixes
hotfixes=(${${(f)"$(_call_program hotfixes git flow hotfix list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return
_wanted hotfixes expl 'hotfix' compadd $hotfixes
}
__git_branch_names () {
local expl
declare -a branch_names
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
__git_command_successful || return
_wanted branch-names expl branch-name compadd $* - $branch_names
}
__git_command_successful () {
if (( ${#pipestatus:#0} > 0 )); then
_message 'not a git repository'
return 1
fi
return 0
}
zstyle ':completion:*:*:git:*' user-commands flow:'description for foo'

@ -1,348 +0,0 @@
#!zsh
#
# Installation
# ------------
#
# To achieve git-hubflow completion nirvana:
#
# 0. Update your zsh's git-completion module to the newest verion.
# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD
#
# 1. Install this file. Either:
#
# a. Place it in your .zshrc:
#
# b. Or, copy it somewhere (e.g. ~/.git-hubflow-completion.zsh) and put the following line in
# your .zshrc:
#
# source ~/.git-hubflow-completion.zsh
#
# c. Or, use this file as a oh-my-zsh plugin.
#
_git-hf ()
{
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(
'init:Initialize a new git repo with support for the branching model.'
'feature:Manage your feature branches.'
'release:Manage your release branches.'
'hotfix:Manage your hotfix branches.'
'support:Manage your support branches.'
'update:Pull upstream changes down into your master and develop branches.'
'version:Shows version information.'
)
_describe -t commands 'git hf' subcommands
;;
(options)
case $line[1] in
(init)
_arguments \
-f'[Force setting of gitflow branches, even if already configured]'
;;
(version)
;;
(hotfix)
__git-hf-hotfix
;;
(release)
__git-hf-release
;;
(feature)
__git-hf-feature
;;
esac
;;
esac
}
__git-hf-release ()
{
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(
'start:Start a new release branch.'
'finish:Finish a release branch.'
'list:List all your release branches. (Alias to `git hf release`)'
'cancel:Cancel release'
'push:Push release to github'
'pull:Pull release from github'
'track:Track release'
)
_describe -t commands 'git hf release' subcommands
_arguments \
-v'[Verbose (more) output]'
;;
(options)
case $line[1] in
(start)
_arguments \
-F'[Fetch from origin before performing finish]'\
':version:__git_hf_version_list'
;;
(finish)
_arguments \
-F'[Fetch from origin before performing finish]' \
-s'[Sign the release tag cryptographically]'\
-u'[Use the given GPG-key for the digital signature (implies -s)]'\
-m'[Use the given tag message]'\
-p'[Push to $ORIGIN after performing finish]'\
-k'[Keep branch after performing finish]'\
-n"[Don't tag this release]"\
':version:__git_hf_version_list'
;;
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
}
__git-hf-hotfix ()
{
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(
'start:Start a new hotfix branch.'
'finish:Finish a hotfix branch.'
'list:List all your hotfix branches. (Alias to `git hf hotfix`)'
'publish:Publish the hotfix branch.'
'track:Track the hotfix branch.'
'pull:Pull the hotfix from github.'
'push:Push the hotfix to github.'
'cancel:Cancel the hotfix.'
)
_describe -t commands 'git hf hotfix' subcommands
_arguments \
-v'[Verbose (more) output]'
;;
(options)
case $line[1] in
(start)
_arguments \
-F'[Fetch from origin before performing finish]'\
':hotfix:__git_hf_version_list'\
':branch-name:__git_branch_names'
;;
(finish)
_arguments \
-F'[Fetch from origin before performing finish]' \
-s'[Sign the release tag cryptographically]'\
-u'[Use the given GPG-key for the digital signature (implies -s)]'\
-m'[Use the given tag message]'\
-p'[Push to $ORIGIN after performing finish]'\
-k'[Keep branch after performing finish]'\
-n"[Don't tag this release]"\
':hotfix:__git_hf_hotfix_list'
;;
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
}
__git-hf-feature ()
{
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(
'list:List all your feature branches. (Alias to `git hf feature`)'
'start:Start a new feature branch'
'finish:Finish a feature branch'
'submit:submit'
'track:track'
'diff:Diff'
'rebase:Rebase feature branch against develop'
'checkout:Checkout feature'
'pull:Pull feature branch from github'
'push:Push feature branch to github'
'cancel:Cancel feature'
)
_describe -t commands 'git hf feature' subcommands
_arguments \
-v'[Verbose (more) output]'
;;
(options)
case $line[1] in
(start)
_arguments \
-F'[Fetch from origin before performing finish]'\
':feature:__git_hf_feature_list'\
':branch-name:__git_branch_names'
;;
(finish)
_arguments \
-F'[Fetch from origin before performing finish]' \
-r'[Rebase instead of merge]'\
':feature:__git_hf_feature_list'
;;
(publish)
_arguments \
':feature:__git_hf_feature_list'\
;;
(track)
_arguments \
':feature:__git_hf_feature_list'\
;;
(diff)
_arguments \
':branch:__git_branch_names'\
;;
(rebase)
_arguments \
-i'[Do an interactive rebase]' \
':branch:__git_branch_names'
;;
(checkout)
_arguments \
':branch:__git_hf_feature_list'\
;;
(pull)
_arguments \
':remote:__git_remotes'\
':branch:__git_branch_names'
;;
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
}
__git_hf_version_list ()
{
local expl
declare -a versions
versions=(${${(f)"$(_call_program versions git hf release list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return
_wanted versions expl 'version' compadd $versions
}
__git_hf_feature_list ()
{
local expl
declare -a features
features=(${${(f)"$(_call_program features git hf feature list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return
_wanted features expl 'feature' compadd $features
}
__git_remotes () {
local expl gitdir remotes
gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null)
__git_command_successful || return
remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]})
__git_command_successful || return
# TODO: Should combine the two instead of either or.
if (( $#remotes > 0 )); then
_wanted remotes expl remote compadd $* - $remotes
else
_wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*"
fi
}
__git_hf_hotfix_list ()
{
local expl
declare -a hotfixes
hotfixes=(${${(f)"$(_call_program hotfixes git hf hotfix list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return
_wanted hotfixes expl 'hotfix' compadd $hotfixes
}
__git_branch_names () {
local expl
declare -a branch_names
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
__git_command_successful || return
_wanted branch-names expl branch-name compadd $* - $branch_names
}
__git_command_successful () {
if (( ${#pipestatus:#0} > 0 )); then
_message 'not a git repository'
return 1
fi
return 0
}
zstyle ':completion:*:*:git:*' user-commands flow:'description for foo'

@ -1,18 +0,0 @@
_git_remote_branch() {
ref=$(git symbolic-ref HEAD 2> /dev/null)
if [[ -n $ref ]]; then
if (( CURRENT == 2 )); then
# first arg: operation
compadd create publish rename delete track
elif (( CURRENT == 3 )); then
# second arg: remote branch name
compadd `git branch -r | grep -v HEAD | sed "s/.*\///" | sed "s/ //g"`
elif (( CURRENT == 4 )); then
# third arg: remote name
compadd `git remote`
fi
else;
_files
fi
}
compdef _git_remote_branch grb

@ -1,93 +0,0 @@
# Aliases
alias g='git'
compdef g=git
alias gst='git status'
compdef _git gst=git-status
alias gl='git pull'
compdef _git gl=git-pull
alias gup='git pull --rebase'
compdef _git gup=git-fetch
alias gp='git push'
compdef _git gp=git-push
alias gd='git diff'
gdv() { git diff -w "$@" | view - }
compdef _git gdv=git-diff
alias gc='git commit -v'
compdef _git gc=git-commit
alias gca='git commit -v -a'
compdef _git gca=git-commit
alias gco='git checkout'
compdef _git gco=git-checkout
alias gcm='git checkout master'
alias gr='git remote'
compdef _git gr=git-remote
alias grv='git remote -v'
compdef _git grv=git-remote
alias grmv='git remote rename'
compdef _git grmv=git-remote
alias grrm='git remote remove'
compdef _git grrm=git-remote
alias grset='git remote set-url'
compdef _git grset=git-remote
alias grup='git remote update'
compdef _git grset=git-remote
alias gb='git branch'
compdef _git gb=git-branch
alias gba='git branch -a'
compdef _git gba=git-branch
alias gcount='git shortlog -sn'
compdef gcount=git
alias gcl='git config --list'
alias gcp='git cherry-pick'
compdef _git gcp=git-cherry-pick
alias glg='git log --stat --max-count=5'
compdef _git glg=git-log
alias glgg='git log --graph --max-count=5'
compdef _git glgg=git-log
alias glgga='git log --graph --decorate --all'
compdef _git glgga=git-log
alias gss='git status -s'
compdef _git gss=git-status
alias 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'
alias gwc='git whatchanged -p --abbrev-commit --pretty=medium'
alias gf='git ls-files | grep'
alias gpoat='git push origin --all && git push origin --tags'
# Will cd into the top of the current repository
# or submodule.
alias grt='cd $(git rev-parse --show-toplevel || echo ".")'
# Git and svn mix
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
compdef git-svn-dcommit-push=git
alias gsr='git svn rebase'
alias gsd='git svn dcommit'
#
# Will return the current branch name
# Usage example: git pull origin $(current_branch)
#
function current_branch() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
echo ${ref#refs/heads/}
}
function current_repository() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
echo $(git remote -v | cut -d':' -f 2)
}
# these aliases take advantage of the previous function
alias ggpull='git pull origin $(current_branch)'
compdef ggpull=git
alias ggpush='git push origin $(current_branch)'
compdef ggpush=git
alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)'
compdef ggpnp=git

@ -1,78 +0,0 @@
#compdef git gitk
# zsh completion wrapper for git
#
# You need git's bash completion script installed somewhere, by default on the
# same directory as this script.
#
# If your script is on ~/.git-completion.sh instead, you can configure it on
# your ~/.zshrc:
#
# zstyle ':completion:*:*:git:*' script ~/.git-completion.sh
#
# The recommended way to install this script is to copy to
# '~/.zsh/completion/_git', and then add the following to your ~/.zshrc file:
#
# fpath=(~/.zsh/completion $fpath)
complete ()
{
# do nothing
return 0
}
zstyle -s ":completion:*:*:git:*" script script
test -z "$script" && script="$(dirname ${funcsourcetrace[1]%:*})"/git-completion.bash
ZSH_VERSION='' . "$script"
__gitcomp ()
{
emulate -L zsh
local cur_="${3-$cur}"
case "$cur_" in
--*=)
;;
*)
local c IFS=$' \t\n'
local -a array
for c in ${=1}; do
c="$c${4-}"
case $c in
--*=*|*.) ;;
*) c="$c " ;;
esac
array+=("$c")
done
compset -P '*[=:]'
compadd -Q -S '' -p "${2-}" -a -- array && _ret=0
;;
esac
}
__gitcomp_nl ()
{
emulate -L zsh
local IFS=$'\n'
compset -P '*[=:]'
compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
}
_git ()
{
local _ret=1
() {
emulate -L ksh
local cur cword prev
cur=${words[CURRENT-1]}
prev=${words[CURRENT-2]}
let cword=CURRENT-1
__${service}_main
}
let _ret && _default -S '' && _ret=0
return _ret
}
_git

File diff suppressed because it is too large Load Diff

@ -1,290 +0,0 @@
# bash/zsh git prompt support
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Distributed under the GNU General Public License, version 2.0.
#
# This script allows you to see the current branch in your prompt.
#
# To enable:
#
# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh).
# 2) Add the following line to your .bashrc/.zshrc:
# source ~/.git-prompt.sh
# 3) Change your PS1 to also show the current branch:
# Bash: PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
# ZSH: PS1='[%n@%m %c$(__git_ps1 " (%s)")]\$ '
#
# The argument to __git_ps1 will be displayed only if you are currently
# in a git repository. The %s token will be the name of the current
# branch.
#
# In addition, if you set GIT_PS1_SHOWDIRTYSTATE to a nonempty value,
# unstaged (*) and staged (+) changes will be shown next to the branch
# name. You can configure this per-repository with the
# bash.showDirtyState variable, which defaults to true once
# GIT_PS1_SHOWDIRTYSTATE is enabled.
#
# You can also see if currently something is stashed, by setting
# GIT_PS1_SHOWSTASHSTATE to a nonempty value. If something is stashed,
# then a '$' will be shown next to the branch name.
#
# If you would like to see if there're untracked files, then you can set
# GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're untracked
# files, then a '%' will be shown next to the branch name.
#
# If you would like to see the difference between HEAD and its upstream,
# set GIT_PS1_SHOWUPSTREAM="auto". A "<" indicates you are behind, ">"
# indicates you are ahead, "<>" indicates you have diverged and "="
# indicates that there is no difference. You can further control
# behaviour by setting GIT_PS1_SHOWUPSTREAM to a space-separated list
# of values:
#
# verbose show number of commits ahead/behind (+/-) upstream
# legacy don't use the '--count' option available in recent
# versions of git-rev-list
# git always compare HEAD to @{upstream}
# svn always compare HEAD to your SVN upstream
#
# By default, __git_ps1 will compare HEAD to your SVN upstream if it can
# find one, or @{upstream} otherwise. Once you have set
# GIT_PS1_SHOWUPSTREAM, you can override it on a per-repository basis by
# setting the bash.showUpstream config variable.
# __gitdir accepts 0 or 1 arguments (i.e., location)
# returns location of .git repo
__gitdir ()
{
# Note: this function is duplicated in git-completion.bash
# When updating it, make sure you update the other one to match.
if [ -z "${1-}" ]; then
if [ -n "${__git_dir-}" ]; then
echo "$__git_dir"
elif [ -n "${GIT_DIR-}" ]; then
test -d "${GIT_DIR-}" || return 1
echo "$GIT_DIR"
elif [ -d .git ]; then
echo .git
else
git rev-parse --git-dir 2>/dev/null
fi
elif [ -d "$1/.git" ]; then
echo "$1/.git"
else
echo "$1"
fi
}
# stores the divergence from upstream in $p
# used by GIT_PS1_SHOWUPSTREAM
__git_ps1_show_upstream ()
{
local key value
local svn_remote svn_url_pattern count n
local upstream=git legacy="" verbose=""
svn_remote=()
# get some config options from git-config
local output="$(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')"
while read -r key value; do
case "$key" in
bash.showupstream)
GIT_PS1_SHOWUPSTREAM="$value"
if [[ -z "${GIT_PS1_SHOWUPSTREAM}" ]]; then
p=""
return
fi
;;
svn-remote.*.url)
svn_remote[ $((${#svn_remote[@]} + 1)) ]="$value"
svn_url_pattern+="\\|$value"
upstream=svn+git # default upstream is SVN if available, else git
;;
esac
done <<< "$output"
# parse configuration values
for option in ${GIT_PS1_SHOWUPSTREAM}; do
case "$option" in
git|svn) upstream="$option" ;;
verbose) verbose=1 ;;
legacy) legacy=1 ;;
esac
done
# Find our upstream
case "$upstream" in
git) upstream="@{upstream}" ;;
svn*)
# get the upstream from the "git-svn-id: ..." in a commit message
# (git-svn uses essentially the same procedure internally)
local svn_upstream=($(git log --first-parent -1 \
--grep="^git-svn-id: \(${svn_url_pattern#??}\)" 2>/dev/null))
if [[ 0 -ne ${#svn_upstream[@]} ]]; then
svn_upstream=${svn_upstream[ ${#svn_upstream[@]} - 2 ]}
svn_upstream=${svn_upstream%@*}
local n_stop="${#svn_remote[@]}"
for ((n=1; n <= n_stop; n++)); do
svn_upstream=${svn_upstream#${svn_remote[$n]}}
done
if [[ -z "$svn_upstream" ]]; then
# default branch name for checkouts with no layout:
upstream=${GIT_SVN_ID:-git-svn}
else
upstream=${svn_upstream#/}
fi
elif [[ "svn+git" = "$upstream" ]]; then
upstream="@{upstream}"
fi
;;
esac
# Find how many commits we are ahead/behind our upstream
if [[ -z "$legacy" ]]; then
count="$(git rev-list --count --left-right \
"$upstream"...HEAD 2>/dev/null)"
else
# produce equivalent output to --count for older versions of git
local commits
if commits="$(git rev-list --left-right "$upstream"...HEAD 2>/dev/null)"
then
local commit behind=0 ahead=0
for commit in $commits
do
case "$commit" in
"<"*) ((behind++)) ;;
*) ((ahead++)) ;;
esac
done
count="$behind $ahead"
else
count=""
fi
fi
# calculate the result
if [[ -z "$verbose" ]]; then
case "$count" in
"") # no upstream
p="" ;;
"0 0") # equal to upstream
p="=" ;;
"0 "*) # ahead of upstream
p=">" ;;
*" 0") # behind upstream
p="<" ;;
*) # diverged from upstream
p="<>" ;;
esac
else
case "$count" in
"") # no upstream
p="" ;;
"0 0") # equal to upstream
p=" u=" ;;
"0 "*) # ahead of upstream
p=" u+${count#0 }" ;;
*" 0") # behind upstream
p=" u-${count% 0}" ;;
*) # diverged from upstream
p=" u+${count#* }-${count% *}" ;;
esac
fi
}
# __git_ps1 accepts 0 or 1 arguments (i.e., format string)
# returns text to add to bash PS1 prompt (includes branch name)
__git_ps1 ()
{
local g="$(__gitdir)"
if [ -n "$g" ]; then
local r=""
local b=""
if [ -f "$g/rebase-merge/interactive" ]; then
r="|REBASE-i"
b="$(cat "$g/rebase-merge/head-name")"
elif [ -d "$g/rebase-merge" ]; then
r="|REBASE-m"
b="$(cat "$g/rebase-merge/head-name")"
else
if [ -d "$g/rebase-apply" ]; then
if [ -f "$g/rebase-apply/rebasing" ]; then
r="|REBASE"
elif [ -f "$g/rebase-apply/applying" ]; then
r="|AM"
else
r="|AM/REBASE"
fi
elif [ -f "$g/MERGE_HEAD" ]; then
r="|MERGING"
elif [ -f "$g/CHERRY_PICK_HEAD" ]; then
r="|CHERRY-PICKING"
elif [ -f "$g/BISECT_LOG" ]; then
r="|BISECTING"
fi
b="$(git symbolic-ref HEAD 2>/dev/null)" || {
b="$(
case "${GIT_PS1_DESCRIBE_STYLE-}" in
(contains)
git describe --contains HEAD ;;
(branch)
git describe --contains --all HEAD ;;
(describe)
git describe HEAD ;;
(* | default)
git describe --tags --exact-match HEAD ;;
esac 2>/dev/null)" ||
b="$(cut -c1-7 "$g/HEAD" 2>/dev/null)..." ||
b="unknown"
b="($b)"
}
fi
local w=""
local i=""
local s=""
local u=""
local c=""
local p=""
if [ "true" = "$(git rev-parse --is-inside-git-dir 2>/dev/null)" ]; then
if [ "true" = "$(git rev-parse --is-bare-repository 2>/dev/null)" ]; then
c="BARE:"
else
b="GIT_DIR!"
fi
elif [ "true" = "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]; then
if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ]; then
if [ "$(git config --bool bash.showDirtyState)" != "false" ]; then
git diff --no-ext-diff --quiet --exit-code || w="*"
if git rev-parse --quiet --verify HEAD >/dev/null; then
git diff-index --cached --quiet HEAD -- || i="+"
else
i="#"
fi
fi
fi
if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ]; then
git rev-parse --verify refs/stash >/dev/null 2>&1 && s="$"
fi
if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ]; then
if [ -n "$(git ls-files --others --exclude-standard)" ]; then
u="%"
fi
fi
if [ -n "${GIT_PS1_SHOWUPSTREAM-}" ]; then
__git_ps1_show_upstream
fi
fi
local f="$w$i$s$u"
printf -- "${1:- (%s)}" "$c${b##refs/heads/}${f:+ $f}$r$p"
fi
}

@ -1,7 +0,0 @@
dir=$(dirname $0)
source $dir/../git/git.plugin.zsh
source $dir/git-prompt.sh
function git_prompt_info() {
__git_ps1 "${ZSH_THEME_GIT_PROMPT_PREFIX//\%/%%}%s${ZSH_THEME_GIT_PROMPT_SUFFIX//\%/%%}"
}

@ -1,40 +0,0 @@
#compdef github
#autoload
# in order to make this work, you will need to have the github gem installed
# http://github.com/defunkt/github-gem
# github zsh completion, based on homebrew completion
local -a _1st_arguments
_1st_arguments=(
'browse:Open this repo in a web browser'
'clone:Clone a repo'
'config:Automatically set configuration info, or pass args to specify'
'create-from-local:Create a new GitHub repository from the current local repository'
'create:Create a new empty GitHub repository'
'fetch:Fetch from a remote to a local branch'
'fetch_all:Fetch all refs from a user'
'fork:Forks a GitHub repository'
'home:Open this repos master branch in a web browser'
'ignore:Ignore a SHA from github network commits'
'info:Info about this project'
'issues:Project issues tools'
'network:Project network tools - sub-commands : web [user], list, fetch, commits'
'open:Open the given user/project in a web browser'
'pull-request:Generate the text for a pull request'
'pull:Pull from a remote'
'search:Search GitHub for the given repository name'
'track:Track another users repository'
)
local expl
local -a pkgs installed_pkgs
_arguments \
'*:: :->subcmds' && return 0
if (( CURRENT == 1 )); then
_describe -t commands "github subcommand" _1st_arguments
return
fi

@ -1,71 +0,0 @@
# Setup hub function for git, if it is available; http://github.com/defunkt/hub
if [ "$commands[(I)hub]" ] && [ "$commands[(I)ruby]" ]; then
# eval `hub alias -s zsh`
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
# 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 )
repo=$1
git remote add origin git@github.com:${ghuser}/${repo}.git
git push -u origin master
}
# End Functions #############################################################

@ -1,80 +0,0 @@
# ------------------------------------------------------------------------------
# FILE: gnu-utils.plugin.zsh
# DESCRIPTION: oh-my-zsh plugin file.
# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com)
# VERSION: 1.0.0
# ------------------------------------------------------------------------------
if [[ -x "${commands[gwhoami]}" ]]; then
__gnu_utils() {
emulate -L zsh
local gcmds
local gcmd
local cmd
local prefix
# coreutils
gcmds=('g[' 'gbase64' 'gbasename' 'gcat' 'gchcon' 'gchgrp' 'gchmod'
'gchown' 'gchroot' 'gcksum' 'gcomm' 'gcp' 'gcsplit' 'gcut' 'gdate'
'gdd' 'gdf' 'gdir' 'gdircolors' 'gdirname' 'gdu' 'gecho' 'genv' 'gexpand'
'gexpr' 'gfactor' 'gfalse' 'gfmt' 'gfold' 'ggroups' 'ghead' 'ghostid'
'gid' 'ginstall' 'gjoin' 'gkill' 'glink' 'gln' 'glogname' 'gls' 'gmd5sum'
'gmkdir' 'gmkfifo' 'gmknod' 'gmktemp' 'gmv' 'gnice' 'gnl' 'gnohup' 'gnproc'
'god' 'gpaste' 'gpathchk' 'gpinky' 'gpr' 'gprintenv' 'gprintf' 'gptx' 'gpwd'
'greadlink' 'grm' 'grmdir' 'gruncon' 'gseq' 'gsha1sum' 'gsha224sum'
'gsha256sum' 'gsha384sum' 'gsha512sum' 'gshred' 'gshuf' 'gsleep' 'gsort'
'gsplit' 'gstat' 'gstty' 'gsum' 'gsync' 'gtac' 'gtail' 'gtee' 'gtest'
'gtimeout' 'gtouch' 'gtr' 'gtrue' 'gtruncate' 'gtsort' 'gtty' 'guname'
'gunexpand' 'guniq' 'gunlink' 'guptime' 'gusers' 'gvdir' 'gwc' 'gwho'
'gwhoami' 'gyes')
# Not part of coreutils, installed separately.
gcmds+=('gsed' 'gtar' 'gtime')
for gcmd in "${gcmds[@]}"; do
#
# This method allows for builtin commands to be primary but it's
# lost if hash -r or rehash -f is executed. Thus, those two
# functions have to be wrapped.
#
(( ${+commands[$gcmd]} )) && hash ${gcmd[2,-1]}=${commands[$gcmd]}
#
# This method generates wrapper functions.
# It will override shell builtins.
#
# (( ${+commands[$gcmd]} )) && \
# eval "function $gcmd[2,-1]() { \"${prefix}/${gcmd//"["/"\\["}\" \"\$@\"; }"
#
# This method is inflexible since the aliases are at risk of being
# overriden resulting in the BSD coreutils being called.
#
# (( ${+commands[$gcmd]} )) && \
# alias "$gcmd[2,-1]"="${prefix}/${gcmd//"["/"\\["}"
done
return 0
}
__gnu_utils;
function hash() {
if [[ "$*" =~ "-(r|f)" ]]; then
builtin hash "$@"
__gnu_utils
else
builtin hash "$@"
fi
}
function rehash() {
if [[ "$*" =~ "-f" ]]; then
builtin rehash "$@"
__gnu_utils
else
builtin rehash "$@"
fi
}
fi

@ -1,26 +0,0 @@
# Based on ssh-agent code
local GPG_ENV=$HOME/.gnupg/gpg-agent.env
function start_agent {
/usr/bin/env gpg-agent --daemon --enable-ssh-support --write-env-file ${GPG_ENV} > /dev/null
chmod 600 ${GPG_ENV}
. ${GPG_ENV} > /dev/null
}
# Source GPG agent settings, if applicable
if [ -f "${GPG_ENV}" ]; then
. ${GPG_ENV} > /dev/null
ps -ef | grep ${SSH_AGENT_PID} | grep gpg-agent > /dev/null || {
start_agent;
}
else
start_agent;
fi
export GPG_AGENT_INFO
export SSH_AUTH_SOCK
export SSH_AGENT_PID
GPG_TTY=$(tty)
export GPG_TTY

@ -1,119 +0,0 @@
#!zsh
##############################################################################
# A descriptive listing of core Gradle commands
############################################################################
function _gradle_core_commands() {
local ret=1 state
_arguments ':subcommand:->subcommand' && ret=0
case $state in
subcommand)
subcommands=(
"properties:Display all project properties"
"tasks:Calculate and display all tasks"
"dependencies:Calculate and display all dependencies"
"projects:Discover and display all sub-projects"
"build:Build the project"
"help:Display help"
)
_describe -t subcommands 'gradle subcommands' subcommands && ret=0
esac
return ret
}
function _gradle_arguments() {
_arguments -C \
'-a[Do not rebuild project dependencies]' \
'-h[Help]' \
'-D[System property]' \
'-d[Log at the debug level]' \
'--gui[Launches the Gradle GUI app]' \
'--stop[Stop the Gradle daemon]' \
'--daemon[Use the Gradle daemon]' \
'--no-daemon[Do not use the Gradle daemon]' \
'--no-opt[Do not perform any task optimization]' \
'-i[Log at the info level]' \
'-m[Dry run]' \
'-P[Set a project property]' \
'--profile[Profile the build time]' \
'-q[Log at the quiet level (only show errors)]' \
'-v[Print the Gradle version info]' \
'-x[Specify a task to be excluded]' \
'*::command:->command' \
&& return 0
}
##############################################################################
# Are we in a directory containing a build.gradle file?
############################################################################
function in_gradle() {
if [[ -f build.gradle ]]; then
echo 1
fi
}
############################################################################
# Define the stat_cmd command based on platform behavior
##########################################################################
stat -f%m . > /dev/null 2>&1
if [ "$?" = 0 ]; then
stat_cmd=(stat -f%m)
else
stat_cmd=(stat -L --format=%Y)
fi
############################################################################## Examine the build.gradle file to see if its
# timestamp has changed, and if so, regen
# the .gradle_tasks cache file
############################################################################
_gradle_does_task_list_need_generating () {
if [ ! -f .gradletasknamecache ]; then return 0;
else
accurate=$($stat_cmd .gradletasknamecache)
changed=$($stat_cmd build.gradle)
return $(expr $accurate '>=' $changed)
fi
}
##############################################################################
# Discover the gradle tasks by running "gradle tasks --all"
############################################################################
_gradle_tasks () {
if [ in_gradle ]; then
_gradle_arguments
if _gradle_does_task_list_need_generating; then
gradle tasks --all | grep "^[ ]*[a-zA-Z0-9]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache
fi
compadd -X "==== Gradle Tasks ====" `cat .gradletasknamecache`
fi
}
_gradlew_tasks () {
if [ in_gradle ]; then
_gradle_arguments
if _gradle_does_task_list_need_generating; then
gradlew tasks --all | grep "^[ ]*[a-zA-Z0-9]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache
fi
compadd -X "==== Gradlew Tasks ====" `cat .gradletasknamecache`
fi
}
##############################################################################
# Register the completions against the gradle and gradlew commands
############################################################################
compdef _gradle_tasks gradle
compdef _gradlew_tasks gradlew
##############################################################################
# Open questions for future improvements:
# 1) Should 'gradle tasks' use --all or just the regular set?
# 2) Should gradlew use the same approach as gradle?
# 3) Should only the " - " be replaced with a colon so it can work
# with the richer descriptive method of _arguments?
# gradle tasks | grep "^[a-zA-Z0-9]*\ -\ " | sed "s/ - /\:/"
#############################################################################

@ -1,54 +0,0 @@
_enumerateGrailsScripts() {
# Default directoryies
directories=($GRAILS_HOME/scripts ~/.grails/scripts ./scripts)
# Check all of the plugins directories, if they exist
if [ -d plugins ]
then
directories+=(plugins/*/scripts)
fi
# Enumerate all of the Groovy files
files=()
for dir in $directories;
do
if [ -d $dir ]
then
files+=($dir/[^_]*.groovy)
fi
done
# Don't try to basename ()
if [ ${#files} -eq 0 ];
then
return
fi
# - Strip the path
# - Remove all scripts with a leading '_'
# - PackagePlugin_.groovy -> PackagePlugin
# - PackagePlugin -> Package-Plugin
# - Package-Plugin -> package-plugin
basename $files \
| sed -E -e 's/^_?([^_]+)_?.groovy/\1/'\
-e 's/([a-z])([A-Z])/\1-\2/g' \
| tr "[:upper:]" "[:lower:]" \
| sort \
| uniq
}
_grails() {
if (( CURRENT == 2 )); then
scripts=( $(_enumerateGrailsScripts) )
if [ ${#scripts} -ne 0 ];
then
_multi_parts / scripts
return
fi
fi
_files
}
compdef _grails grails

@ -1,159 +0,0 @@
#compdef heroku
# Heroku Autocomplete plugin for Oh-My-Zsh
# Requires: The Heroku client gem (https://github.com/heroku/heroku)
# Author: Ali B. (http://awhitebox.com)
local -a _1st_arguments
_1st_arguments=(
"account\:confirm_billing":"Confirm that your account can be billed at the end of the month"
"addons":"list installed addons"
"addons\:list":"list all available addons"
"addons\:add":"install an addon"
"addons\:upgrade":"upgrade an existing addon"
"addons\:downgrade":"downgrade an existing addon"
"addons\:remove":"uninstall an addon"
"addons\:open":"open an addon's dashboard in your browser"
"apps":"list your apps"
"apps\:info":"show detailed app information"
"apps\:create":"create a new app"
"apps\:rename":"rename the app"
"apps\:open":"open the app in a web browser"
"apps\:destroy":"permanently destroy an app"
"auth\:login":"log in with your heroku credentials"
"auth\:logout":"clear local authentication credentials"
"config":"display the config vars for an app"
"config\:add":"add one or more config vars"
"config\:remove":"remove a config var"
"db\:push":"push local data up to your app"
"db\:pull":"pull heroku data down into your local database"
"domains":"list custom domains for an app"
"domains\:add":"add a custom domain to an app"
"domains\:remove":"remove a custom domain from an app"
"domains\:clear":"remove all custom domains from an app"
"help":"list available commands or display help for a specific command"
"keys":"display keys for the current user"
"keys\:add":"add a key for the current user"
"keys\:remove":"remove a key from the current user"
"keys\:clear":"remove all authentication keys from the current user"
"logs":"display recent log output"
"logs\:cron":"DEPRECATED: display cron logs from legacy logging"
"logs\:drains":"manage syslog drains"
"maintenance\:on":"put the app into maintenance mode"
"maintenance\:off":"take the app out of maintenance mode"
"pg\:info":"display database information"
"pg\:ingress":"allow direct connections to the database from this IP for one minute"
"pg\:promote":"sets DATABASE as your DATABASE_URL"
"pg\:psql":"open a psql shell to the database"
"pg\:reset":"delete all data in DATABASE"
"pg\:unfollow":"stop a replica from following and make it a read/write database"
"pg\:wait":"monitor database creation, exit when complete"
"pgbackups":"list captured backups"
"pgbackups\:url":"get a temporary URL for a backup"
"pgbackups\:capture":"capture a backup from a database id"
"pgbackups\:restore":"restore a backup to a database"
"pgbackups\:destroy":"destroys a backup"
"plugins":"list installed plugins"
"plugins\:install":"install a plugin"
"plugins\:uninstall":"uninstall a plugin"
"ps\:dynos":"scale to QTY web processes"
"ps\:workers":"scale to QTY background processes"
"ps":"list processes for an app"
"ps\:restart":"restart an app process"
"ps\:scale":"scale processes by the given amount"
"releases":"list releases"
"releases\:info":"view detailed information for a release"
"rollback":"roll back to an older release"
"run":"run an attached process"
"run\:rake":"remotely execute a rake command"
"run\:console":"open a remote console session"
"sharing":"list collaborators on an app"
"sharing\:add":"add a collaborator to an app"
"sharing\:remove":"remove a collaborator from an app"
"sharing\:transfer":"transfer an app to a new owner"
"ssl":"list certificates for an app"
"ssl\:add":"add an ssl certificate to an app"
"ssl\:remove":"remove an ssl certificate from an app"
"ssl\:clear":"remove all ssl certificates from an app"
"stack":"show the list of available stacks"
"stack\:migrate":"prepare migration of this app to a new stack"
"version":"show heroku client version"
)
_arguments '*:: :->command'
if (( CURRENT == 1 )); then
_describe -t commands "heroku command" _1st_arguments
return
fi
local -a _command_args
case "$words[1]" in
apps:info)
_command_args=(
'(-r|--raw)'{-r,--raw}'[output info as raw key/value pairs]' \
)
;;
apps:create)
_command_args=(
'(-a|--addons)'{-a,--addons}'[a list of addons to install]' \
'(-r|--remote)'{-r,--remote}'[the git remote to create, default "heroku"]' \
'(-s|--stack)'{-s,--stack}'[the stack on which to create the app]' \
)
;;
config)
_command_args=(
'(-s|--shell)'{-s,--shell}'[output config vars in shell format]' \
)
;;
db:push)
_command_args=(
'(-c|--chunksize)'{-c,--chunksize}'[specify the number of rows to send in each batch]' \
'(-d|--debug)'{-d,--debug}'[enable debugging output]' \
'(-e|--exclude)'{-e,--exclude}'[exclude the specified tables from the push]' \
'(-f|--filter)'{-f,--filter}'[only push certain tables]' \
'(-r|--resume)'{-r,--resume}'[resume transfer described by a .dat file]' \
'(-t|--tables)'{-t,--tables}'[only push the specified tables]' \
)
;;
db:pull)
_command_args=(
'(-c|--chunksize)'{-c,--chunksize}'[specify the number of rows to send in each batch]' \
'(-d|--debug)'{-d,--debug}'[enable debugging output]' \
'(-e|--exclude)'{-e,--exclude}'[exclude the specified tables from the pull]' \
'(-f|--filter)'{-f,--filter}'[only pull certain tables]' \
'(-r|--resume)'{-r,--resume}'[resume transfer described by a .dat file]' \
'(-t|--tables)'{-t,--tables}'[only pull the specified tables]' \
)
;;
keys)
_command_args=(
'(-l|--long)'{-l,--long}'[display extended information for each key]' \
)
;;
logs)
_command_args=(
'(-n|--num)'{-n,--num}'[the number of lines to display]' \
'(-p|--ps)'{-p,--ps}'[only display logs from the given process]' \
'(-s|--source)'{-s,--source}'[only display logs from the given source]' \
'(-t|--tail)'{-t,--tail}'[continually stream logs]' \
)
;;
pgbackups:capture)
_command_args=(
'(-e|--expire)'{-e,--expire}'[if no slots are available to capture, delete the oldest backup to make room]' \
)
;;
stack)
_command_args=(
'(-a|--all)'{-a,--all}'[include deprecated stacks]' \
)
;;
esac
_arguments \
$_command_args \
'(--app)--app[the app name]' \
'(--remote)--remote[the remote name]' \
&& return 0

@ -1,7 +0,0 @@
To activate this script, load it into an interactive ZSH session:
% source history-substring-search.zsh
See the "history-substring-search.zsh" file for more information:
% sed -n '2,/^$/s/^#//p' history-substring-search.zsh | more

@ -1,12 +0,0 @@
# This file integrates the history-substring-search script into oh-my-zsh.
source "$ZSH/plugins/history-substring-search/history-substring-search.zsh"
if test "$CASE_SENSITIVE" = true; then
unset HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS
fi
if test "$DISABLE_COLOR" = true; then
unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
fi

@ -1,642 +0,0 @@
#!/usr/bin/env zsh
#
# This is a clean-room implementation of the Fish[1] shell's history search
# feature, where you can type in any part of any previously entered command
# and press the UP and DOWN arrow keys to cycle through the matching commands.
#
#-----------------------------------------------------------------------------
# Usage
#-----------------------------------------------------------------------------
#
# 1. Load this script into your interactive ZSH session:
#
# % source history-substring-search.zsh
#
# If you want to use the zsh-syntax-highlighting[6] script along with this
# script, then make sure that you load it *before* you load this script:
#
# % source zsh-syntax-highlighting.zsh
# % source history-substring-search.zsh
#
# 2. Type any part of any previous command and then:
#
# * Press the UP arrow key to select the nearest command that (1) contains
# your query and (2) is older than the current command in the command
# history.
#
# * Press the DOWN arrow key to select the nearest command that (1)
# contains your query and (2) is newer than the current command in the
# command history.
#
# * Press ^U (the Control and U keys simultaneously) to abort the search.
#
# 3. If a matching command spans more than one line of text, press the LEFT
# arrow key to move the cursor away from the end of the command, and then:
#
# * Press the UP arrow key to move the cursor to the line above. When the
# cursor reaches the first line of the command, pressing the UP arrow
# key again will cause this script to perform another search.
#
# * Press the DOWN arrow key to move the cursor to the line below. When
# the cursor reaches the last line of the command, pressing the DOWN
# arrow key again will cause this script to perform another search.
#
#-----------------------------------------------------------------------------
# Configuration
#-----------------------------------------------------------------------------
#
# This script defines the following global variables. You may override their
# default values only after having loaded this script into your ZSH session.
#
# * HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND is a global variable that defines
# how the query should be highlighted inside a matching command. Its default
# value causes this script to highlight using bold, white text on a magenta
# background. See the "Character Highlighting" section in the zshzle(1) man
# page to learn about the kinds of values you may assign to this variable.
#
# * HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND is a global variable that
# defines how the query should be highlighted when no commands in the
# history match it. Its default value causes this script to highlight using
# bold, white text on a red background. See the "Character Highlighting"
# section in the zshzle(1) man page to learn about the kinds of values you
# may assign to this variable.
#
# * HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS is a global variable that defines
# how the command history will be searched for your query. Its default value
# causes this script to perform a case-insensitive search. See the "Globbing
# Flags" section in the zshexpn(1) man page to learn about the kinds of
# values you may assign to this variable.
#
#-----------------------------------------------------------------------------
# History
#-----------------------------------------------------------------------------
#
# This script was originally written by Peter Stephenson[2], who published it
# to the ZSH users mailing list (thereby making it public domain) in September
# 2009. It was later revised by Guido van Steen and released under the BSD
# license (see below) as part of the fizsh[3] project in January 2011.
#
# It was later extracted from fizsh[3] release 1.0.1, refactored heavily, and
# repackaged as both an oh-my-zsh plugin[4] and as an independently loadable
# ZSH script[5] by Suraj N. Kurapati in 2011.
#
# It was further developed[4] by Guido van Steen, Suraj N. Kurapati, Sorin
# Ionescu, and Vincent Guerci in 2011.
#
# [1]: http://fishshell.com
# [2]: http://www.zsh.org/mla/users/2009/msg00818.html
# [3]: http://sourceforge.net/projects/fizsh/
# [4]: https://github.com/robbyrussell/oh-my-zsh/pull/215
# [5]: https://github.com/sunaku/zsh-history-substring-search
# [6]: https://github.com/nicoulaj/zsh-syntax-highlighting
#
##############################################################################
#
# Copyright (c) 2009 Peter Stephenson
# Copyright (c) 2011 Guido van Steen
# Copyright (c) 2011 Suraj N. Kurapati
# Copyright (c) 2011 Sorin Ionescu
# Copyright (c) 2011 Vincent Guerci
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# * Neither the name of the FIZSH nor the names of its contributors
# may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
##############################################################################
#-----------------------------------------------------------------------------
# configuration variables
#-----------------------------------------------------------------------------
HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold'
HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold'
HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i'
#-----------------------------------------------------------------------------
# the main ZLE widgets
#-----------------------------------------------------------------------------
function history-substring-search-up() {
_history-substring-search-begin
_history-substring-search-up-history ||
_history-substring-search-up-buffer ||
_history-substring-search-up-search
_history-substring-search-end
}
function history-substring-search-down() {
_history-substring-search-begin
_history-substring-search-down-history ||
_history-substring-search-down-buffer ||
_history-substring-search-down-search
_history-substring-search-end
}
zle -N history-substring-search-up
zle -N history-substring-search-down
bindkey '\e[A' history-substring-search-up
bindkey '\e[B' history-substring-search-down
#-----------------------------------------------------------------------------
# implementation details
#-----------------------------------------------------------------------------
setopt extendedglob
zmodload -F zsh/parameter
#
# We have to "override" some keys and widgets if the
# zsh-syntax-highlighting plugin has not been loaded:
#
# https://github.com/nicoulaj/zsh-syntax-highlighting
#
if [[ $+functions[_zsh_highlight] -eq 0 ]]; then
#
# Dummy implementation of _zsh_highlight()
# that simply removes existing highlights
#
function _zsh_highlight() {
region_highlight=()
}
#
# Remove existing highlights when the user
# inserts printable characters into $BUFFER
#
function ordinary-key-press() {
if [[ $KEYS == [[:print:]] ]]; then
region_highlight=()
fi
zle .self-insert
}
zle -N self-insert ordinary-key-press
#
# Override ZLE widgets to invoke _zsh_highlight()
#
# https://github.com/nicoulaj/zsh-syntax-highlighting/blob/
# bb7fcb79fad797a40077bebaf6f4e4a93c9d8163/zsh-syntax-highlighting.zsh#L121
#
#--------------8<-------------------8<-------------------8<-----------------
#
# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the name of the zsh-syntax-highlighting contributors nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Load ZSH module zsh/zleparameter, needed to override user defined widgets.
zmodload zsh/zleparameter 2>/dev/null || {
echo 'zsh-syntax-highlighting: failed loading zsh/zleparameter, exiting.' >&2
return -1
}
# Override ZLE widgets to make them invoke _zsh_highlight.
for event in ${${(f)"$(zle -la)"}:#(_*|orig-*|.run-help|.which-command)}; do
if [[ "$widgets[$event]" == completion:* ]]; then
eval "zle -C orig-$event ${${${widgets[$event]}#*:}/:/ } ; $event() { builtin zle orig-$event && _zsh_highlight } ; zle -N $event"
else
case $event in
accept-and-menu-complete)
eval "$event() { builtin zle .$event && _zsh_highlight } ; zle -N $event"
;;
# The following widgets should NOT remove any previously
# applied highlighting. Therefore we do not remap them.
.forward-char|.backward-char|.up-line-or-history|.down-line-or-history)
;;
.*)
clean_event=$event[2,${#event}] # Remove the leading dot in the event name
case ${widgets[$clean_event]-} in
(completion|user):*)
;;
*)
eval "$clean_event() { builtin zle $event && _zsh_highlight } ; zle -N $clean_event"
;;
esac
;;
*)
;;
esac
fi
done
unset event clean_event
#-------------->8------------------->8------------------->8-----------------
fi
function _history-substring-search-begin() {
_history_substring_search_move_cursor_eol=false
_history_substring_search_query_highlight=
#
# Continue using the previous $_history_substring_search_result by default,
# unless the current query was cleared or a new/different query was entered.
#
if [[ -z $BUFFER || $BUFFER != $_history_substring_search_result ]]; then
#
# For the purpose of highlighting we will also keep
# a version without doubly-escaped meta characters.
#
_history_substring_search_query=$BUFFER
#
# $BUFFER contains the text that is in the command-line currently.
# we put an extra "\\" before meta characters such as "\(" and "\)",
# so that they become "\\\(" and "\\\)".
#
_history_substring_search_query_escaped=${BUFFER//(#m)[\][()|\\*?#<>~^]/\\$MATCH}
#
# Find all occurrences of the search query in the history file.
#
# (k) turns it an array of line numbers.
#
# (on) seems to remove duplicates, which are default
# options. They can be turned off by (ON).
#
_history_substring_search_matches=(${(kon)history[(R)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)*${_history_substring_search_query_escaped}*]})
#
# Define the range of values that $_history_substring_search_match_index
# can take: [0, $_history_substring_search_matches_count_plus].
#
_history_substring_search_matches_count=$#_history_substring_search_matches
_history_substring_search_matches_count_plus=$(( _history_substring_search_matches_count + 1 ))
_history_substring_search_matches_count_sans=$(( _history_substring_search_matches_count - 1 ))
#
# If $_history_substring_search_match_index is equal to
# $_history_substring_search_matches_count_plus, this indicates that we
# are beyond the beginning of $_history_substring_search_matches.
#
# If $_history_substring_search_match_index is equal to 0, this indicates
# that we are beyond the end of $_history_substring_search_matches.
#
# If we have initially pressed "up" we have to initialize
# $_history_substring_search_match_index to
# $_history_substring_search_matches_count_plus so that it will be
# decreased to $_history_substring_search_matches_count.
#
# If we have initially pressed "down" we have to initialize
# $_history_substring_search_match_index to
# $_history_substring_search_matches_count so that it will be increased to
# $_history_substring_search_matches_count_plus.
#
if [[ $WIDGET == history-substring-search-down ]]; then
_history_substring_search_match_index=$_history_substring_search_matches_count
else
_history_substring_search_match_index=$_history_substring_search_matches_count_plus
fi
fi
}
function _history-substring-search-end() {
_history_substring_search_result=$BUFFER
# move the cursor to the end of the command line
if [[ $_history_substring_search_move_cursor_eol == true ]]; then
CURSOR=${#BUFFER}
fi
# highlight command line using zsh-syntax-highlighting
_zsh_highlight
# highlight the search query inside the command line
if [[ -n $_history_substring_search_query_highlight && -n $_history_substring_search_query ]]; then
#
# The following expression yields a variable $MBEGIN, which
# indicates the begin position + 1 of the first occurrence
# of _history_substring_search_query_escaped in $BUFFER.
#
: ${(S)BUFFER##(#m$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)($_history_substring_search_query##)}
local begin=$(( MBEGIN - 1 ))
local end=$(( begin + $#_history_substring_search_query ))
region_highlight+=("$begin $end $_history_substring_search_query_highlight")
fi
# For debugging purposes:
# zle -R "mn: "$_history_substring_search_match_index" m#: "${#_history_substring_search_matches}
# read -k -t 200 && zle -U $REPLY
# Exit successfully from the history-substring-search-* widgets.
true
}
function _history-substring-search-up-buffer() {
#
# Check if the UP arrow was pressed to move the cursor within a multi-line
# buffer. This amounts to three tests:
#
# 1. $#buflines -gt 1.
#
# 2. $CURSOR -ne $#BUFFER.
#
# 3. Check if we are on the first line of the current multi-line buffer.
# If so, pressing UP would amount to leaving the multi-line buffer.
#
# We check this by adding an extra "x" to $LBUFFER, which makes
# sure that xlbuflines is always equal to the number of lines
# until $CURSOR (including the line with the cursor on it).
#
local buflines XLBUFFER xlbuflines
buflines=(${(f)BUFFER})
XLBUFFER=$LBUFFER"x"
xlbuflines=(${(f)XLBUFFER})
if [[ $#buflines -gt 1 && $CURSOR -ne $#BUFFER && $#xlbuflines -ne 1 ]]; then
zle up-line-or-history
return true
fi
false
}
function _history-substring-search-down-buffer() {
#
# Check if the DOWN arrow was pressed to move the cursor within a multi-line
# buffer. This amounts to three tests:
#
# 1. $#buflines -gt 1.
#
# 2. $CURSOR -ne $#BUFFER.
#
# 3. Check if we are on the last line of the current multi-line buffer.
# If so, pressing DOWN would amount to leaving the multi-line buffer.
#
# We check this by adding an extra "x" to $RBUFFER, which makes
# sure that xrbuflines is always equal to the number of lines
# from $CURSOR (including the line with the cursor on it).
#
local buflines XRBUFFER xrbuflines
buflines=(${(f)BUFFER})
XRBUFFER="x"$RBUFFER
xrbuflines=(${(f)XRBUFFER})
if [[ $#buflines -gt 1 && $CURSOR -ne $#BUFFER && $#xrbuflines -ne 1 ]]; then
zle down-line-or-history
return true
fi
false
}
function _history-substring-search-up-history() {
#
# Behave like up in ZSH, except clear the $BUFFER
# when beginning of history is reached like in Fish.
#
if [[ -z $_history_substring_search_query ]]; then
# we have reached the absolute top of history
if [[ $HISTNO -eq 1 ]]; then
BUFFER=
# going up from somewhere below the top of history
else
zle up-history
fi
return true
fi
false
}
function _history-substring-search-down-history() {
#
# Behave like down-history in ZSH, except clear the
# $BUFFER when end of history is reached like in Fish.
#
if [[ -z $_history_substring_search_query ]]; then
# going down from the absolute top of history
if [[ $HISTNO -eq 1 && -z $BUFFER ]]; then
BUFFER=${history[1]}
_history_substring_search_move_cursor_eol=true
# going down from somewhere above the bottom of history
else
zle down-history
fi
return true
fi
false
}
function _history-substring-search-up-search() {
_history_substring_search_move_cursor_eol=true
#
# Highlight matches during history-substring-up-search:
#
# The following constants have been initialized in
# _history-substring-search-up/down-search():
#
# $_history_substring_search_matches is the current list of matches
# $_history_substring_search_matches_count is the current number of matches
# $_history_substring_search_matches_count_plus is the current number of matches + 1
# $_history_substring_search_matches_count_sans is the current number of matches - 1
# $_history_substring_search_match_index is the index of the current match
#
# The range of values that $_history_substring_search_match_index can take
# is: [0, $_history_substring_search_matches_count_plus]. A value of 0
# indicates that we are beyond the end of
# $_history_substring_search_matches. A value of
# $_history_substring_search_matches_count_plus indicates that we are beyond
# the beginning of $_history_substring_search_matches.
#
# In _history-substring-search-up-search() the initial value of
# $_history_substring_search_match_index is
# $_history_substring_search_matches_count_plus. This value is set in
# _history-substring-search-begin(). _history-substring-search-up-search()
# will initially decrease it to $_history_substring_search_matches_count.
#
if [[ $_history_substring_search_match_index -ge 2 ]]; then
#
# Highlight the next match:
#
# 1. Decrease the value of $_history_substring_search_match_index.
#
# 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
# to highlight the current buffer.
#
(( _history_substring_search_match_index-- ))
BUFFER=$history[$_history_substring_search_matches[$_history_substring_search_match_index]]
_history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
elif [[ $_history_substring_search_match_index -eq 1 ]]; then
#
# We will move beyond the end of $_history_substring_search_matches:
#
# 1. Decrease the value of $_history_substring_search_match_index.
#
# 2. Save the current buffer in $_history_substring_search_old_buffer,
# so that it can be retrieved by
# _history-substring-search-down-search() later.
#
# 3. Make $BUFFER equal to $_history_substring_search_query.
#
# 4. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
# to highlight the current buffer.
#
(( _history_substring_search_match_index-- ))
_history_substring_search_old_buffer=$BUFFER
BUFFER=$_history_substring_search_query
_history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
elif [[ $_history_substring_search_match_index -eq $_history_substring_search_matches_count_plus ]]; then
#
# We were beyond the beginning of $_history_substring_search_matches but
# UP makes us move back to $_history_substring_search_matches:
#
# 1. Decrease the value of $_history_substring_search_match_index.
#
# 2. Restore $BUFFER from $_history_substring_search_old_buffer.
#
# 3. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
# to highlight the current buffer.
#
(( _history_substring_search_match_index-- ))
BUFFER=$_history_substring_search_old_buffer
_history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
fi
}
function _history-substring-search-down-search() {
_history_substring_search_move_cursor_eol=true
#
# Highlight matches during history-substring-up-search:
#
# The following constants have been initialized in
# _history-substring-search-up/down-search():
#
# $_history_substring_search_matches is the current list of matches
# $_history_substring_search_matches_count is the current number of matches
# $_history_substring_search_matches_count_plus is the current number of matches + 1
# $_history_substring_search_matches_count_sans is the current number of matches - 1
# $_history_substring_search_match_index is the index of the current match
#
# The range of values that $_history_substring_search_match_index can take
# is: [0, $_history_substring_search_matches_count_plus]. A value of 0
# indicates that we are beyond the end of
# $_history_substring_search_matches. A value of
# $_history_substring_search_matches_count_plus indicates that we are beyond
# the beginning of $_history_substring_search_matches.
#
# In _history-substring-search-down-search() the initial value of
# $_history_substring_search_match_index is
# $_history_substring_search_matches_count. This value is set in
# _history-substring-search-begin().
# _history-substring-search-down-search() will initially increase it to
# $_history_substring_search_matches_count_plus.
#
if [[ $_history_substring_search_match_index -le $_history_substring_search_matches_count_sans ]]; then
#
# Highlight the next match:
#
# 1. Increase $_history_substring_search_match_index by 1.
#
# 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
# to highlight the current buffer.
#
(( _history_substring_search_match_index++ ))
BUFFER=$history[$_history_substring_search_matches[$_history_substring_search_match_index]]
_history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
elif [[ $_history_substring_search_match_index -eq $_history_substring_search_matches_count ]]; then
#
# We will move beyond the beginning of $_history_substring_search_matches:
#
# 1. Increase $_history_substring_search_match_index by 1.
#
# 2. Save the current buffer in $_history_substring_search_old_buffer, so
# that it can be retrieved by _history-substring-search-up-search()
# later.
#
# 3. Make $BUFFER equal to $_history_substring_search_query.
#
# 4. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
# to highlight the current buffer.
#
(( _history_substring_search_match_index++ ))
_history_substring_search_old_buffer=$BUFFER
BUFFER=$_history_substring_search_query
_history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
elif [[ $_history_substring_search_match_index -eq 0 ]]; then
#
# We were beyond the end of $_history_substring_search_matches but DOWN
# makes us move back to the $_history_substring_search_matches:
#
# 1. Increase $_history_substring_search_match_index by 1.
#
# 2. Restore $BUFFER from $_history_substring_search_old_buffer.
#
# 3. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
# to highlight the current buffer.
#
(( _history_substring_search_match_index++ ))
BUFFER=$_history_substring_search_old_buffer
_history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
fi
}
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et

@ -1,8 +0,0 @@
alias h='history'
function hs
{
history | grep $*
}
alias hsi='hs -i'

@ -1,14 +0,0 @@
#---oh-my-zsh plugin : task Autocomplete for Jake tool---
# Jake : https://github.com/mde/jake
# Warning : Jakefile should have the right case : Jakefile or jakefile
# Tested on : MacOSX 10.7 (Lion), Ubuntu 11.10
# Author : Alexandre Lacheze (@al3xstrat)
# Inspiration : http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh
function _jake () {
if [ -f Jakefile ]||[ -f jakefile ]; then
compadd `jake -T | cut -d " " -f 2 | sed -E "s/.\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"`
fi
}
compdef _jake jake

@ -1,38 +0,0 @@
# To use: add a .jira-url file in the base of your project
# You can also set JIRA_URL in your .zshrc or put .jira-url in your home directory
# .jira-url in the current directory takes precedence
#
# If you use Rapid Board, set:
#JIRA_RAPID_BOARD="yes"
# in you .zshrc
#
# Setup: cd to/my/project
# echo "https://name.jira.com" >> .jira-url
# Usage: jira # opens a new issue
# jira ABC-123 # Opens an existing issue
open_jira_issue () {
if [ -f .jira-url ]; then
jira_url=$(cat .jira-url)
elif [ -f ~/.jira-url ]; then
jira_url=$(cat ~/.jira-url)
elif [[ "x$JIRA_URL" != "x" ]]; then
jira_url=$JIRA_URL
else
echo "JIRA url is not specified anywhere."
return 0
fi
if [ -z "$1" ]; then
echo "Opening new issue"
`open $jira_url/secure/CreateIssue!default.jspa`
else
echo "Opening issue #$1"
if [[ "x$JIRA_RAPID_BOARD" = "yes" ]]; then
`open $jira_url/issues/$1`
else
`open $jira_url/browse/$1`
fi
fi
}
alias jira='open_jira_issue'

@ -1,4 +0,0 @@
# Aliases
alias jrspec='jruby --debug -S rspec --debug'
alias jprofile='jruby --profile.api -S rspec'
alias jexec='jruby -S'

@ -1,9 +0,0 @@
# Kate
# Start kate always silent
alias kate='kate >/dev/null 2>&1'
function kt () {
cd $1
kate $1
}

@ -1,185 +0,0 @@
#compdef knife
# These flags should be available everywhere according to man knife
knife_general_flags=( --help --server-url --key --config --editor --format --log_level --logfile --no-editor --user --print-after --version --yes )
# knife has a very special syntax, some example calls are:
# knife status
# knife cookbook list
# knife role show ROLENAME
# knife data bag show DATABAGNAME
# knife role show ROLENAME --attribute ATTRIBUTENAME
# knife cookbook show COOKBOOKNAME COOKBOOKVERSION recipes
# The -Q switch in compadd allow for completions of things like "data bag" without having to go through two rounds of completion and avoids zsh inserting a \ for escaping spaces
_knife() {
local curcontext="$curcontext" state line
typeset -A opt_args
cloudproviders=(bluebox ec2 rackspace slicehost terremark)
_arguments \
'1: :->knifecmd'\
'2: :->knifesubcmd'\
'3: :->knifesubcmd2' \
'4: :->knifesubcmd3' \
'5: :->knifesubcmd4' \
'6: :->knifesubcmd5'
case $state in
knifecmd)
compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec environment index node recipe role search ssh status windows $cloudproviders
;;
knifesubcmd)
case $words[2] in
(bluebox|ec2|rackspace|slicehost|terremark)
compadd "$@" server images
;;
client)
compadd -Q "$@" "bulk delete" list create show delete edit reregister
;;
configure)
compadd "$@" client
;;
cookbook)
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)
compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete"
;;
recipe)
compadd "$@" list
;;
role)
compadd -Q "$@" "bulk delete" create delete edit "from file" list show
;;
windows)
compadd "$@" bootstrap
;;
*)
_arguments '2:Subsubcommands:($(_knife_options1))'
esac
;;
knifesubcmd2)
case $words[3] in
server)
compadd "$@" list create delete
;;
images)
compadd "$@" list
;;
site)
compadd "$@" vendor show share search download list unshare
;;
(show|delete|edit)
_arguments '3:Subsubcommands:($(_chef_$words[2]s_remote))'
;;
(upload|test)
_arguments '3:Subsubcommands:($(_chef_$words[2]s_local) --all)'
;;
list)
compadd -a "$@" knife_general_flags
;;
bag)
compadd -Q "$@" show edit list "from file" create delete
;;
*)
_arguments '3:Subsubcommands:($(_knife_options2))'
esac
;;
knifesubcmd3)
case $words[3] in
show)
case $words[2] in
cookbook)
versioncomp=1
_arguments '4:Cookbookversions:($(_cookbook_versions) latest)'
;;
(node|client|role)
compadd "$@" --attribute
esac
esac
case $words[4] in
(show|edit)
_arguments '4:Subsubsubcommands:($(_chef_$words[2]_$words[3]s_remote))'
;;
file)
_arguments '*:file or directory:_files -g "*.(rb|json)"'
;;
list)
compadd -a "$@" knife_general_flags
;;
*)
_arguments '*:Subsubcommands:($(_knife_options3))'
esac
;;
knifesubcmd4)
if (( versioncomp > 0 )); then
compadd "$@" attributes definitions files libraries providers recipes resources templates
else
_arguments '*:Subsubcommands:($(_knife_options2))'
fi
;;
knifesubcmd5)
_arguments '*:Subsubcommands:($(_knife_options3))'
esac
}
# Helper functions to provide the argument completion for several depths of commands
_knife_options1() {
( for line in $( knife $words[2] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done )
}
_knife_options2() {
( for line in $( knife $words[2] $words[3] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done )
}
_knife_options3() {
( for line in $( knife $words[2] $words[3] $words[4] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done )
}
# The chef_x_remote functions use knife to get a list of objects of type x on the server
_chef_roles_remote() {
(knife role list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
}
_chef_clients_remote() {
(knife client list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
}
_chef_nodes_remote() {
(knife node list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
}
_chef_cookbooks_remote() {
(knife cookbook list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
}
_chef_sitecookbooks_remote() {
(knife cookbook site list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
}
_chef_data_bags_remote() {
(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
_chef_cookbooks_local() {
local knife_rb="$HOME/.chef/knife.rb"
if [ -f ./.chef/knife.rb ]; then
knife_rb="./.chef/knife.rb"
fi
(for i in $( grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' ); do ls $i; done)
}
# This function extracts the available cookbook versions on the chef server
_cookbook_versions() {
(knife cookbook show $words[4] | grep -v $words[4] | grep -v -E '\]|\[|\{|\}' | sed 's/ //g' | sed 's/"//g')
}
_knife "$@"

@ -1,40 +0,0 @@
#compdef artisan
# Laravel autocompletion
# Author: John Hamelink <john@johnhamelink.com>
#
# This plugin does the following:
# - Adds aliases and autocompletion for artisan
# - Adds aliases and autocompletion for bob
local curcontext="$curcontext" state line _opts _bundles ret=1
_arguments -C \
'1: :->cmds' \
'*:: :->args' && ret=0
case $state in
cmds)
_values "Artisan command" \
'session\:install[Create a session table]' \
'migrate[Manage Migrations]' \
'test[Run a test]' \
'route\:\:call[Call a route in the CLI]' \
'key\:\:generate[Generate a key]'
ret=0
;;
args)
case $line[1] in
migrate)
_values \
'install[Create the Laravel migration table' \
'make[Create a migration]' \
'rollback[Roll back to the last migration operation]' \
'reset[Roll back all migrations that have ever run]'
ret=0
;;
esac
;;
esac
return ret

@ -1,3 +0,0 @@
#!zsh
alias artisan='php artisan'
alias bob='php artisan bob::build'

@ -1,24 +0,0 @@
#!/usr/bin/env zsh
# Keeps track of the last used working directory and automatically jumps
# into it for new shells.
# Flag indicating if we've previously jumped to last directory.
typeset -g ZSH_LAST_WORKING_DIRECTORY
mkdir -p "$ZSH/cache"
local cache_file="$ZSH/cache/last-working-dir"
# Updates the last directory once directory is changed.
function chpwd() {
echo "$PWD" > "$cache_file"
}
# Changes directory to the last working directory.
function lwd() {
[[ ! -r "$cache_file" ]] || cd `cat "$cache_file"`
}
# Automatically jump to last working directory unless this isn't the first time
# this plugin has been loaded.
if [[ -z "$ZSH_LAST_WORKING_DIRECTORY" ]]; then
lwd 2>/dev/null && ZSH_LAST_WORKING_DIRECTORY=1 || true
fi

@ -1,41 +0,0 @@
function _lein_commands() {
local ret=1 state
_arguments ':subcommand:->subcommand' && ret=0
case $state in
subcommand)
subcommands=(
"classpath:print the classpath of the current project"
"clean:remove compiled files and dependencies from project"
"compile:ahead-of-time compile the project"
"deploy:build jar and deploy to remote repository"
"deps:download and install all dependencies"
"help:display a list of tasks or help for a given task"
"install:install the project and its dependencies in your local repository"
"int:enter an interactive task shell"
"interactive:enter an interactive task shell"
"jack-in:jack in to a clojure slime session from emacs."
"jar:create a jar file containing the compiled .class files"
"javac:compile java source files"
"new:create a new project skeleton"
"plugin:manage user-level plugins"
"pom:write a pom.xml file to disk for maven interop"
"repl:start a repl session either with the current project or standalone"
"retest:run only the test namespaces which failed last time around"
"run:run the project's -main function"
"search:search remote maven repositories for matching jars"
"swank:launch swank server for Emacs to connect"
"test:run the project's tests"
"test!:run a project's tests after cleaning and fetching dependencies"
"trampoline:run a task without nesting the project's JVM inside Leiningen's."
"uberjar:Create a jar including the contents of each of deps"
"upgrade:upgrade leiningen to the latest stable release"
"version:print leiningen's version"
)
_describe -t subcommands 'leiningen subcommands' subcommands && ret=0
esac
return ret
}
compdef _lein_commands lein

@ -1,16 +0,0 @@
# To use: add a .lighthouse file into your directory with the URL to the
# individual project. For example:
# https://rails.lighthouseapp.com/projects/8994
# Example usage: http://screencast.com/t/ZDgwNDUwNT
open_lighthouse_ticket () {
if [ ! -f .lighthouse-url ]; then
echo "There is no .lighthouse-url file in the current directory..."
return 0;
else
lighthouse_url=$(cat .lighthouse-url);
echo "Opening ticket #$1";
`open $lighthouse_url/tickets/$1`;
fi
}
alias lho='open_lighthouse_ticket'

@ -1,38 +0,0 @@
# LOL!!1
# Source: http://aur.archlinux.org/packages/lolbash/lolbash/lolbash.sh
alias wtf='dmesg'
alias onoz='cat /var/log/errors.log'
alias rtfm='man'
alias :3='echo'
alias visible='echo'
alias invisible='cat'
alias moar='more'
alias tldr='less'
alias alwayz='tail -f'
alias icanhas='mkdir'
alias gimmeh='touch'
alias donotwant='rm'
alias dowant='cp'
alias gtfo='mv'
alias nowai='chmod'
alias hai='cd'
alias iz='ls'
alias plz='pwd'
alias ihasbucket='df -h'
alias inur='locate'
alias iminurbase='finger'
alias btw='nice'
alias obtw='nohup'
alias nomz='ps aux'
alias nomnom='killall'
alias byes='exit'
alias cya='reboot'
alias kthxbai='halt'

@ -1,89 +0,0 @@
#compdef port
local subcmds
# we cache the list of ports
# we shall use some cache policy to avoid problems with new ports
if (( ! $+portlist )); then
portlist=($(port echo all; echo "all current active inactive installed uninstalled outdated"))
fi
subcmds=(
'activate'
'archive'
'build'
'cat'
'clean'
'configure'
'contents'
'deactivate'
'dependents'
'deps'
'destroot'
'dir'
'distcheck'
'distclean'
'dmg'
'echo'
'edit'
'extract'
'fetch'
'file'
'help'
'info'
'install'
'installed'
'list'
'livecheck'
'location'
'mpkg'
'outdated'
'patch'
'pkg'
'provides'
'rpmpackage'
'search'
'selfupdate'
'sync'
'test'
'unarchive'
'uninstall'
'upgrade'
'variants'
'version'
)
_arguments -C \
'-v[verbose mode (generate verbose messages)]' \
'-d[debug mode (generate debugging messages)]' \
'-q[quiet mode (suppress messages)]' \
'-D[specify portdir]' \
'-k[keep mode (do not autoclean after install)]' \
'-n[dont follow dependencies in upgrade (only for upgrading)]' \
'-a[upgrade all installed ports (only for upgrading)]' \
'-u[uninstall non-active ports when upgrading and uninstalling]' \
'-f[force mode (ignore state file)]' \
'-s[source-only mode]' \
'-b[binary-only mode]' \
'-o[honor state files older than Portfile]' \
'*::command:->command' \
&& return 0
case $state in
command)
if ((CURRENT == 1)); then
state=subcommands
else
state=portname
fi
;;
esac
case $state in
subcommands)
_describe -t commands 'port commands' subcmds
;;
portname)
_describe -t commands 'available ports' portlist
;;
esac

@ -1,8 +0,0 @@
#Aliases
alias pc="sudo port clean --all installed"
alias pi="sudo port install $1"
alias psu="sudo port selfupdate"
alias puni="sudo port uninstall inactive"
alias puo="sudo port upgrade outdated"
alias pup="psu && puo"

@ -1,20 +0,0 @@
# Mercurial
alias hgc='hg commit'
alias hgb='hg branch'
alias hgba='hg branches'
alias hgco='hg checkout'
alias hgd='hg diff'
alias hged='hg diffmerge'
# pull and update
alias hgl='hg pull -u'
alias hgp='hg push'
alias hgs='hg status'
# this is the 'git commit --amend' equivalent
alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip'
function hg_current_branch() {
if [ -d .hg ]; then
echo hg:$(hg branch)
fi
}

@ -1,170 +0,0 @@
# mvn-color based on https://gist.github.com/1027800
export BOLD=`tput bold`
export UNDERLINE_ON=`tput smul`
export UNDERLINE_OFF=`tput rmul`
export TEXT_BLACK=`tput setaf 0`
export TEXT_RED=`tput setaf 1`
export TEXT_GREEN=`tput setaf 2`
export TEXT_YELLOW=`tput setaf 3`
export TEXT_BLUE=`tput setaf 4`
export TEXT_MAGENTA=`tput setaf 5`
export TEXT_CYAN=`tput setaf 6`
export TEXT_WHITE=`tput setaf 7`
export BACKGROUND_BLACK=`tput setab 0`
export BACKGROUND_RED=`tput setab 1`
export BACKGROUND_GREEN=`tput setab 2`
export BACKGROUND_YELLOW=`tput setab 3`
export BACKGROUND_BLUE=`tput setab 4`
export BACKGROUND_MAGENTA=`tput setab 5`
export BACKGROUND_CYAN=`tput setab 6`
export BACKGROUND_WHITE=`tput setab 7`
export RESET_FORMATTING=`tput sgr0`
# Wrapper function for Maven's mvn command.
mvn-color()
{
# Filter mvn output using sed
mvn $@ | sed -e "s/\(\[INFO\]\ \-.*\)/${TEXT_BLUE}${BOLD}\1/g" \
-e "s/\(\[INFO\]\ \[.*\)/${RESET_FORMATTING}${BOLD}\1${RESET_FORMATTING}/g" \
-e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \
-e "s/\(\[WARNING\].*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}/g" \
-e "s/\(\[ERROR\].*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}/g" \
-e "s/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/${BOLD}${TEXT_GREEN}Tests run: \1${RESET_FORMATTING}, Failures: ${BOLD}${TEXT_RED}\2${RESET_FORMATTING}, Errors: ${BOLD}${TEXT_RED}\3${RESET_FORMATTING}, Skipped: ${BOLD}${TEXT_YELLOW}\4${RESET_FORMATTING}/g"
# Make sure formatting is reset
echo -ne ${RESET_FORMATTING}
}
# Override the mvn command with the colorized one.
#alias mvn="mvn-color"
# aliases
alias mvncie='mvn clean install eclipse:eclipse'
alias mvnci='mvn clean install'
alias mvne='mvn eclipse:eclipse'
alias mvnce='mvn clean eclipse:clean eclipse:eclipse'
alias mvnd='mvn deploy'
alias mvnp='mvn package'
alias mvnc='mvn clean'
alias mvncom='mvn compile'
alias mvnt='mvn test'
alias mvnag='mvn archetype:generate'
function listMavenCompletions {
reply=(
# common lifecycle
clean process-resources compile process-test-resources test-compile test package verify install deploy site
# common plugins
deploy failsafe install site surefire checkstyle javadoc jxr pmd ant antrun archetype assembly dependency enforcer gpg help release repository source eclipse idea jetty cargo jboss tomcat tomcat6 tomcat7 exec versions war ear ejb android scm buildnumber nexus repository sonar license hibernate3 liquibase flyway gwt
# deploy
deploy:deploy-file
# failsafe
failsafe:integration-test failsafe:verify
# install
install:install-file
# site
site:site site:deploy site:run site:stage site:stage-deploy
# surefire
surefire:test
# checkstyle
checkstyle:checkstyle checkstyle:check
# javadoc
javadoc:javadoc javadoc:jar javadoc:aggregate
# jxr
jxr:jxr
# pmd
pmd:pmd pmd:cpd pmd:check pmd:cpd-check
# ant
ant:ant ant:clean
# antrun
antrun:run
# archetype
archetype:generate archetype:create-from-project archetype:crawl
# assembly
assembly:single assembly:assembly
# dependency
dependency:analyze dependency:analyze-dep-mgt dependency:analyze-only dependency:analyze-report dependency:build-classpath dependency:copy dependency:copy-dependencies dependency:get dependency:go-offline dependency:list dependency:purge-local-repository dependency:resolve dependency:resolve-plugins dependency:sources dependency:tree dependency:unpack dependency:unpack-dependencies
# enforcer
enforcer:enforce
# gpg
gpg:sign gpg:sign-and-deploy-file
# help
help:active-profiles help:all-profiles help:describe help:effective-pom help:effective-settings help:evaluate help:expressions help:system
# release
release:clean release:prepare release:rollback release:perform release:stage release:branch release:update-versions
# repository
repository:bundle-create repository:bundle-pack
# source
source:aggregate source:jar source:jar-no-fork
# eclipse
eclipse:clean eclipse:eclipse
# idea
idea:clean idea:idea
# jetty
jetty:run jetty:run-exploded
# cargo
cargo:start cargo:run cargo:stop cargo:deploy cargo:undeploy cargo:help
# jboss
jboss:start jboss:stop jboss:deploy jboss:undeploy jboss:redeploy
# tomcat
tomcat:start tomcat:stop tomcat:deploy tomcat:undeploy tomcat:undeploy
# tomcat6
tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy
# tomcat7
tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy
# exec
exec:exec exec:java
# versions
versions:display-dependency-updates versions:display-plugin-updates versions:display-property-updates versions:update-parent versions:update-properties versions:update-child-modules versions:lock-snapshots versions:unlock-snapshots versions:resolve-ranges versions:set versions:use-releases versions:use-next-releases versions:use-latest-releases versions:use-next-snapshots versions:use-latest-snapshots versions:use-next-versions versions:use-latest-versions versions:commit versions:revert
# scm
scm:add scm:checkin scm:checkout scm:update scm:status
# buildnumber
buildnumber:create buildnumber:create-timestamp buildnumber:help buildnumber:hgchangeset
# war
war:war war:exploded war:inplace war:manifest
# ear
ear:ear ear:generate-application-xml
# ejb
ejb:ejb
# android
android:apk android:apklib android:deploy android:deploy-dependencies android:dex android:emulator-start android:emulator-stop android:emulator-stop-all android:generate-sources android:help android:instrument android:manifest-update android:pull android:push android:redeploy android:run android:undeploy android:unpack android:version-update android:zipalign android:devices
# nexus
nexus:staging-list nexus:staging-close nexus:staging-drop nexus:staging-release nexus:staging-build-promotion nexus:staging-profiles-list nexus:settings-download
# repository
repository:bundle-create repository:bundle-pack repository:help
# sonar
sonar:sonar
# license
license:format license:check
# hibernate3
hibernate3:hbm2ddl hibernate3:help
# liquibase
liquibase:changelogSync liquibase:changelogSyncSQL liquibase:clearCheckSums liquibase:dbDoc liquibase:diff liquibase:dropAll liquibase:help liquibase:migrate liquibase:listLocks liquibase:migrateSQL liquibase:releaseLocks liquibase:rollback liquibase:rollbackSQL liquibase:status liquibase:tag liquibase:update liquibase:updateSQL liquibase:updateTestingRollback
# flyway
flyway:clean flyway:history flyway:init flyway:migrate flyway:status flyway:validate
# gwt
gwt:browser gwt:clean gwt:compile gwt:compile-report gwt:css gwt:debug gwt:eclipse gwt:eclipseTest gwt:generateAsync gwt:help gwt:i18n gwt:mergewebxml gwt:resources gwt:run gwt:sdkInstall gwt:source-jar gwt:soyc gwt:test
# options
-Dmaven.test.skip=true -DskipTests -Dmaven.surefire.debug -DenableCiProfile -Dpmd.skip=true -Dcheckstyle.skip=true -Dtycho.mode=maven
# arguments
-am -amd -B -C -c -cpu -D -e -emp -ep -f -fae -ff -fn -gs -h -l -N -npr -npu -nsu -o -P -pl -q -rf -s -T -t -U -up -V -v -X
cli:execute cli:execute-phase
archetype:generate generate-sources
cobertura:cobertura
-Dtest= `if [ -d ./src ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi`
);
}
compctl -K listMavenCompletions mvn

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save