Merge commit '21ca061287c2ee82ad27227ffb64041fe154bf11' as 'oh-my-zsh'
This commit is contained in:
commit
a5fd651215
9
oh-my-zsh/.gitignore
vendored
Normal file
9
oh-my-zsh/.gitignore
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
locals.zsh
|
||||
log/.zsh_history
|
||||
projects.zsh
|
||||
custom
|
||||
!custom/plugins/example
|
||||
!custom/example.zsh
|
||||
*.swp
|
||||
!custom/example.zshcache
|
||||
cache/
|
21
oh-my-zsh/MIT-LICENSE.txt
Normal file
21
oh-my-zsh/MIT-LICENSE.txt
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License
|
||||
|
||||
Copyright (c) 2009-2014 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.
|
111
oh-my-zsh/README.textile
Normal file
111
oh-my-zsh/README.textile
Normal file
|
@ -0,0 +1,111 @@
|
|||
!https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png!
|
||||
|
||||
@oh-my-zsh@ is an open source, community-driven framework for managing your "Zsh":http://www.zsh.org/ configuration.
|
||||
|
||||
It comes bundled with a ton of helpful functions, helpers, plugins, themes, and a few things that make 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*.
|
||||
|
||||
If not already installed, you can install "Zsh":http://www.zsh.org/ using the command-line.
|
||||
|
||||
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 http://install.ohmyz.sh | sh@
|
||||
|
||||
h4. via @wget@:
|
||||
|
||||
@wget --no-check-certificate http://install.ohmyz.sh -O - | sh@
|
||||
|
||||
h4. *Optionally*, change the install directory:
|
||||
|
||||
The default location is @~/.oh-my-zsh@ (hidden in your home directory).
|
||||
|
||||
You can change the install directory with the @ZSH@ environment variable, either by running @export ZSH=/your/path@ before installing, or by setting it before the end of the install pipeline like this:
|
||||
|
||||
@curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | ZSH=~/.dotfiles/zsh sh@
|
||||
|
||||
h3. The manual way
|
||||
|
||||
1. Clone the repository:
|
||||
|
||||
@git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh@
|
||||
|
||||
2. *Optionally*, backup your existing @~/.zshrc@ file:
|
||||
|
||||
@cp ~/.zshrc ~/.zshrc.orig@
|
||||
|
||||
3. Create a new "Zsh":http://www.zsh.org/ config file by copying the "Zsh":http://www.zsh.org/ template we've provided:
|
||||
|
||||
@cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc@
|
||||
|
||||
4. Set "Zsh":http://www.zsh.org/ as your default shell:
|
||||
|
||||
@chsh -s /bin/zsh@
|
||||
|
||||
5. Start or restart "Zsh":http://www.zsh.org/ by opening a new command-line window.
|
||||
|
||||
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@.
|
||||
|
||||
If you installed manually or changed the install location, check the @ZSH@ environment variable in @~/.zshrc@.
|
||||
|
||||
h2. Usage
|
||||
|
||||
* enable the plugins you want in your @~/.zshrc@ (take a look at the @plugins/@ directory and the "wiki":https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins to see what's available)
|
||||
** example: @plugins=(git osx ruby)@
|
||||
* theme support: change the @ZSH_THEME@ environment variable in @~/.zshrc@
|
||||
** take a look at the @themes/@ directory and the "wiki":https://wiki.github.com/robbyrussell/oh-my-zsh/themes to see what comes bundled with @oh-my-zsh@
|
||||
* & much, much more… take a look at the @lib/@ directory to see what @oh-my-zsh@ has to offer…
|
||||
|
||||
h2. Useful
|
||||
|
||||
The "refcard":http://www.bash2zsh.com/zsh_refcard/refcard.pdf is pretty useful for tips.
|
||||
|
||||
h3. Customization
|
||||
|
||||
If you want to override any of the default behaviors, just add a new file (ending in @.zsh@) in the @custom/@ directory.
|
||||
|
||||
If you have many functions that go well together, you can put them as a @*.plugin.zsh@ file in the @custom/plugins/@ directory and then enable this plugin (see '"Usage":https://github.com/robbyrussell/oh-my-zsh#usage' above).
|
||||
|
||||
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. Updates
|
||||
|
||||
By default you will be prompted to check for upgrades. If you would like @oh-my-zsh@ to automatically upgrade itself without prompting you, set the following in your @~/.zshrc@:
|
||||
|
||||
@DISABLE_UPDATE_PROMPT=true@
|
||||
|
||||
To disable upgrades entirely, set the following in your @~/.zshrc@:
|
||||
|
||||
@DISABLE_AUTO_UPDATE=true@
|
||||
|
||||
To upgrade directly from the command-line, just run @upgrade_oh_my_zsh@.
|
||||
|
||||
h3. Uninstalling
|
||||
|
||||
If you want to uninstall @oh-my-zsh@, just run @uninstall_oh_my_zsh@ from the command-line and it'll remove itself and revert you to @bash@ (or your previous "Zsh":http://www.zsh.org/ configuration).
|
||||
|
||||
h2. Help out!
|
||||
|
||||
I'm far from being a "Zsh":http://www.zsh.org/ 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 – 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!
|
4
oh-my-zsh/cache/.easter-egg
vendored
Normal file
4
oh-my-zsh/cache/.easter-egg
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
This file is only here so that Git will keep a cache directory as .gitignore is ignoring all the files within it.
|
||||
|
||||
Feel free to add love notes for people here.
|
||||
|
5
oh-my-zsh/custom/example.zsh
Normal file
5
oh-my-zsh/custom/example.zsh
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Add yourself some shortcuts to projects you often work on
|
||||
# Example:
|
||||
#
|
||||
# brainstormr=/Users/robbyrussell/Projects/development/planetargon/brainstormr
|
||||
#
|
2
oh-my-zsh/custom/plugins/example/example.plugin.zsh
Normal file
2
oh-my-zsh/custom/plugins/example/example.plugin.zsh
Normal file
|
@ -0,0 +1,2 @@
|
|||
# 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.
|
35
oh-my-zsh/lib/aliases.zsh
Normal file
35
oh-my-zsh/lib/aliases.zsh
Normal file
|
@ -0,0 +1,35 @@
|
|||
# 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
|
||||
if [ "$HIST_STAMPS" = "mm/dd/yyyy" ]
|
||||
then
|
||||
alias history='fc -fl 1'
|
||||
elif [ "$HIST_STAMPS" = "dd.mm.yyyy" ]
|
||||
then
|
||||
alias history='fc -El 1'
|
||||
elif [ "$HIST_STAMPS" = "yyyy-mm-dd" ]
|
||||
then
|
||||
alias history='fc -il 1'
|
||||
else
|
||||
alias history='fc -l 1'
|
||||
fi
|
||||
# List direcory contents
|
||||
alias lsa='ls -lah'
|
||||
alias l='ls -lah'
|
||||
alias ll='ls -lh'
|
||||
alias la='ls -lAh'
|
||||
|
||||
alias afind='ack-grep -il'
|
||||
|
10
oh-my-zsh/lib/bzr.zsh
Normal file
10
oh-my-zsh/lib/bzr.zsh
Normal file
|
@ -0,0 +1,10 @@
|
|||
## Bazaar integration
|
||||
## Just works with the GIT integration just add $(bzr_prompt_info) to the PROMPT
|
||||
function bzr_prompt_info() {
|
||||
BZR_CB=`bzr nick 2> /dev/null | grep -v "ERROR" | cut -d ":" -f2 | awk -F / '{print "bzr::"$1}'`
|
||||
if [ -n "$BZR_CB" ]; then
|
||||
BZR_DIRTY=""
|
||||
[[ -n `bzr status` ]] && BZR_DIRTY=" %{$fg[red]%} * %{$fg[green]%}"
|
||||
echo "$ZSH_THEME_SCM_PROMPT_PREFIX$BZR_CB$BZR_DIRTY$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
fi
|
||||
}
|
65
oh-my-zsh/lib/completion.zsh
Normal file
65
oh-my-zsh/lib/completion.zsh
Normal file
|
@ -0,0 +1,65 @@
|
|||
# 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'
|
||||
if [ "$OSTYPE[0,7]" = "solaris" ]
|
||||
then
|
||||
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm"
|
||||
else
|
||||
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"
|
||||
fi
|
||||
|
||||
# disable named-directories autocompletion
|
||||
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
|
||||
cdpath=(.)
|
||||
|
||||
# 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_DIR
|
||||
|
||||
# Don't complete uninteresting users
|
||||
zstyle ':completion:*:*:*:users' ignored-patterns \
|
||||
adm amanda apache at avahi avahi-autoipd beaglidx bin cacti canna \
|
||||
clamav daemon dbus distcache dnsmasq dovecot fax ftp games gdm \
|
||||
gkrellmd gopher hacluster haldaemon halt hsqldb ident junkbust kdm \
|
||||
ldap lp mail mailman mailnull man messagebus mldonkey mysql nagios \
|
||||
named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn \
|
||||
operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd \
|
||||
rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp \
|
||||
usbmux uucp vcsa wwwrun 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
|
13
oh-my-zsh/lib/correction.zsh
Normal file
13
oh-my-zsh/lib/correction.zsh
Normal file
|
@ -0,0 +1,13 @@
|
|||
if [[ "$ENABLE_CORRECTION" == "true" ]]; then
|
||||
alias ebuild='nocorrect ebuild'
|
||||
alias gist='nocorrect gist'
|
||||
alias heroku='nocorrect heroku'
|
||||
alias hpodder='nocorrect hpodder'
|
||||
alias man='nocorrect man'
|
||||
alias mkdir='nocorrect mkdir'
|
||||
alias mv='nocorrect mv'
|
||||
alias mysql='nocorrect mysql'
|
||||
alias sudo='nocorrect sudo'
|
||||
|
||||
setopt correct_all
|
||||
fi
|
42
oh-my-zsh/lib/directories.zsh
Normal file
42
oh-my-zsh/lib/directories.zsh
Normal file
|
@ -0,0 +1,42 @@
|
|||
# Changing/making/removing directory
|
||||
setopt auto_pushd
|
||||
setopt pushd_ignore_dups
|
||||
setopt pushdminus
|
||||
|
||||
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 ../../../../..
|
||||
elif [ -d ~/.autoenv ]; then
|
||||
source ~/.autoenv/activate.sh
|
||||
autoenv_cd "$@"
|
||||
else
|
||||
builtin cd "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
alias md='mkdir -p'
|
||||
alias rd=rmdir
|
||||
alias d='dirs -v | head -10'
|
75
oh-my-zsh/lib/functions.zsh
Normal file
75
oh-my-zsh/lib/functions.zsh
Normal file
|
@ -0,0 +1,75 @@
|
|||
function zsh_stats() {
|
||||
fc -l 1 | 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() {
|
||||
env ZSH=$ZSH /bin/sh $ZSH/tools/uninstall.sh
|
||||
}
|
||||
|
||||
function upgrade_oh_my_zsh() {
|
||||
env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh
|
||||
}
|
||||
|
||||
function take() {
|
||||
mkdir -p $1
|
||||
cd $1
|
||||
}
|
||||
|
||||
#
|
||||
# Get the value of an alias.
|
||||
#
|
||||
# Arguments:
|
||||
# 1. alias - The alias to get its value from
|
||||
# STDOUT:
|
||||
# The value of alias $1 (if it has one).
|
||||
# Return value:
|
||||
# 0 if the alias was found,
|
||||
# 1 if it does not exist
|
||||
#
|
||||
function alias_value() {
|
||||
alias "$1" | sed "s/^$1='\(.*\)'$/\1/"
|
||||
test $(alias "$1")
|
||||
}
|
||||
|
||||
#
|
||||
# Try to get the value of an alias,
|
||||
# otherwise return the input.
|
||||
#
|
||||
# Arguments:
|
||||
# 1. alias - The alias to get its value from
|
||||
# STDOUT:
|
||||
# The value of alias $1, or $1 if there is no alias $1.
|
||||
# Return value:
|
||||
# Always 0
|
||||
#
|
||||
function try_alias_value() {
|
||||
alias_value "$1" || echo "$1"
|
||||
}
|
||||
|
||||
#
|
||||
# Set variable "$1" to default value "$2" if "$1" is not yet defined.
|
||||
#
|
||||
# Arguments:
|
||||
# 1. name - The variable to set
|
||||
# 2. val - The default value
|
||||
# Return value:
|
||||
# 0 if the variable exists, 3 if it was set
|
||||
#
|
||||
function default() {
|
||||
test `typeset +m "$1"` && return 0
|
||||
typeset -g "$1"="$2" && return 3
|
||||
}
|
||||
|
||||
#
|
||||
# Set enviroment variable "$1" to default value "$2" if "$1" is not yet defined.
|
||||
#
|
||||
# Arguments:
|
||||
# 1. name - The env variable to set
|
||||
# 2. val - The default value
|
||||
# Return value:
|
||||
# 0 if the env variable exists, 3 if it was set
|
||||
#
|
||||
function env_default() {
|
||||
env | grep -q "^$1=" && return 0
|
||||
export "$1=$2" && return 3
|
||||
}
|
150
oh-my-zsh/lib/git.zsh
Normal file
150
oh-my-zsh/lib/git.zsh
Normal file
|
@ -0,0 +1,150 @@
|
|||
# get the name of the branch we are on
|
||||
function git_prompt_info() {
|
||||
if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then
|
||||
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
|
||||
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0
|
||||
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Checks if working tree is dirty
|
||||
parse_git_dirty() {
|
||||
local STATUS=''
|
||||
local FLAGS
|
||||
FLAGS=('--porcelain')
|
||||
if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
|
||||
if [[ $POST_1_7_2_GIT -gt 0 ]]; then
|
||||
FLAGS+='--ignore-submodules=dirty'
|
||||
fi
|
||||
if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
|
||||
FLAGS+='--untracked-files=no'
|
||||
fi
|
||||
STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1)
|
||||
fi
|
||||
if [[ -n $STATUS ]]; then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
|
||||
else
|
||||
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||
fi
|
||||
}
|
||||
|
||||
# get the difference between the local and remote branches
|
||||
git_remote_status() {
|
||||
remote=${$(command git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/}
|
||||
if [[ -n ${remote} ]] ; then
|
||||
ahead=$(command git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
|
||||
behind=$(command 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 "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_AHEAD"
|
||||
fi
|
||||
}
|
||||
|
||||
# Gets the number of commits ahead from remote
|
||||
function git_commits_ahead() {
|
||||
if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
|
||||
COMMITS=$(command git log @{upstream}..HEAD | grep '^commit' | wc -l | tr -d ' ')
|
||||
echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$COMMITS$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX"
|
||||
fi
|
||||
}
|
||||
|
||||
# Formats prompt string for current git commit short SHA
|
||||
function git_prompt_short_sha() {
|
||||
SHA=$(command 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=$(command 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=$(command git status --porcelain -b 2> /dev/null)
|
||||
STATUS=""
|
||||
if $(echo "$INDEX" | command grep -E '^\?\? ' &> /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 $(command 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=($(command git --version 2>/dev/null));
|
||||
INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]});
|
||||
|
||||
for i in {1..3}; do
|
||||
if [[ $INSTALLED_GIT_VERSION[$i] -gt $INPUT_GIT_VERSION[$i] ]]; then
|
||||
echo 1
|
||||
return 0
|
||||
fi
|
||||
if [[ $INSTALLED_GIT_VERSION[$i] -lt $INPUT_GIT_VERSION[$i] ]]; then
|
||||
echo -1
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
echo 0
|
||||
}
|
||||
|
||||
#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
|
24
oh-my-zsh/lib/grep.zsh
Normal file
24
oh-my-zsh/lib/grep.zsh
Normal file
|
@ -0,0 +1,24 @@
|
|||
# is x grep argument available?
|
||||
grep-flag-available() {
|
||||
echo | grep $1 "" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# color grep results
|
||||
GREP_OPTIONS="--color=auto"
|
||||
|
||||
# ignore VCS folders (if the necessary grep flags are available)
|
||||
VCS_FOLDERS="{.bzr,.cvs,.git,.hg,.svn}"
|
||||
|
||||
if grep-flag-available --exclude-dir=.cvs; then
|
||||
GREP_OPTIONS+=" --exclude-dir=$VCS_FOLDERS"
|
||||
elif grep-flag-available --exclude=.cvs; then
|
||||
GREP_OPTIONS+=" --exclude=$VCS_FOLDERS"
|
||||
fi
|
||||
|
||||
# export grep settings
|
||||
alias grep="grep $GREP_OPTIONS"
|
||||
|
||||
# clean up
|
||||
unset GREP_OPTIONS
|
||||
unset VCS_FOLDERS
|
||||
unfunction grep-flag-available
|
15
oh-my-zsh/lib/history.zsh
Normal file
15
oh-my-zsh/lib/history.zsh
Normal file
|
@ -0,0 +1,15 @@
|
|||
## Command history configuration
|
||||
if [ -z "$HISTFILE" ]; then
|
||||
HISTFILE=$HOME/.zsh_history
|
||||
fi
|
||||
|
||||
HISTSIZE=10000
|
||||
SAVEHIST=10000
|
||||
|
||||
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
|
84
oh-my-zsh/lib/key-bindings.zsh
Normal file
84
oh-my-zsh/lib/key-bindings.zsh
Normal file
|
@ -0,0 +1,84 @@
|
|||
# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html
|
||||
# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Zle-Builtins
|
||||
# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Standard-Widgets
|
||||
|
||||
# Make sure that the terminal is in application mode when zle is active, since
|
||||
# only then values from $terminfo are valid
|
||||
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
|
||||
function zle-line-init() {
|
||||
echoti smkx
|
||||
}
|
||||
function zle-line-finish() {
|
||||
echoti rmkx
|
||||
}
|
||||
zle -N zle-line-init
|
||||
zle -N zle-line-finish
|
||||
fi
|
||||
|
||||
bindkey -e # Use emacs key bindings
|
||||
|
||||
bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark
|
||||
bindkey -s '\el' 'ls\n' # [Esc-l] - run command: ls
|
||||
bindkey '^r' history-incremental-search-backward # [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line.
|
||||
if [[ "${terminfo[kpp]}" != "" ]]; then
|
||||
bindkey "${terminfo[kpp]}" up-line-or-history # [PageUp] - Up a line of history
|
||||
fi
|
||||
if [[ "${terminfo[knp]}" != "" ]]; then
|
||||
bindkey "${terminfo[knp]}" down-line-or-history # [PageDown] - Down a line of history
|
||||
fi
|
||||
|
||||
if [[ "${terminfo[kcuu1]}" != "" ]]; then
|
||||
bindkey "${terminfo[kcuu1]}" up-line-or-search # start typing + [Up-Arrow] - fuzzy find history forward
|
||||
fi
|
||||
if [[ "${terminfo[kcud1]}" != "" ]]; then
|
||||
bindkey "${terminfo[kcud1]}" down-line-or-search # start typing + [Down-Arrow] - fuzzy find history backward
|
||||
fi
|
||||
|
||||
if [[ "${terminfo[khome]}" != "" ]]; then
|
||||
bindkey "${terminfo[khome]}" beginning-of-line # [Home] - Go to beginning of line
|
||||
fi
|
||||
if [[ "${terminfo[kend]}" != "" ]]; then
|
||||
bindkey "${terminfo[kend]}" end-of-line # [End] - Go to end of line
|
||||
fi
|
||||
|
||||
bindkey ' ' magic-space # [Space] - do history expansion
|
||||
|
||||
bindkey '^[[1;5C' forward-word # [Ctrl-RightArrow] - move forward one word
|
||||
bindkey '^[[1;5D' backward-word # [Ctrl-LeftArrow] - move backward one word
|
||||
|
||||
if [[ "${terminfo[kcbt]}" != "" ]]; then
|
||||
bindkey "${terminfo[kcbt]}" reverse-menu-complete # [Shift-Tab] - move through the completion menu backwards
|
||||
fi
|
||||
|
||||
bindkey '^?' backward-delete-char # [Backspace] - delete backward
|
||||
if [[ "${terminfo[kdch1]}" != "" ]]; then
|
||||
bindkey "${terminfo[kdch1]}" delete-char # [Delete] - delete forward
|
||||
else
|
||||
bindkey "^[[3~" delete-char
|
||||
bindkey "^[3;5~" delete-char
|
||||
bindkey "\e[3~" delete-char
|
||||
fi
|
||||
|
||||
# Edit the current command line in $EDITOR
|
||||
autoload -U edit-command-line
|
||||
zle -N edit-command-line
|
||||
bindkey '\C-x\C-e' edit-command-line
|
||||
|
||||
# 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'
|
||||
#
|
15
oh-my-zsh/lib/misc.zsh
Normal file
15
oh-my-zsh/lib/misc.zsh
Normal file
|
@ -0,0 +1,15 @@
|
|||
## 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
|
9
oh-my-zsh/lib/nvm.zsh
Normal file
9
oh-my-zsh/lib/nvm.zsh
Normal file
|
@ -0,0 +1,9 @@
|
|||
# get the node.js version
|
||||
function nvm_prompt_info() {
|
||||
[ -f "$HOME/.nvm/nvm.sh" ] || return
|
||||
local nvm_prompt
|
||||
nvm_prompt=$(node -v 2>/dev/null)
|
||||
[[ "${nvm_prompt}x" == "x" ]] && return
|
||||
nvm_prompt=${nvm_prompt:1}
|
||||
echo "${ZSH_THEME_NVM_PROMPT_PREFIX}${nvm_prompt}${ZSH_THEME_NVM_PROMPT_SUFFIX}"
|
||||
}
|
33
oh-my-zsh/lib/prompt_info_functions.zsh
Normal file
33
oh-my-zsh/lib/prompt_info_functions.zsh
Normal file
|
@ -0,0 +1,33 @@
|
|||
# *_prompt_info functions for usage in your prompt
|
||||
#
|
||||
# Plugin creators, please add your *_prompt_info function to the list
|
||||
# of dummy implementations to help theme creators not receiving errors
|
||||
# without the need of implementing conditional clauses.
|
||||
#
|
||||
# See also lib/bzr.zsh, lib/git.zsh and lib/nvm.zsh for
|
||||
# git_prompt_info, bzr_prompt_info and nvm_prompt_info
|
||||
|
||||
# Dummy implementations that return false to prevent command_not_found
|
||||
# errors with themes, that implement these functions
|
||||
# Real implementations will be used when the respective plugins are loaded
|
||||
function chruby_prompt_info hg_prompt_info pyenv_prompt_info \
|
||||
rbenv_prompt_info svn_prompt_info vi_mode_prompt_info \
|
||||
virtualenv_prompt_info {
|
||||
return 1
|
||||
}
|
||||
|
||||
# oh-my-zsh supports an rvm prompt by default
|
||||
# get the name of the rvm ruby version
|
||||
function rvm_prompt_info() {
|
||||
[ -f $HOME/.rvm/bin/rvm-prompt ] || return 1
|
||||
local rvm_prompt
|
||||
rvm_prompt=$($HOME/.rvm/bin/rvm-prompt ${=ZSH_THEME_RVM_PROMPT_OPTIONS} 2>/dev/null)
|
||||
[[ "${rvm_prompt}x" == "x" ]] && return 1
|
||||
echo "${ZSH_THEME_RVM_PROMPT_PREFIX:=(}${rvm_prompt}${ZSH_THEME_RVM_PROMPT_SUFFIX:=)}"
|
||||
}
|
||||
|
||||
# use this to enable users to see their ruby version, no matter which
|
||||
# version management system they use
|
||||
function ruby_prompt_info() {
|
||||
echo $(rvm_prompt_info || rbenv_prompt_info || chruby_prompt_info)
|
||||
}
|
37
oh-my-zsh/lib/spectrum.zsh
Normal file
37
oh-my-zsh/lib/spectrum.zsh
Normal file
|
@ -0,0 +1,37 @@
|
|||
#! /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 "%{[00m%}"
|
||||
bold "%{[01m%}" no-bold "%{[22m%}"
|
||||
italic "%{[03m%}" no-italic "%{[23m%}"
|
||||
underline "%{[04m%}" no-underline "%{[24m%}"
|
||||
blink "%{[05m%}" no-blink "%{[25m%}"
|
||||
reverse "%{[07m%}" no-reverse "%{[27m%}"
|
||||
)
|
||||
|
||||
for color in {000..255}; do
|
||||
FG[$color]="%{[38;5;${color}m%}"
|
||||
BG[$color]="%{[48;5;${color}m%}"
|
||||
done
|
||||
|
||||
|
||||
ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
|
||||
|
||||
# Show all 256 colors with color number
|
||||
function spectrum_ls() {
|
||||
for code in {000..255}; do
|
||||
print -P -- "$code: %F{$code}$ZSH_SPECTRUM_TEXT%f"
|
||||
done
|
||||
}
|
||||
|
||||
# Show all 256 colors where the background is set to specific color
|
||||
function spectrum_bls() {
|
||||
for code in {000..255}; do
|
||||
print -P -- "$BG[$code]$code: $ZSH_SPECTRUM_TEXT %{$reset_color%}"
|
||||
done
|
||||
}
|
50
oh-my-zsh/lib/termsupport.zsh
Normal file
50
oh-my-zsh/lib/termsupport.zsh
Normal file
|
@ -0,0 +1,50 @@
|
|||
#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
|
||||
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 == ansi ]] || [[ "$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
|
||||
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
|
||||
|
||||
# cmd name only, or if this is sudo or ssh, the next cmd
|
||||
local CMD=${1[(wr)^(*=*|sudo|ssh|rake|-*)]:gs/%/%%}
|
||||
local LINE="${2:gs/%/%%}"
|
||||
|
||||
title '$CMD' '%100>...>$LINE%<<'
|
||||
}
|
||||
|
||||
#Appears each time pwd is changed
|
||||
function omz_termsupport_chpwd {
|
||||
#Notify Terminal.app of current directory using undocumented OSC sequence
|
||||
#found in OS X 10.10's /etc/bashrc
|
||||
if [[ $TERM_PROGRAM == Apple_Terminal ]] && [[ -z $INSIDE_EMACS ]]; then
|
||||
local PWD_URL="file://$HOSTNAME${PWD// /%20}"
|
||||
printf '\e]7;%s\a' "$PWD_URL"
|
||||
fi
|
||||
}
|
||||
#Fire it once so the pwd is set properly upon shell startup
|
||||
omz_termsupport_chpwd
|
||||
|
||||
precmd_functions+=(omz_termsupport_precmd)
|
||||
preexec_functions+=(omz_termsupport_preexec)
|
||||
chpwd_functions+=(omz_termsupport_chpwd)
|
46
oh-my-zsh/lib/theme-and-appearance.zsh
Normal file
46
oh-my-zsh/lib/theme-and-appearance.zsh
Normal file
|
@ -0,0 +1,46 @@
|
|||
# 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
|
||||
if [[ "$(uname -s)" == "NetBSD" ]]; then
|
||||
# On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors);
|
||||
# otherwise, leave ls as is, because NetBSD's ls doesn't support -G
|
||||
gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
|
||||
elif [[ "$(uname -s)" == "OpenBSD" ]]; then
|
||||
# On OpenBSD, test if "colorls" is installed (this one supports colors);
|
||||
# otherwise, leave ls as is, because OpenBSD's ls doesn't support -G
|
||||
colorls -G -d . &>/dev/null 2>&1 && alias ls='colorls -G'
|
||||
else
|
||||
ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
|
||||
fi
|
||||
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
|
||||
|
4
oh-my-zsh/log/.easter-egg
Normal file
4
oh-my-zsh/log/.easter-egg
Normal file
|
@ -0,0 +1,4 @@
|
|||
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.
|
||||
|
99
oh-my-zsh/oh-my-zsh.sh
Normal file
99
oh-my-zsh/oh-my-zsh.sh
Normal file
|
@ -0,0 +1,99 @@
|
|||
# Check for updates on initial load...
|
||||
if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then
|
||||
env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh
|
||||
fi
|
||||
|
||||
# Initializes Oh My Zsh
|
||||
|
||||
# add a function path
|
||||
fpath=($ZSH/functions $ZSH/completions $fpath)
|
||||
|
||||
# Set ZSH_CUSTOM to the path where your custom config files
|
||||
# and plugins exists, or else we will use the default custom/
|
||||
if [[ -z "$ZSH_CUSTOM" ]]; then
|
||||
ZSH_CUSTOM="$ZSH/custom"
|
||||
fi
|
||||
|
||||
# Set ZSH_CACHE_DIR to the path where cache files sould be created
|
||||
# or else we will use the default cache/
|
||||
if [[ -z "$ZSH_CACHE_DIR" ]]; then
|
||||
ZSH_CACHE_DIR="$ZSH/cache/"
|
||||
fi
|
||||
|
||||
|
||||
# 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
|
||||
custom_config_file="${ZSH_CUSTOM}/lib/${config_file:t}"
|
||||
[ -f "${custom_config_file}" ] && config_file=${custom_config_file}
|
||||
source $config_file
|
||||
done
|
||||
|
||||
|
||||
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
|
||||
|
||||
# Figure out the SHORT hostname
|
||||
if [[ "$OSTYPE" = darwin* ]]; then
|
||||
# OS X's $HOST changes with dhcp, etc. Use ComputerName if possible.
|
||||
SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST=${HOST/.*/}
|
||||
else
|
||||
SHORT_HOST=${HOST/.*/}
|
||||
fi
|
||||
|
||||
# Save the location of the current completion dump file.
|
||||
if [ -z "$ZSH_COMPDUMP" ]; then
|
||||
ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
|
||||
fi
|
||||
|
||||
# Load and run compinit
|
||||
autoload -U compinit
|
||||
compinit -i -d "${ZSH_COMPDUMP}"
|
||||
|
||||
# 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"
|
||||
elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]; then
|
||||
source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme"
|
||||
else
|
||||
source "$ZSH/themes/$ZSH_THEME.zsh-theme"
|
||||
fi
|
||||
fi
|
||||
fi
|
8
oh-my-zsh/plugins/adb/README.md
Normal file
8
oh-my-zsh/plugins/adb/README.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
# adb autocomplete plugin
|
||||
|
||||
* Adds autocomplete options for all adb commands.
|
||||
|
||||
|
||||
## Requirements
|
||||
|
||||
In order to make this work, you will need to have the Android adb tools set up in your path.
|
39
oh-my-zsh/plugins/adb/_adb
Normal file
39
oh-my-zsh/plugins/adb/_adb
Normal file
|
@ -0,0 +1,39 @@
|
|||
#compdef adb
|
||||
#autoload
|
||||
|
||||
# in order to make this work, you will need to have the android adb tools
|
||||
|
||||
# adb zsh completion, based on homebrew completion
|
||||
|
||||
local -a _1st_arguments
|
||||
_1st_arguments=(
|
||||
'bugreport:return all information from the device that should be included in a bug report.'
|
||||
'connect:connect to a device via TCP/IP Port 5555 is default.'
|
||||
'devices:list all connected devices'
|
||||
'disconnect:disconnect from a TCP/IP device. Port 5555 is default.'
|
||||
'emu:run emulator console command'
|
||||
'forward:forward socket connections'
|
||||
'help:show the help message'
|
||||
'install:push this package file to the device and install it'
|
||||
'jdwp:list PIDs of processes hosting a JDWP transport'
|
||||
'logcat:View device log'
|
||||
'pull:copy file/dir from device'
|
||||
'push:copy file/dir to device'
|
||||
'shell:run remote shell interactively'
|
||||
'sync:copy host->device only if changed (-l means list but dont copy)'
|
||||
'uninstall:remove this app package from the device'
|
||||
'version:show version num'
|
||||
)
|
||||
|
||||
local expl
|
||||
local -a pkgs installed_pkgs
|
||||
|
||||
_arguments \
|
||||
'*:: :->subcmds' && return 0
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "adb subcommand" _1st_arguments
|
||||
return
|
||||
fi
|
||||
|
||||
_files
|
16
oh-my-zsh/plugins/ant/ant.plugin.zsh
Normal file
16
oh-my-zsh/plugins/ant/ant.plugin.zsh
Normal file
|
@ -0,0 +1,16 @@
|
|||
_ant_does_target_list_need_generating () {
|
||||
[ ! -f .ant_targets ] && return 0;
|
||||
[ .ant_targets -nt build.xml ] && return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
_ant () {
|
||||
if [ -f build.xml ]; then
|
||||
if _ant_does_target_list_need_generating; then
|
||||
sed -n '/<target/s/<target.*name="\([^"]*\).*$/\1/p' build.xml > .ant_targets
|
||||
fi
|
||||
compadd `cat .ant_targets`
|
||||
fi
|
||||
}
|
||||
|
||||
compdef _ant ant
|
|
@ -0,0 +1,6 @@
|
|||
# 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'
|
103
oh-my-zsh/plugins/archlinux/archlinux.plugin.zsh
Normal file
103
oh-my-zsh/plugins/archlinux/archlinux.plugin.zsh
Normal file
|
@ -0,0 +1,103 @@
|
|||
# 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 -Syua' # Synchronize with repositories before upgrading packages (AUR packages too) 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
|
||||
alias yalst='yaourt -Qe' # List installed packages, even those installed from AUR (they're tagged as "local")
|
||||
alias yaorph='yaourt -Qtd' # Remove orphans using yaourt
|
||||
# Additional yaourt alias examples
|
||||
if [[ -x `which abs` && -x `which aur` ]]; then
|
||||
alias yaupd='yaourt -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories
|
||||
elif [[ -x `which abs` ]]; then
|
||||
alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
|
||||
elif [[ -x `which aur` ]]; then
|
||||
alias yaupd='yaourt -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories
|
||||
else
|
||||
alias yaupd='yaourt -Sy' # Update and refresh the local package database 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` && -x `which aur` ]]; then
|
||||
alias pacupd='sudo pacman -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories
|
||||
elif [[ -x `which abs` ]]; then
|
||||
alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
|
||||
elif [[ -x `which aur` ]]; then
|
||||
alias pacupd='sudo pacman -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories
|
||||
else
|
||||
alias pacupd='sudo pacman -Sy' # Update and refresh the local package database 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
|
||||
}
|
14
oh-my-zsh/plugins/atom/atom.plugin.zsh
Normal file
14
oh-my-zsh/plugins/atom/atom.plugin.zsh
Normal file
|
@ -0,0 +1,14 @@
|
|||
local _atom_paths > /dev/null 2>&1
|
||||
_atom_paths=(
|
||||
"$HOME/Applications/Atom.app"
|
||||
"/Applications/Atom.app"
|
||||
)
|
||||
|
||||
for _atom_path in $_atom_paths; do
|
||||
if [[ -a $_atom_path ]]; then
|
||||
alias at="open -a '$_atom_path'"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
alias att='at .'
|
18
oh-my-zsh/plugins/autoenv/autoenv.plugin.zsh
Normal file
18
oh-my-zsh/plugins/autoenv/autoenv.plugin.zsh
Normal file
|
@ -0,0 +1,18 @@
|
|||
# The use_env call below is a reusable command to activate/create a new Python
|
||||
# virtualenv, requiring only a single declarative line of code in your .env files.
|
||||
# It only performs an action if the requested virtualenv is not the current one.
|
||||
use_env() {
|
||||
typeset venv
|
||||
venv="$1"
|
||||
if [[ "${VIRTUAL_ENV:t}" != "$venv" ]]; then
|
||||
if workon | grep -q "$venv"; then
|
||||
workon "$venv"
|
||||
else
|
||||
echo -n "Create virtualenv $venv now? (Yn) "
|
||||
read answer
|
||||
if [[ "$answer" == "Y" ]]; then
|
||||
mkvirtualenv "$venv"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
21
oh-my-zsh/plugins/autojump/autojump.plugin.zsh
Normal file
21
oh-my-zsh/plugins/autojump/autojump.plugin.zsh
Normal file
|
@ -0,0 +1,21 @@
|
|||
if [ $commands[autojump] ]; then # check if autojump is installed
|
||||
if [ -f $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation
|
||||
. $HOME/.autojump/etc/profile.d/autojump.zsh
|
||||
elif [ -f $HOME/.autojump/share/autojump/autojump.zsh ]; then # another manual user-local installation
|
||||
. $HOME/.autojump/share/autojump/autojump.zsh
|
||||
elif [ -f $HOME/.nix-profile/etc/profile.d/autojump.zsh ]; then # nix installation
|
||||
. $HOME/.nix-profile/etc/profile.d/autojump.zsh
|
||||
elif [ -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 /etc/profile.d/autojump.sh ]; then # gentoo installation
|
||||
. /etc/profile.d/autojump.sh
|
||||
elif [ -f /usr/local/share/autojump/autojump.zsh ]; then # freebsd installation
|
||||
. /usr/local/share/autojump/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
|
32
oh-my-zsh/plugins/autopep8/_autopep8
Normal file
32
oh-my-zsh/plugins/autopep8/_autopep8
Normal file
|
@ -0,0 +1,32 @@
|
|||
#compdef autopep8
|
||||
#
|
||||
# this is zsh completion function file.
|
||||
# generated by genzshcomp(ver: 0.5.1)
|
||||
#
|
||||
|
||||
typeset -A opt_args
|
||||
local context state line
|
||||
|
||||
_arguments -s -S \
|
||||
"--help[show this help message and exit]:" \
|
||||
"-h[show this help message and exit]:" \
|
||||
"--version[show program's version number and exit]:" \
|
||||
"--verbose[print verbose messages; multiple -v result in more verbose messages]" \
|
||||
"-v[print verbose messages; multiple -v result in more verbose messages]" \
|
||||
"--diff[print the diff for the fixed source]" \
|
||||
"-d[print the diff for the fixed source]" \
|
||||
"--in-place[make changes to files in place]" \
|
||||
"-i[make changes to files in place]" \
|
||||
"--recursive[run recursively; must be used with --in-place or --diff]" \
|
||||
"-r[run recursively; must be used with --in-place or --diff]" \
|
||||
"--jobs[number of parallel jobs; match CPU count if value is less than 1]::n number of parallel jobs; match CPU count if value is:_files" \
|
||||
"-j[number of parallel jobs; match CPU count if value is less than 1]::n number of parallel jobs; match CPU count if value is:_files" \
|
||||
"--pep8-passes[maximum number of additional pep8 passes (default: 100)]::n:_files" \
|
||||
"-p[maximum number of additional pep8 passes (default: 100)]::n:_files" \
|
||||
"-a[-a result in more aggressive changes]::result:_files" \
|
||||
"--exclude[exclude files/directories that match these comma- separated globs]::globs:_files" \
|
||||
"--list-fixes[list codes for fixes; used by --ignore and --select]" \
|
||||
"--ignore[do not fix these errors/warnings (default E226,E24)]::errors:_files" \
|
||||
"--select[fix only these errors/warnings (e.g. E4,W)]::errors:_files" \
|
||||
"--max-line-length[set maximum allowed line length (default: 79)]::n:_files" \
|
||||
"*::args:_files"
|
0
oh-my-zsh/plugins/autopep8/autopep8.plugin.zsh
Normal file
0
oh-my-zsh/plugins/autopep8/autopep8.plugin.zsh
Normal file
31
oh-my-zsh/plugins/aws/aws.plugin.zsh
Normal file
31
oh-my-zsh/plugins/aws/aws.plugin.zsh
Normal file
|
@ -0,0 +1,31 @@
|
|||
_homebrew-installed() {
|
||||
type brew &> /dev/null
|
||||
}
|
||||
|
||||
_awscli-homebrew-installed() {
|
||||
brew list awscli &> /dev/null
|
||||
}
|
||||
|
||||
export AWS_HOME=~/.aws
|
||||
|
||||
function agp {
|
||||
echo $AWS_DEFAULT_PROFILE
|
||||
}
|
||||
function asp {
|
||||
export AWS_DEFAULT_PROFILE=$1
|
||||
export RPROMPT="<aws:$AWS_DEFAULT_PROFILE>"
|
||||
}
|
||||
function aws_profiles {
|
||||
reply=($(grep profile $AWS_HOME/config|sed -e 's/.*profile \([a-zA-Z0-9_-]*\).*/\1/'))
|
||||
}
|
||||
|
||||
compctl -K aws_profiles asp
|
||||
|
||||
if _homebrew-installed && _awscli-homebrew-installed ; then
|
||||
_aws_zsh_completer_path=$(brew --prefix)/opt/awscli/libexec/bin/aws_zsh_completer.sh
|
||||
else
|
||||
_aws_zsh_completer_path=$(which aws_zsh_completer.sh)
|
||||
fi
|
||||
|
||||
[ -x $_aws_zsh_completer_path ] && source $_aws_zsh_completer_path
|
||||
unset _aws_zsh_completer_path
|
160
oh-my-zsh/plugins/battery/battery.plugin.zsh
Normal file
160
oh-my-zsh/plugins/battery/battery.plugin.zsh
Normal file
|
@ -0,0 +1,160 @@
|
|||
###########################################
|
||||
# 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 [[ "$OSTYPE" = darwin* ]] ; then
|
||||
|
||||
function battery_pct() {
|
||||
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
|
||||
typeset -F maxcapacity=$(echo $smart_battery_status | grep '^.*"MaxCapacity"\ =\ ' | sed -e 's/^.*"MaxCapacity"\ =\ //')
|
||||
typeset -F currentcapacity=$(echo $smart_battery_status | grep '^.*"CurrentCapacity"\ =\ ' | sed -e 's/^.*CurrentCapacity"\ =\ //')
|
||||
integer i=$(((currentcapacity/maxcapacity) * 100))
|
||||
echo $i
|
||||
}
|
||||
|
||||
function plugged_in() {
|
||||
[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ Yes') -eq 1 ]
|
||||
}
|
||||
|
||||
function battery_pct_remaining() {
|
||||
if plugged_in ; then
|
||||
echo "External Power"
|
||||
else
|
||||
battery_pct
|
||||
fi
|
||||
}
|
||||
|
||||
function battery_time_remaining() {
|
||||
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
|
||||
if [[ $(echo $smart_battery_status | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
|
||||
timeremaining=$(echo $smart_battery_status | grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //')
|
||||
if [ $timeremaining -gt 720 ] ; then
|
||||
echo "::"
|
||||
else
|
||||
echo "~$((timeremaining / 60)):$((timeremaining % 60))"
|
||||
fi
|
||||
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
|
||||
}
|
||||
|
||||
function battery_is_charging() {
|
||||
[[ $(ioreg -rc "AppleSmartBattery"| grep '^.*"IsCharging"\ =\ ' | sed -e 's/^.*"IsCharging"\ =\ //') == "Yes" ]]
|
||||
}
|
||||
|
||||
elif [[ $(uname) == "Linux" ]] ; then
|
||||
|
||||
function battery_is_charging() {
|
||||
! [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]]
|
||||
}
|
||||
|
||||
function battery_pct() {
|
||||
if (( $+commands[acpi] )) ; then
|
||||
echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')"
|
||||
fi
|
||||
}
|
||||
|
||||
function battery_pct_remaining() {
|
||||
if [ ! $(battery_is_charging) ] ; then
|
||||
battery_pct
|
||||
else
|
||||
echo "External Power"
|
||||
fi
|
||||
}
|
||||
|
||||
function battery_time_remaining() {
|
||||
if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
|
||||
echo $(acpi | cut -f3 -d ',')
|
||||
fi
|
||||
}
|
||||
|
||||
function battery_pct_prompt() {
|
||||
b=$(battery_pct_remaining)
|
||||
if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
|
||||
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
|
||||
}
|
||||
|
||||
else
|
||||
# Empty functions so we don't cause errors in prompts
|
||||
function battery_pct_remaining() {
|
||||
}
|
||||
|
||||
function battery_time_remaining() {
|
||||
}
|
||||
|
||||
function battery_pct_prompt() {
|
||||
}
|
||||
fi
|
||||
|
||||
function battery_level_gauge() {
|
||||
local gauge_slots=${BATTERY_GAUGE_SLOTS:-10};
|
||||
local green_threshold=${BATTERY_GREEN_THRESHOLD:-6};
|
||||
local yellow_threshold=${BATTERY_YELLOW_THRESHOLD:-4};
|
||||
local color_green=${BATTERY_COLOR_GREEN:-%F{green}};
|
||||
local color_yellow=${BATTERY_COLOR_YELLOW:-%F{yellow}};
|
||||
local color_red=${BATTERY_COLOR_RED:-%F{red}};
|
||||
local color_reset=${BATTERY_COLOR_RESET:-%{%f%k%b%}};
|
||||
local battery_prefix=${BATTERY_GAUGE_PREFIX:-'['};
|
||||
local battery_suffix=${BATTERY_GAUGE_SUFFIX:-']'};
|
||||
local filled_symbol=${BATTERY_GAUGE_FILLED_SYMBOL:-'▶'};
|
||||
local empty_symbol=${BATTERY_GAUGE_EMPTY_SYMBOL:-'▷'};
|
||||
local charging_color=${BATTERY_CHARGING_COLOR:-$color_yellow};
|
||||
local charging_symbol=${BATTERY_CHARGING_SYMBOL:-'⚡'};
|
||||
|
||||
local battery_remaining_percentage=$(battery_pct);
|
||||
|
||||
if [[ $battery_remaining_percentage =~ [0-9]+ ]]; then
|
||||
local filled=$(((( $battery_remaining_percentage + $gauge_slots - 1) / $gauge_slots)));
|
||||
local empty=$(($gauge_slots - $filled));
|
||||
|
||||
if [[ $filled -gt $green_threshold ]]; then local gauge_color=$color_green;
|
||||
elif [[ $filled -gt $yellow_threshold ]]; then local gauge_color=$color_yellow;
|
||||
else local gauge_color=$color_red;
|
||||
fi
|
||||
else
|
||||
local filled=$gauge_slots;
|
||||
local empty=0;
|
||||
filled_symbol=${BATTERY_UNKNOWN_SYMBOL:-'.'};
|
||||
fi
|
||||
|
||||
local charging=' ' && battery_is_charging && charging=$charging_symbol;
|
||||
|
||||
printf ${charging_color//\%/\%\%}$charging${color_reset//\%/\%\%}${battery_prefix//\%/\%\%}${gauge_color//\%/\%\%}
|
||||
printf ${filled_symbol//\%/\%\%}'%.0s' {1..$filled}
|
||||
[[ $filled -lt $gauge_slots ]] && printf ${empty_symbol//\%/\%\%}'%.0s' {1..$empty}
|
||||
printf ${color_reset//\%/\%\%}${battery_suffix//\%/\%\%}${color_reset//\%/\%\%}
|
||||
}
|
||||
|
||||
|
20
oh-my-zsh/plugins/bbedit/README.md
Normal file
20
oh-my-zsh/plugins/bbedit/README.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
## bbedit
|
||||
|
||||
Plugin for BBEdit, an HTML and text editor for Mac OS X
|
||||
|
||||
### Requirements
|
||||
|
||||
* [BBEdit](http://www.barebones.com/products/bbedit/)
|
||||
* [BBEdit Command-Line Tools](http://www.barebones.com/support/bbedit/cmd-line-tools.html)
|
||||
|
||||
### Usage
|
||||
|
||||
* If the `bb` command is called without an argument, launch BBEdit
|
||||
|
||||
* If `bb` is passed a directory, cd to it and open it in BBEdit
|
||||
|
||||
* If `bb` is passed a file, open it in BBEdit
|
||||
|
||||
* If `bbpb` create a new BBEdit document with the contents of the clipboard
|
||||
|
||||
* If `bbd` alias for BBEdit diff tool
|
21
oh-my-zsh/plugins/bbedit/bbedit.plugin.zsh
Normal file
21
oh-my-zsh/plugins/bbedit/bbedit.plugin.zsh
Normal file
|
@ -0,0 +1,21 @@
|
|||
alias bbpb='pbpaste | bbedit --clean --view-top'
|
||||
|
||||
alias bbd=bbdiff
|
||||
|
||||
#
|
||||
# If the bb command is called without an argument, launch BBEdit
|
||||
# If bb is passed a directory, cd to it and open it in BBEdit
|
||||
# If bb is passed a file, open it in BBEdit
|
||||
#
|
||||
function bb() {
|
||||
if [[ -z "$1" ]]
|
||||
then
|
||||
bbedit --launch
|
||||
else
|
||||
bbedit "$1"
|
||||
if [[ -d "$1" ]]
|
||||
then
|
||||
cd "$1"
|
||||
fi
|
||||
fi
|
||||
}
|
58
oh-my-zsh/plugins/bower/_bower
Normal file
58
oh-my-zsh/plugins/bower/_bower
Normal file
|
@ -0,0 +1,58 @@
|
|||
|
||||
|
||||
# Credits to npm's awesome completion utility.
|
||||
#
|
||||
# Bower completion script, based on npm completion script.
|
||||
|
||||
###-begin-bower-completion-###
|
||||
#
|
||||
# Installation: bower completion >> ~/.bashrc (or ~/.zshrc)
|
||||
# Or, maybe: bower completion > /usr/local/etc/bash_completion.d/bower
|
||||
#
|
||||
|
||||
COMP_WORDBREAKS=${COMP_WORDBREAKS/=/}
|
||||
COMP_WORDBREAKS=${COMP_WORDBREAKS/@/}
|
||||
export COMP_WORDBREAKS
|
||||
|
||||
if type complete &>/dev/null; then
|
||||
_bower_completion () {
|
||||
local si="$IFS"
|
||||
IFS=$'\n' COMPREPLY=($(COMP_CWORD="$COMP_CWORD" \
|
||||
COMP_LINE="$COMP_LINE" \
|
||||
COMP_POINT="$COMP_POINT" \
|
||||
bower completion -- "${COMP_WORDS[@]}" \
|
||||
2>/dev/null)) || return $?
|
||||
IFS="$si"
|
||||
}
|
||||
complete -F _bower_completion bower
|
||||
elif type compdef &>/dev/null; then
|
||||
_bower_completion() {
|
||||
si=$IFS
|
||||
compadd -- $(COMP_CWORD=$((CURRENT-1)) \
|
||||
COMP_LINE=$BUFFER \
|
||||
COMP_POINT=0 \
|
||||
bower completion -- "${words[@]}" \
|
||||
2>/dev/null)
|
||||
IFS=$si
|
||||
}
|
||||
compdef _bower_completion bower
|
||||
elif type compctl &>/dev/null; then
|
||||
_bower_completion () {
|
||||
local cword line point words si
|
||||
read -Ac words
|
||||
read -cn cword
|
||||
let cword-=1
|
||||
read -l line
|
||||
read -ln point
|
||||
si="$IFS"
|
||||
IFS=$'\n' reply=($(COMP_CWORD="$cword" \
|
||||
COMP_LINE="$line" \
|
||||
COMP_POINT="$point" \
|
||||
bower completion -- "${words[@]}" \
|
||||
2>/dev/null)) || return $?
|
||||
IFS="$si"
|
||||
}
|
||||
compctl -K _bower_completion bower
|
||||
fi
|
||||
###-end-bower-completion-###
|
||||
|
81
oh-my-zsh/plugins/bower/bower.plugin.zsh
Normal file
81
oh-my-zsh/plugins/bower/bower.plugin.zsh
Normal file
|
@ -0,0 +1,81 @@
|
|||
alias bi="bower install"
|
||||
alias bl="bower list"
|
||||
alias bs="bower search"
|
||||
|
||||
_bower_installed_packages () {
|
||||
bower_package_list=$(bower ls --no-color 2>/dev/null| awk 'NR>3{print p}{p=$0}'| cut -d ' ' -f 2|sed 's/#.*//')
|
||||
}
|
||||
_bower ()
|
||||
{
|
||||
local -a _1st_arguments _no_color _dopts _save_dev _force_lastest _production
|
||||
local expl
|
||||
typeset -A opt_args
|
||||
|
||||
_no_color=('--no-color[Do not print colors (available in all commands)]')
|
||||
|
||||
_dopts=(
|
||||
'(--save)--save[Save installed packages into the project"s bower.json dependencies]'
|
||||
'(--force)--force[Force fetching remote resources even if a local copy exists on disk]'
|
||||
)
|
||||
|
||||
_save_dev=('(--save-dev)--save-dev[Save installed packages into the project"s bower.json devDependencies]')
|
||||
|
||||
_force_lastest=('(--force-latest)--force-latest[Force latest version on conflict]')
|
||||
|
||||
_production=('(--production)--production[Do not install project devDependencies]')
|
||||
|
||||
_1st_arguments=(
|
||||
'cache-clean:Clean the Bower cache, or the specified package caches' \
|
||||
'help:Display help information about Bower' \
|
||||
'info:Version info and description of a particular package' \
|
||||
'init:Interactively create a bower.json file' \
|
||||
'install:Install a package locally' \
|
||||
'link:Symlink a package folder' \
|
||||
'lookup:Look up a package URL by name' \
|
||||
'register:Register a package' \
|
||||
'search:Search for a package by name' \
|
||||
'uninstall:Remove a package' \
|
||||
'update:Update a package' \
|
||||
{ls,list}:'[List all installed packages]'
|
||||
)
|
||||
_arguments \
|
||||
$_no_color \
|
||||
'*:: :->subcmds' && return 0
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "bower subcommand" _1st_arguments
|
||||
return
|
||||
fi
|
||||
|
||||
case "$words[1]" in
|
||||
install)
|
||||
_arguments \
|
||||
$_dopts \
|
||||
$_save_dev \
|
||||
$_force_lastest \
|
||||
$_no_color \
|
||||
$_production
|
||||
;;
|
||||
update)
|
||||
_arguments \
|
||||
$_dopts \
|
||||
$_no_color \
|
||||
$_force_lastest
|
||||
_bower_installed_packages
|
||||
compadd "$@" $(echo $bower_package_list)
|
||||
;;
|
||||
uninstall)
|
||||
_arguments \
|
||||
$_no_color \
|
||||
$_dopts
|
||||
_bower_installed_packages
|
||||
compadd "$@" $(echo $bower_package_list)
|
||||
;;
|
||||
*)
|
||||
$_no_color \
|
||||
;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
compdef _bower bower
|
84
oh-my-zsh/plugins/brew-cask/brew-cask.plugin.zsh
Normal file
84
oh-my-zsh/plugins/brew-cask/brew-cask.plugin.zsh
Normal file
|
@ -0,0 +1,84 @@
|
|||
# Autocompletion for homebrew-cask.
|
||||
#
|
||||
# This script intercepts calls to the brew plugin and adds autocompletion
|
||||
# for the cask subcommand.
|
||||
#
|
||||
# Author: https://github.com/pstadler
|
||||
|
||||
compdef _brew-cask brew
|
||||
|
||||
_brew-cask()
|
||||
{
|
||||
local curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
':command:->command' \
|
||||
':subcmd:->subcmd' \
|
||||
'*::options:->options'
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
__call_original_brew
|
||||
cask_commands=(
|
||||
'cask:manage casks'
|
||||
)
|
||||
_describe -t commands 'brew cask command' cask_commands ;;
|
||||
|
||||
(subcmd)
|
||||
case "$line[1]" in
|
||||
cask)
|
||||
if (( CURRENT == 3 )); then
|
||||
local -a subcommands
|
||||
subcommands=(
|
||||
"alfred:used to modify Alfred's scope to include the Caskroom"
|
||||
'audit:verifies installability of casks'
|
||||
'checklinks:checks for bad cask links'
|
||||
'cleanup:cleans up cached downloads'
|
||||
'create:creates a cask of the given name and opens it in an editor'
|
||||
'doctor:checks for configuration issues'
|
||||
'edit:edits the cask of the given name'
|
||||
'fetch:downloads Cask resources to local cache'
|
||||
'home:opens the homepage of the cask of the given name'
|
||||
'info:displays information about the cask of the given name'
|
||||
'install:installs the cask of the given name'
|
||||
'list:with no args, lists installed casks; given installed casks, lists installed files'
|
||||
'search:searches all known casks'
|
||||
'uninstall:uninstalls the cask of the given name'
|
||||
"update:a synonym for 'brew update'"
|
||||
)
|
||||
_describe -t commands "brew cask subcommand" subcommands
|
||||
fi ;;
|
||||
|
||||
*)
|
||||
__call_original_brew ;;
|
||||
esac ;;
|
||||
|
||||
(options)
|
||||
local -a casks installed_casks
|
||||
local expl
|
||||
case "$line[2]" in
|
||||
list|uninstall)
|
||||
__brew_installed_casks
|
||||
_wanted installed_casks expl 'installed casks' compadd -a installed_casks ;;
|
||||
audit|edit|home|info|install)
|
||||
__brew_all_casks
|
||||
_wanted casks expl 'all casks' compadd -a casks ;;
|
||||
esac ;;
|
||||
esac
|
||||
}
|
||||
|
||||
__brew_all_casks() {
|
||||
casks=(`brew cask search`)
|
||||
}
|
||||
|
||||
__brew_installed_casks() {
|
||||
installed_casks=(`brew cask list`)
|
||||
}
|
||||
|
||||
__call_original_brew()
|
||||
{
|
||||
local ret=1
|
||||
_call_function ret _brew
|
||||
compdef _brew-cask brew
|
||||
}
|
108
oh-my-zsh/plugins/brew/_brew
Normal file
108
oh-my-zsh/plugins/brew/_brew
Normal file
|
@ -0,0 +1,108 @@
|
|||
#compdef brew
|
||||
#autoload
|
||||
|
||||
# imported from the latest homebrew contributions
|
||||
|
||||
_brew_all_formulae() {
|
||||
formulae=(`brew search`)
|
||||
}
|
||||
|
||||
_brew_installed_formulae() {
|
||||
installed_formulae=(`brew list`)
|
||||
}
|
||||
|
||||
_brew_installed_taps() {
|
||||
installed_taps=(`brew tap`)
|
||||
}
|
||||
|
||||
_brew_outdated_formulae() {
|
||||
outdated_formulae=(`brew outdated`)
|
||||
}
|
||||
|
||||
local -a _1st_arguments
|
||||
_1st_arguments=(
|
||||
'audit:check formulae for Homebrew coding style'
|
||||
'cat:display formula file for a formula'
|
||||
'cleanup:uninstall unused and old versions of packages'
|
||||
'commands:show a list of commands'
|
||||
'create:create a new formula'
|
||||
'deps:list dependencies of a formula'
|
||||
'doctor:audits your installation for common issues'
|
||||
'edit:edit a formula'
|
||||
'fetch:download formula resources to the cache'
|
||||
'gist-logs:generate a gist of the full build logs'
|
||||
'home:visit the homepage of a formula or the brew project'
|
||||
'info:information about a formula'
|
||||
'install:install a formula'
|
||||
'reinstall:install a formula anew; re-using its current options'
|
||||
'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 formulae for which a newer version is available'
|
||||
'pin:pin specified formulae'
|
||||
'postinstall:perform post_install for a given formula'
|
||||
'prune:remove dead links'
|
||||
'remove:remove a formula'
|
||||
'search:search for a formula (/regex/ or string)'
|
||||
'switch:switch linkage between installed versions of a formula'
|
||||
'tap:tap a new formula repository from GitHub, or list existing taps'
|
||||
'test-bot:test a formula and build a bottle'
|
||||
'uninstall:uninstall a formula'
|
||||
'unlink:unlink a formula'
|
||||
'unpin:unpin specified formulae'
|
||||
'untap:remove a tapped repository'
|
||||
'update:pull latest repository'
|
||||
'upgrade:upgrade outdated formulae'
|
||||
'uses:show formulae which depend on a formula'
|
||||
)
|
||||
|
||||
local expl
|
||||
local -a formulae installed_formulae installed_taps outdated_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]' \
|
||||
'(--force)--force[brew force]' \
|
||||
'*:: :->subcmds' && return 0
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "brew subcommand" _1st_arguments
|
||||
return
|
||||
fi
|
||||
|
||||
case "$words[1]" in
|
||||
install|reinstall|audit|home|homepage|log|info|abv|uses|cat|deps|edit|options)
|
||||
_brew_all_formulae
|
||||
_wanted formulae expl 'all formulae' compadd -a formulae ;;
|
||||
list|ls)
|
||||
_arguments \
|
||||
'(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \
|
||||
'(--pinned)--pinned[list all versions of pinned formulae]' \
|
||||
'(--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 ;;
|
||||
remove|rm|uninstall|unlink|cleanup|link|ln|pin|unpin)
|
||||
_brew_installed_formulae
|
||||
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;;
|
||||
search|-S)
|
||||
_arguments \
|
||||
'(--macports)--macports[search the macports repository]' \
|
||||
'(--fink)--fink[search the fink repository]' ;;
|
||||
untap)
|
||||
_brew_installed_taps
|
||||
_wanted installed_taps expl 'installed taps' compadd -a installed_taps ;;
|
||||
upgrade)
|
||||
_brew_outdated_formulae
|
||||
_wanted outdated_formulae expl 'outdated formulae' compadd -a outdated_formulae ;;
|
||||
esac
|
2
oh-my-zsh/plugins/brew/brew.plugin.zsh
Normal file
2
oh-my-zsh/plugins/brew/brew.plugin.zsh
Normal file
|
@ -0,0 +1,2 @@
|
|||
alias brews='brew list -1'
|
||||
alias bubu="brew update && brew upgrade && brew cleanup"
|
49
oh-my-zsh/plugins/bundler/README.md
Normal file
49
oh-my-zsh/plugins/bundler/README.md
Normal file
|
@ -0,0 +1,49 @@
|
|||
# Bundler
|
||||
|
||||
- adds completion for basic bundler commands
|
||||
- adds short aliases for common bundler commands
|
||||
- `be` aliased to `bundle exec`
|
||||
- `bl` aliased to `bundle list`
|
||||
- `bp` aliased to `bundle package`
|
||||
- `bo` aliased to `bundle open`
|
||||
- `bu` aliased to `bundle update`
|
||||
- `bi` aliased to `bundle install --jobs=<cpu core count>` (only for bundler `>= 1.4.0`)
|
||||
- adds a wrapper for common gems:
|
||||
- looks for a binstub under `./bin/` and executes it (if present)
|
||||
- calls `bundle exec <gem executable>` otherwise
|
||||
|
||||
For a full list of *common gems* being wrapped by default please look at the `bundler.plugin.zsh` file.
|
||||
|
||||
## Configuration
|
||||
|
||||
Please use the exact name of the executable and not the gem name.
|
||||
|
||||
### Add additional gems to be wrapped
|
||||
|
||||
Add this before the plugin-list in your `.zshrc`:
|
||||
```sh
|
||||
BUNDLED_COMMANDS=(rubocop)
|
||||
plugins=(... bundler ...)
|
||||
```
|
||||
This will add the wrapper for the `rubocop` gem (i.e. the executable).
|
||||
|
||||
|
||||
### Exclude gems from being wrapped
|
||||
|
||||
Add this before the plugin-list in your `.zshrc`:
|
||||
```sh
|
||||
UNBUNDLED_COMMANDS=(foreman spin)
|
||||
plugins=(... bundler ...)
|
||||
```
|
||||
This will exclude the `foreman` and `spin` gems (i.e. their executable) from being wrapped.
|
||||
|
||||
## Excluded gems
|
||||
|
||||
These gems should not be called with `bundle exec`. Please see the Issues on GitHub for clarification.
|
||||
|
||||
`berks`
|
||||
`foreman`
|
||||
`mailcatcher`
|
||||
`rails`
|
||||
`ruby`
|
||||
`spin`
|
104
oh-my-zsh/plugins/bundler/_bundler
Normal file
104
oh-my-zsh/plugins/bundler/_bundler
Normal file
|
@ -0,0 +1,104 @@
|
|||
#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]" \
|
||||
"outdated[Show all of the outdated gems in the current 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]" \
|
||||
"platform[Displays platform compatibility information]" \
|
||||
"clean[Cleans up unused gems in your bundler directory]" \
|
||||
"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' \
|
||||
'outdated' \
|
||||
'console' \
|
||||
'open' \
|
||||
'viz' \
|
||||
'init' \
|
||||
'gem' \
|
||||
'platform' \
|
||||
'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
|
||||
;;
|
||||
clean)
|
||||
_arguments \
|
||||
'(--force)--force[forces clean even if --path is not set]' \
|
||||
'(--dry-run)--dry-run[only print out changes, do not actually clean gems]' \
|
||||
'(--no-color)--no-color[Disable colorization in output]' \
|
||||
'(--verbose)--verbose[Enable verbose output mode]'
|
||||
ret=0
|
||||
;;
|
||||
outdated)
|
||||
_arguments \
|
||||
'(--pre)--pre[Check for newer pre-release gems]' \
|
||||
'(--source)--source[Check against a specific source]' \
|
||||
'(--local)--local[Do not attempt to fetch gems remotely and use the gem cache instead]' \
|
||||
'(--no-color)--no-color[Disable colorization in output]' \
|
||||
'(--verbose)--verbose[Enable verbose output mode]'
|
||||
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
|
110
oh-my-zsh/plugins/bundler/bundler.plugin.zsh
Normal file
110
oh-my-zsh/plugins/bundler/bundler.plugin.zsh
Normal file
|
@ -0,0 +1,110 @@
|
|||
alias be="bundle exec"
|
||||
alias bl="bundle list"
|
||||
alias bp="bundle package"
|
||||
alias bo="bundle open"
|
||||
alias bu="bundle update"
|
||||
alias bi="bundle_install"
|
||||
|
||||
bundled_commands=(
|
||||
annotate
|
||||
cap
|
||||
capify
|
||||
cucumber
|
||||
foodcritic
|
||||
guard
|
||||
irb
|
||||
jekyll
|
||||
kitchen
|
||||
knife
|
||||
middleman
|
||||
nanoc
|
||||
pry
|
||||
puma
|
||||
rackup
|
||||
rainbows
|
||||
rake
|
||||
rspec
|
||||
shotgun
|
||||
sidekiq
|
||||
spec
|
||||
spork
|
||||
spring
|
||||
strainer
|
||||
tailor
|
||||
taps
|
||||
thin
|
||||
thor
|
||||
unicorn
|
||||
unicorn_rails
|
||||
)
|
||||
|
||||
# Remove $UNBUNDLED_COMMANDS from the bundled_commands list
|
||||
for cmd in $UNBUNDLED_COMMANDS; do
|
||||
bundled_commands=(${bundled_commands#$cmd});
|
||||
done
|
||||
|
||||
# Add $BUNDLED_COMMANDS to the bundled_commands list
|
||||
for cmd in $BUNDLED_COMMANDS; do
|
||||
bundled_commands+=($cmd);
|
||||
done
|
||||
|
||||
## Functions
|
||||
|
||||
bundle_install() {
|
||||
if _bundler-installed && _within-bundled-project; then
|
||||
local bundler_version=`bundle version | cut -d' ' -f3`
|
||||
if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then
|
||||
if [[ "$OSTYPE" = darwin* ]]
|
||||
then
|
||||
local cores_num="$(sysctl hw.ncpu | awk '{print $2}')"
|
||||
else
|
||||
local cores_num="$(nproc)"
|
||||
fi
|
||||
bundle install --jobs=$cores_num $@
|
||||
else
|
||||
bundle install $@
|
||||
fi
|
||||
else
|
||||
echo "Can't 'bundle install' outside a bundled project"
|
||||
fi
|
||||
}
|
||||
|
||||
_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
|
||||
}
|
||||
|
||||
_binstubbed() {
|
||||
[ -f "./bin/${1}" ]
|
||||
}
|
||||
|
||||
_run-with-bundler() {
|
||||
if _bundler-installed && _within-bundled-project; then
|
||||
if _binstubbed $1; then
|
||||
./bin/$@
|
||||
else
|
||||
bundle exec $@
|
||||
fi
|
||||
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
|
13
oh-my-zsh/plugins/bwana/bwana.plugin.zsh
Normal file
13
oh-my-zsh/plugins/bwana/bwana.plugin.zsh
Normal file
|
@ -0,0 +1,13 @@
|
|||
#
|
||||
# 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
|
47
oh-my-zsh/plugins/cabal/cabal.plugin.zsh
Normal file
47
oh-my-zsh/plugins/cabal/cabal.plugin.zsh
Normal file
|
@ -0,0 +1,47 @@
|
|||
function cabal_sandbox_info() {
|
||||
cabal_files=(*.cabal(N))
|
||||
if [ $#cabal_files -gt 0 ]; then
|
||||
if [ -f cabal.sandbox.config ]; then
|
||||
echo "%{$fg[green]%}sandboxed%{$reset_color%}"
|
||||
else
|
||||
echo "%{$fg[red]%}not sandboxed%{$reset_color%}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function _cabal_commands() {
|
||||
local ret=1 state
|
||||
_arguments ':subcommand:->subcommand' && ret=0
|
||||
|
||||
case $state in
|
||||
subcommand)
|
||||
subcommands=(
|
||||
"bench:Run the benchmark, if any (configure with UserHooks)"
|
||||
"build:Make this package ready for installation"
|
||||
"check:Check the package for common mistakes"
|
||||
"clean:Clean up after a build"
|
||||
"copy:Copy teh files into the install locations"
|
||||
"configure:Prepare to build the package"
|
||||
"fetch:Downloads packages for later installation"
|
||||
"haddock:Generate HAddock HTML documentation"
|
||||
"help:Help about commands"
|
||||
"hscolour:Generate HsColour colourised code, in HTML format"
|
||||
"info:Display detailed information about a particular package"
|
||||
"init:Interactively create a .cabal file"
|
||||
"install:Installs a list of packages"
|
||||
"list:List packages matching a search string"
|
||||
"register:Register this package with the compiler"
|
||||
"report:Upload build reports to a remote server"
|
||||
"sdist:Generate a source distribution file (.tar.gz)"
|
||||
"test:Run the test suite, if any (configure with UserHooks)"
|
||||
"unpack:Unpacks packages for user inspection"
|
||||
"update:Updates list of known packages"
|
||||
"upload:Uploads source packages to Hackage"
|
||||
)
|
||||
_describe -t subcommands 'cabal subcommands' subcommands && ret=0
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
compdef _cabal_commands cabal
|
33
oh-my-zsh/plugins/cake/cake.plugin.zsh
Normal file
33
oh-my-zsh/plugins/cake/cake.plugin.zsh
Normal file
|
@ -0,0 +1,33 @@
|
|||
# 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
|
||||
|
||||
[ ! -f ${_cake_task_cache_file} ] && return 0;
|
||||
[ ${_cake_task_cache_file} -nt Cakefile ] && return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
_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
|
10
oh-my-zsh/plugins/capistrano/_capistrano
Normal file
10
oh-my-zsh/plugins/capistrano/_capistrano
Normal file
|
@ -0,0 +1,10 @@
|
|||
#compdef cap
|
||||
#autoload
|
||||
|
||||
if [[ -f config/deploy.rb || -f Capfile ]]; then
|
||||
if [[ ! -f .cap_tasks~ || config/deploy.rb -nt .cap_tasks~ ]]; then
|
||||
echo "\nGenerating .cap_tasks~..." > /dev/stderr
|
||||
cap -v --tasks | grep '#' | cut -d " " -f 2 > .cap_tasks~
|
||||
fi
|
||||
compadd `cat .cap_tasks~`
|
||||
fi
|
17
oh-my-zsh/plugins/catimg/catimg.plugin.zsh
Normal file
17
oh-my-zsh/plugins/catimg/catimg.plugin.zsh
Normal file
|
@ -0,0 +1,17 @@
|
|||
################################################################################
|
||||
# catimg script by Eduardo San Martin Morote aka Posva #
|
||||
# http://posva.net #
|
||||
# #
|
||||
# Ouput the content of an image to the stdout using the 256 colors of the #
|
||||
# terminal. #
|
||||
# Github: https://github.com/posva/catimg #
|
||||
################################################################################
|
||||
|
||||
|
||||
function catimg() {
|
||||
if [[ -x `which convert` ]]; then
|
||||
zsh $ZSH/plugins/catimg/catimg.sh $@
|
||||
else
|
||||
echo "catimg need convert (ImageMagick) to work)"
|
||||
fi
|
||||
}
|
88
oh-my-zsh/plugins/catimg/catimg.sh
Executable file
88
oh-my-zsh/plugins/catimg/catimg.sh
Executable file
|
@ -0,0 +1,88 @@
|
|||
################################################################################
|
||||
# catimg script by Eduardo San Martin Morote aka Posva #
|
||||
# http://posva.net #
|
||||
# #
|
||||
# Ouput the content of an image to the stdout using the 256 colors of the #
|
||||
# terminal. #
|
||||
# Github: https://github.com/posva/catimg #
|
||||
################################################################################
|
||||
|
||||
function help() {
|
||||
echo "Usage catimg [-h] [-w width] [-c char] img"
|
||||
echo "By default char is \" \" and w is the terminal width"
|
||||
}
|
||||
|
||||
# VARIABLES
|
||||
COLOR_FILE=$(dirname $0)/colors.png
|
||||
CHAR=" "
|
||||
|
||||
WIDTH=""
|
||||
IMG=""
|
||||
|
||||
while getopts qw:c:h opt; do
|
||||
case "$opt" in
|
||||
w) WIDTH="$OPTARG" ;;
|
||||
c) CHAR="$OPTARG" ;;
|
||||
h) help; exit ;;
|
||||
*) help ; exit 1;;
|
||||
esac
|
||||
done
|
||||
|
||||
while [ "$1" ]; do
|
||||
IMG="$1"
|
||||
shift
|
||||
done
|
||||
|
||||
if [ "$IMG" = "" -o ! -f "$IMG" ]; then
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! "$WIDTH" ]; then
|
||||
COLS=$(expr $(tput cols) "/" $(echo -n "$CHAR" | wc -c))
|
||||
else
|
||||
COLS=$(expr $WIDTH "/" $(echo -n "$CHAR" | wc -c))
|
||||
fi
|
||||
WIDTH=$(convert "$IMG" -print "%w\n" /dev/null)
|
||||
if [ "$WIDTH" -gt "$COLS" ]; then
|
||||
WIDTH=$COLS
|
||||
fi
|
||||
|
||||
REMAP=""
|
||||
if convert "$IMG" -resize $COLS\> +dither -remap $COLOR_FILE /dev/null ; then
|
||||
REMAP="-remap $COLOR_FILE"
|
||||
else
|
||||
echo "The version of convert is too old, don't expect good results :(" >&2
|
||||
#convert "$IMG" -colors 256 PNG8:tmp.png
|
||||
#IMG="tmp.png"
|
||||
fi
|
||||
|
||||
# Display the image
|
||||
I=0
|
||||
convert "$IMG" -resize $COLS\> +dither `echo $REMAP` txt:- 2>/dev/null |
|
||||
sed -e 's/.*none.*/NO NO NO/g' -e '1d;s/^.*(\(.*\)[,)].*$/\1/g;y/,/ /' |
|
||||
while read R G B f; do
|
||||
if [ ! "$R" = "NO" ]; then
|
||||
if [ "$R" -eq "$G" -a "$G" -eq "$B" ]; then
|
||||
((
|
||||
I++,
|
||||
IDX = 232 + R * 23 / 255
|
||||
))
|
||||
else
|
||||
((
|
||||
I++,
|
||||
IDX = 16
|
||||
+ R * 5 / 255 * 36
|
||||
+ G * 5 / 255 * 6
|
||||
+ B * 5 / 255
|
||||
))
|
||||
fi
|
||||
#echo "$R,$G,$B: $IDX"
|
||||
echo -ne "\e[48;5;${IDX}m${CHAR}"
|
||||
else
|
||||
(( I++ ))
|
||||
echo -ne "\e[0m${CHAR}"
|
||||
fi
|
||||
# New lines
|
||||
(( $I % $WIDTH )) || echo -e "\e[0m"
|
||||
done
|
BIN
oh-my-zsh/plugins/catimg/colors.png
Normal file
BIN
oh-my-zsh/plugins/catimg/colors.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 353 B |
129
oh-my-zsh/plugins/celery/_celery
Normal file
129
oh-my-zsh/plugins/celery/_celery
Normal file
|
@ -0,0 +1,129 @@
|
|||
#compdef celery
|
||||
#autoload
|
||||
|
||||
#celery zsh completion
|
||||
|
||||
_celery () {
|
||||
local -a _1st_arguments ifargs dopts controlargs
|
||||
|
||||
typeset -A opt_args
|
||||
|
||||
_1st_arguments=('worker' 'events' 'beat' 'shell' 'multi' 'amqp' 'status' 'inspect' \
|
||||
'control' 'purge' 'list' 'migrate' 'call' 'result' 'report')
|
||||
ifargs=('--app=' '--broker=' '--loader=' '--config=' '--version')
|
||||
dopts=('--detach' '--umask=' '--gid=' '--uid=' '--pidfile=' '--logfile=' '--loglevel=')
|
||||
controlargs=('--timeout' '--destination')
|
||||
_arguments \
|
||||
'(-A --app=)'{-A,--app}'[app instance to use (e.g. module.attr_name):APP]' \
|
||||
'(-b --broker=)'{-b,--broker}'[url to broker. default is "amqp://guest@localhost//":BROKER]' \
|
||||
'(--loader)--loader[name of custom loader class to use.:LOADER]' \
|
||||
'(--config)--config[Name of the configuration module:CONFIG]' \
|
||||
'(--workdir)--workdir[Optional directory to change to after detaching.:WORKING_DIRECTORY]' \
|
||||
'(-q --quiet)'{-q,--quiet}'[Don"t show as much output.]' \
|
||||
'(-C --no-color)'{-C,--no-color}'[Don"t display colors.]' \
|
||||
'(--version)--version[show program"s version number and exit]' \
|
||||
'(- : *)'{-h,--help}'[show this help message and exit]' \
|
||||
'*:: :->subcmds' && return 0
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "celery subcommand" _1st_arguments
|
||||
return
|
||||
fi
|
||||
|
||||
case "$words[1]" in
|
||||
worker)
|
||||
_arguments \
|
||||
'(-C --concurrency=)'{-C,--concurrency=}'[Number of child processes processing the queue. The default is the number of CPUs.]' \
|
||||
'(--pool)--pool=:::(processes eventlet gevent threads solo)' \
|
||||
'(--purge --discard)'{--discard,--purge}'[Purges all waiting tasks before the daemon is started.]' \
|
||||
'(-f --logfile=)'{-f,--logfile=}'[Path to log file. If no logfile is specified, stderr is used.]' \
|
||||
'(--loglevel=)--loglevel=:::(critical error warning info debug)' \
|
||||
'(-N --hostname=)'{-N,--hostname=}'[Set custom hostname, e.g. "foo.example.com".]' \
|
||||
'(-B --beat)'{-B,--beat}'[Also run the celerybeat periodic task scheduler.]' \
|
||||
'(-s --schedule=)'{-s,--schedule=}'[Path to the schedule database if running with the -B option. Defaults to celerybeat-schedule.]' \
|
||||
'(-S --statedb=)'{-S,--statedb=}'[Path to the state database.Default: None]' \
|
||||
'(-E --events)'{-E,--events}'[Send events that can be captured by monitors like celeryev, celerymon, and others.]' \
|
||||
'(--time-limit=)--time-limit=[nables a hard time limit (in seconds int/float) for tasks]' \
|
||||
'(--soft-time-limit=)--soft-time-limit=[Enables a soft time limit (in seconds int/float) for tasks]' \
|
||||
'(--maxtasksperchild=)--maxtasksperchild=[Maximum number of tasks a pool worker can execute before it"s terminated and replaced by a new worker.]' \
|
||||
'(-Q --queues=)'{-Q,--queues=}'[List of queues to enable for this worker, separated by comma. By default all configured queues are enabled.]' \
|
||||
'(-I --include=)'{-I,--include=}'[Comma separated list of additional modules to import.]' \
|
||||
'(--pidfile=)--pidfile=[Optional file used to store the process pid.]' \
|
||||
'(--autoscale=)--autoscale=[Enable autoscaling by providing max_concurrency, min_concurrency.]' \
|
||||
'(--autoreload)--autoreload[Enable autoreloading.]' \
|
||||
'(--no-execv)--no-execv[Don"t do execv after multiprocessing child fork.]'
|
||||
compadd -a ifargs
|
||||
;;
|
||||
inspect)
|
||||
_values -s \
|
||||
'active[dump active tasks (being processed)]' \
|
||||
'active_queues[dump queues being consumed from]' \
|
||||
'ping[ping worker(s)]' \
|
||||
'registered[dump of registered tasks]' \
|
||||
'report[get bugreport info]' \
|
||||
'reserved[dump reserved tasks (waiting to be processed)]' \
|
||||
'revoked[dump of revoked task ids]' \
|
||||
'scheduled[dump scheduled tasks (eta/countdown/retry)]' \
|
||||
'stats[dump worker statistics]'
|
||||
compadd -a controlargs ifargs
|
||||
;;
|
||||
control)
|
||||
_values -s \
|
||||
'add_consumer[tell worker(s) to start consuming a queue]' \
|
||||
'autoscale[change autoscale settings]' \
|
||||
'cancel_consumer[tell worker(s) to stop consuming a queue]' \
|
||||
'disable_events[tell worker(s) to disable events]' \
|
||||
'enable_events[tell worker(s) to enable events]' \
|
||||
'pool_grow[start more pool processes]' \
|
||||
'pool_shrink[use less pool processes]' \
|
||||
'rate_limit[tell worker(s) to modify the rate limit for a task type]' \
|
||||
'time_limit[tell worker(s) to modify the time limit for a task type.]'
|
||||
compadd -a controlargs ifargs
|
||||
;;
|
||||
multi)
|
||||
_values -s \
|
||||
'--nosplash[Don"t display program info.]' \
|
||||
'--verbose[Show more output.]' \
|
||||
'--no-color[Don"t display colors.]' \
|
||||
'--quiet[Don"t show as much output.]' \
|
||||
'start' 'restart' 'stopwait' 'stop' 'show' \
|
||||
'names' 'expand' 'get' 'kill'
|
||||
compadd -a ifargs
|
||||
;;
|
||||
amqp)
|
||||
_values -s \
|
||||
'queue.declare' 'queue.purge' 'exchange.delete' 'basic.publish' \
|
||||
'exchange.declare' 'queue.delete' 'queue.bind' 'basic.get'
|
||||
;;
|
||||
list)
|
||||
_values -s, 'bindings'
|
||||
;;
|
||||
shell)
|
||||
_values -s \
|
||||
'--ipython[force iPython.]' \
|
||||
'--bpython[force bpython.]' \
|
||||
'--python[force default Python shell.]' \
|
||||
'--without-tasks[don"t add tasks to locals.]' \
|
||||
'--eventlet[use eventlet.]' \
|
||||
'--gevent[use gevent.]'
|
||||
compadd -a ifargs
|
||||
;;
|
||||
beat)
|
||||
_arguments \
|
||||
'(-s --schedule=)'{-s,--schedule=}'[Path to the schedule database. Defaults to celerybeat-schedule.]' \
|
||||
'(-S --scheduler=)'{-S,--scheduler=}'[Scheduler class to use. Default is celery.beat.PersistentScheduler.]' \
|
||||
'(--max-interval)--max-interval[]'
|
||||
compadd -a dopts fargs
|
||||
;;
|
||||
events)
|
||||
_arguments \
|
||||
'(-d --dump)'{-d,--dump}'[Dump events to stdout.]' \
|
||||
'(-c --camera=)'{-c,--camera=}'[Take snapshots of events using this camera.]' \
|
||||
'(-F --frequency=)'{-F,--frequency=}'[Camera: Shutter frequency. Default is every 1.0 seconds.]' \
|
||||
'(-r --maxrate=)'{-r,--maxrate=}'[Camera: Optional shutter rate limit (e.g. 10/m).]'
|
||||
compadd -a dopts fargs
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
}
|
99
oh-my-zsh/plugins/chruby/chruby.plugin.zsh
Normal file
99
oh-my-zsh/plugins/chruby/chruby.plugin.zsh
Normal file
|
@ -0,0 +1,99 @@
|
|||
#
|
||||
# INSTRUCTIONS
|
||||
#
|
||||
# With either a manual or brew installed chruby things should just work.
|
||||
#
|
||||
# If you'd prefer to specify an explicit path to load chruby from
|
||||
# you can set variables like so:
|
||||
#
|
||||
# zstyle :omz:plugins:chruby path /local/path/to/chruby.sh
|
||||
# zstyle :omz:plugins:chruby auto /local/path/to/auto.sh
|
||||
#
|
||||
# TODO
|
||||
# - autodetermine correct source path on non OS X systems
|
||||
# - completion if ruby-install exists
|
||||
|
||||
# rvm and rbenv plugins also provide this alias
|
||||
alias rubies='chruby'
|
||||
|
||||
local _chruby_path
|
||||
local _chruby_auto
|
||||
|
||||
_homebrew-installed() {
|
||||
whence brew &> /dev/null
|
||||
}
|
||||
|
||||
_chruby-from-homebrew-installed() {
|
||||
[ -r $(brew --prefix chruby)] &> /dev/null
|
||||
}
|
||||
|
||||
_ruby-build_installed() {
|
||||
whence ruby-build &> /dev/null
|
||||
}
|
||||
|
||||
_ruby-install-installed() {
|
||||
whence ruby-install &> /dev/null
|
||||
}
|
||||
|
||||
# Simple definition completer for ruby-build
|
||||
if _ruby-build_installed; then
|
||||
_ruby-build() { compadd $(ruby-build --definitions) }
|
||||
compdef _ruby-build ruby-build
|
||||
fi
|
||||
|
||||
_source_from_omz_settings() {
|
||||
zstyle -s :omz:plugins:chruby path _chruby_path
|
||||
zstyle -s :omz:plugins:chruby auto _chruby_auto
|
||||
|
||||
if ${_chruby_path} && [[ -r ${_chruby_path} ]]; then
|
||||
source ${_chruby_path}
|
||||
fi
|
||||
|
||||
if ${_chruby_auto} && [[ -r ${_chruby_auto} ]]; then
|
||||
source ${_chruby_auto}
|
||||
fi
|
||||
}
|
||||
|
||||
_chruby_dirs() {
|
||||
chrubydirs=($HOME/.rubies/ $PREFIX/opt/rubies)
|
||||
for dir in chrubydirs; do
|
||||
if [[ -d $dir ]]; then
|
||||
RUBIES+=$dir
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
if _homebrew-installed && _chruby-from-homebrew-installed ; then
|
||||
source $(brew --prefix chruby)/share/chruby/chruby.sh
|
||||
source $(brew --prefix chruby)/share/chruby/auto.sh
|
||||
_chruby_dirs
|
||||
elif [[ -r "/usr/local/share/chruby/chruby.sh" ]] ; then
|
||||
source /usr/local/share/chruby/chruby.sh
|
||||
source /usr/local/share/chruby/auto.sh
|
||||
_chruby_dirs
|
||||
else
|
||||
_source_from_omz_settings
|
||||
_chruby_dirs
|
||||
fi
|
||||
|
||||
function ensure_chruby() {
|
||||
$(whence chruby)
|
||||
}
|
||||
|
||||
function current_ruby() {
|
||||
local _ruby
|
||||
_ruby="$(chruby |grep \* |tr -d '* ')"
|
||||
if [[ $(chruby |grep -c \*) -eq 1 ]]; then
|
||||
echo ${_ruby}
|
||||
else
|
||||
echo "system"
|
||||
fi
|
||||
}
|
||||
|
||||
function chruby_prompt_info() {
|
||||
echo "$(current_ruby)"
|
||||
}
|
||||
|
||||
# complete on installed rubies
|
||||
_chruby() { compadd $(chruby | tr -d '* ') }
|
||||
compdef _chruby chruby
|
2
oh-my-zsh/plugins/cloudapp/cloudapp.plugin.zsh
Normal file
2
oh-my-zsh/plugins/cloudapp/cloudapp.plugin.zsh
Normal file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/zsh
|
||||
alias cloudapp=$ZSH/plugins/cloudapp/cloudapp.rb
|
60
oh-my-zsh/plugins/cloudapp/cloudapp.rb
Executable file
60
oh-my-zsh/plugins/cloudapp/cloudapp.rb
Executable file
|
@ -0,0 +1,60 @@
|
|||
#!/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`
|
81
oh-my-zsh/plugins/coffee/_coffee
Normal file
81
oh-my-zsh/plugins/coffee/_coffee
Normal file
|
@ -0,0 +1,81 @@
|
|||
#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)
|
||||
# * Dong Weiming (https://github.com/dongweiming)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
local curcontext="$curcontext" state line ret=1 version opts first second third
|
||||
typeset -A opt_args
|
||||
version=(${(f)"$(_call_program version $words[1] --version)"})
|
||||
version=${${(z)${version[1]}}[3]}
|
||||
first=$(echo $version|cut -d '.' -f 1)
|
||||
second=$(echo $version|cut -d '.' -f 2)
|
||||
third=$(echo $version|cut -d '.' -f 3)
|
||||
if (( $first < 2 )) && (( $second < 7 )) && (( $third < 3 ));then
|
||||
opts+=('(-l --lint)'{-l,--lint}'[pipe the compiled JavaScript through JavaScript Lint]'
|
||||
'(-r --require)'{-r,--require}'[require a library before executing your script]:library')
|
||||
fi
|
||||
|
||||
|
||||
_arguments -C \
|
||||
'(- *)'{-h,--help}'[display this help message]' \
|
||||
'(- *)'{-v,--version}'[display the version number]' \
|
||||
$opts \
|
||||
'(-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"' \
|
||||
'(--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]' \
|
||||
'(-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
|
6
oh-my-zsh/plugins/colemak/colemak-less
Normal file
6
oh-my-zsh/plugins/colemak/colemak-less
Normal file
|
@ -0,0 +1,6 @@
|
|||
n forw-line
|
||||
e back-line
|
||||
k repeat-search
|
||||
\ek repeat-search-all
|
||||
K reverse-search
|
||||
\eK reverse-search-all
|
22
oh-my-zsh/plugins/colemak/colemak.plugin.zsh
Normal file
22
oh-my-zsh/plugins/colemak/colemak.plugin.zsh
Normal file
|
@ -0,0 +1,22 @@
|
|||
# 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/plugins/colemak/colemak-less
|
32
oh-my-zsh/plugins/colored-man/colored-man.plugin.zsh
Normal file
32
oh-my-zsh/plugins/colored-man/colored-man.plugin.zsh
Normal file
|
@ -0,0 +1,32 @@
|
|||
if [ "$OSTYPE[0,7]" = "solaris" ]
|
||||
then
|
||||
if [ ! -x ${HOME}/bin/nroff ]
|
||||
then
|
||||
mkdir -p ${HOME}/bin
|
||||
cat > ${HOME}/bin/nroff <<EOF
|
||||
#!/bin/sh
|
||||
if [ -n "\$_NROFF_U" -a "\$1,\$2,\$3" = "-u0,-Tlp,-man" ]; then
|
||||
shift
|
||||
exec /usr/bin/nroff -u\${_NROFF_U} "\$@"
|
||||
fi
|
||||
#-- Some other invocation of nroff
|
||||
exec /usr/bin/nroff "\$@"
|
||||
EOF
|
||||
chmod +x ${HOME}/bin/nroff
|
||||
fi
|
||||
fi
|
||||
|
||||
man() {
|
||||
env \
|
||||
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
|
||||
LESS_TERMCAP_md=$(printf "\e[1;31m") \
|
||||
LESS_TERMCAP_me=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_se=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
|
||||
LESS_TERMCAP_ue=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_us=$(printf "\e[1;32m") \
|
||||
PAGER=/usr/bin/less \
|
||||
_NROFF_U=1 \
|
||||
PATH=${HOME}/bin:${PATH} \
|
||||
man "$@"
|
||||
}
|
28
oh-my-zsh/plugins/colorize/colorize.plugin.zsh
Normal file
28
oh-my-zsh/plugins/colorize/colorize.plugin.zsh
Normal file
|
@ -0,0 +1,28 @@
|
|||
# Plugin for highlighting file content
|
||||
# Plugin highlights file content based on the filename extension.
|
||||
# If no highlighting method supported for given extension then it tries
|
||||
# guess it by looking for file content.
|
||||
|
||||
alias colorize='colorize_via_pygmentize'
|
||||
|
||||
colorize_via_pygmentize() {
|
||||
if [ ! -x "$(which pygmentize)" ]; then
|
||||
echo "package \'pygmentize\' is not installed!"
|
||||
return -1
|
||||
fi
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
pygmentize -g $@
|
||||
fi
|
||||
|
||||
for FNAME in $@
|
||||
do
|
||||
filename=$(basename "$FNAME")
|
||||
lexer=`pygmentize -N \"$filename\"`
|
||||
if [ "Z$lexer" != "Ztext" ]; then
|
||||
pygmentize -l $lexer "$FNAME"
|
||||
else
|
||||
pygmentize -g "$FNAME"
|
||||
fi
|
||||
done
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
# 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
|
||||
|
||||
# Arch Linux command-not-found support, you must have package pkgfile installed
|
||||
# https://wiki.archlinux.org/index.php/Pkgfile#.22Command_not_found.22_hook
|
||||
[[ -e /usr/share/doc/pkgfile/command-not-found.zsh ]] && source /usr/share/doc/pkgfile/command-not-found.zsh
|
92
oh-my-zsh/plugins/common-aliases/common-aliases.plugin.zsh
Normal file
92
oh-my-zsh/plugins/common-aliases/common-aliases.plugin.zsh
Normal file
|
@ -0,0 +1,92 @@
|
|||
# Advanced Aliases.
|
||||
# Use with caution
|
||||
#
|
||||
|
||||
# ls, the common ones I use a lot shortened for rapid fire usage
|
||||
alias l='ls -lFh' #size,show type,human readable
|
||||
alias la='ls -lAFh' #long list,show almost all,show type,human readable
|
||||
alias lr='ls -tRFh' #sorted by date,recursive,show type,human readable
|
||||
alias lt='ls -ltFh' #long list,sorted by date,show type,human readable
|
||||
alias ll='ls -l' #long list
|
||||
alias ldot='ls -ld .*'
|
||||
alias lS='ls -1FSsh'
|
||||
alias lart='ls -1Fcart'
|
||||
alias lrt='ls -1Fcrt'
|
||||
|
||||
alias zshrc='vim ~/.zshrc' # Quick access to the ~/.zshrc file
|
||||
|
||||
alias grep='grep --color'
|
||||
alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} '
|
||||
|
||||
alias t='tail -f'
|
||||
|
||||
# because typing 'cd' is A LOT of work!!
|
||||
alias ..='cd ../'
|
||||
alias ...='cd ../../'
|
||||
alias ....='cd ../../../'
|
||||
alias .....='cd ../../../../'
|
||||
|
||||
# Command line head / tail shortcuts
|
||||
alias -g H='| head'
|
||||
alias -g T='| tail'
|
||||
alias -g G='| grep'
|
||||
alias -g L="| less"
|
||||
alias -g M="| most"
|
||||
alias -g LL="2>&1 | less"
|
||||
alias -g CA="2>&1 | cat -A"
|
||||
alias -g NE="2> /dev/null"
|
||||
alias -g NUL="> /dev/null 2>&1"
|
||||
alias -g P="2>&1| pygmentize -l pytb"
|
||||
|
||||
alias dud='du -d 1 -h'
|
||||
alias duf='du -sh *'
|
||||
alias fd='find . -type d -name'
|
||||
alias ff='find . -type f -name'
|
||||
|
||||
alias h='history'
|
||||
alias hgrep="fc -El 0 | grep"
|
||||
alias help='man'
|
||||
alias p='ps -f'
|
||||
alias sortnr='sort -n -r'
|
||||
alias unexport='unset'
|
||||
|
||||
alias whereami=display_info
|
||||
|
||||
alias rm='rm -i'
|
||||
alias cp='cp -i'
|
||||
alias mv='mv -i'
|
||||
|
||||
# zsh is able to auto-do some kungfoo
|
||||
# depends on the SUFFIX :)
|
||||
if [ ${ZSH_VERSION//\./} -ge 420 ]; then
|
||||
# open browser on urls
|
||||
_browser_fts=(htm html de org net com at cx nl se dk dk php)
|
||||
for ft in $_browser_fts ; do alias -s $ft=$BROWSER ; done
|
||||
|
||||
_editor_fts=(cpp cxx cc c hh h inl asc txt TXT tex)
|
||||
for ft in $_editor_fts ; do alias -s $ft=$EDITOR ; done
|
||||
|
||||
_image_fts=(jpg jpeg png gif mng tiff tif xpm)
|
||||
for ft in $_image_fts ; do alias -s $ft=$XIVIEWER; done
|
||||
|
||||
_media_fts=(ape avi flv mkv mov mp3 mpeg mpg ogg ogm rm wav webm)
|
||||
for ft in $_media_fts ; do alias -s $ft=mplayer ; done
|
||||
|
||||
#read documents
|
||||
alias -s pdf=acroread
|
||||
alias -s ps=gv
|
||||
alias -s dvi=xdvi
|
||||
alias -s chm=xchm
|
||||
alias -s djvu=djview
|
||||
|
||||
#list whats inside packed file
|
||||
alias -s zip="unzip -l"
|
||||
alias -s rar="unrar l"
|
||||
alias -s tar="tar tf"
|
||||
alias -s tar.gz="echo "
|
||||
alias -s ace="unace l"
|
||||
fi
|
||||
|
||||
# Make zsh know about hosts already accessed by SSH
|
||||
zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })'
|
||||
|
20
oh-my-zsh/plugins/compleat/compleat.plugin.zsh
Normal file
20
oh-my-zsh/plugins/compleat/compleat.plugin.zsh
Normal file
|
@ -0,0 +1,20 @@
|
|||
# ------------------------------------------------------------------------------
|
||||
# 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
|
51
oh-my-zsh/plugins/composer/composer.plugin.zsh
Normal file
51
oh-my-zsh/plugins/composer/composer.plugin.zsh
Normal file
|
@ -0,0 +1,51 @@
|
|||
# ------------------------------------------------------------------------------
|
||||
# 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_get_required_list () {
|
||||
composer show -s --no-ansi | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }'
|
||||
}
|
||||
|
||||
_composer () {
|
||||
local curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
_arguments \
|
||||
'1: :->command'\
|
||||
'*: :->args'
|
||||
if [ -f composer.json ]; then
|
||||
case $state in
|
||||
command)
|
||||
compadd `_composer_get_command_list`
|
||||
;;
|
||||
*)
|
||||
compadd `_composer_get_required_list`
|
||||
;;
|
||||
esac
|
||||
else
|
||||
compadd create-project init search selfupdate show
|
||||
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'
|
||||
alias cdu='composer dump-autoload'
|
||||
|
||||
# install composer in the current directory
|
||||
alias cget='curl -s https://getcomposer.org/installer | php'
|
||||
|
||||
# Add Composer's global binaries to PATH
|
||||
export PATH=$PATH:~/.composer/vendor/bin
|
3
oh-my-zsh/plugins/copydir/copydir.plugin.zsh
Normal file
3
oh-my-zsh/plugins/copydir/copydir.plugin.zsh
Normal file
|
@ -0,0 +1,3 @@
|
|||
function copydir {
|
||||
pwd | tr -d "\r\n" | pbcopy
|
||||
}
|
5
oh-my-zsh/plugins/copyfile/copyfile.plugin.zsh
Normal file
5
oh-my-zsh/plugins/copyfile/copyfile.plugin.zsh
Normal file
|
@ -0,0 +1,5 @@
|
|||
function copyfile {
|
||||
[[ "$#" != 1 ]] && return 1
|
||||
local file_to_copy=$1
|
||||
cat $file_to_copy | pbcopy
|
||||
}
|
14
oh-my-zsh/plugins/cp/cp.plugin.zsh
Normal file
14
oh-my-zsh/plugins/cp/cp.plugin.zsh
Normal file
|
@ -0,0 +1,14 @@
|
|||
#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 --"
|
67
oh-my-zsh/plugins/cpanm/_cpanm
Normal file
67
oh-my-zsh/plugins/cpanm/_cpanm
Normal file
|
@ -0,0 +1,67 @@
|
|||
#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
|
227
oh-my-zsh/plugins/debian/debian.plugin.zsh
Normal file
227
oh-my-zsh/plugins/debian/debian.plugin.zsh
Normal file
|
@ -0,0 +1,227 @@
|
|||
# Authors:
|
||||
# https://github.com/AlexBio
|
||||
# https://github.com/dbb
|
||||
# https://github.com/Mappleconfusers
|
||||
#
|
||||
# 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 -p aptitude 2>&1 ) ]]; then
|
||||
apt_pref='aptitude'
|
||||
else
|
||||
apt_pref='apt-get'
|
||||
fi
|
||||
|
||||
# Use sudo by default if it's installed
|
||||
if [[ -e $( which -p 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 age='apt-get'
|
||||
alias api='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-get 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
|
||||
|
||||
# Completion ################################################################
|
||||
|
||||
#
|
||||
# Registers a compdef for $1 that calls $apt_pref with the commands $2
|
||||
# To do that it creates a new completion function called _apt_pref_$2
|
||||
#
|
||||
apt_pref_compdef() {
|
||||
local f fb
|
||||
f="_apt_pref_${2}"
|
||||
|
||||
eval "function ${f}() {
|
||||
shift words;
|
||||
service=\"\$apt_pref\";
|
||||
words=(\"\$apt_pref\" '$2' \$words);
|
||||
((CURRENT++))
|
||||
test \"\${apt_pref}\" = 'aptitude' && _aptitude || _apt
|
||||
}"
|
||||
|
||||
compdef "$f" "$1"
|
||||
}
|
||||
|
||||
apt_pref_compdef aac "autoclean"
|
||||
apt_pref_compdef abd "build-dep"
|
||||
apt_pref_compdef ac "clean"
|
||||
apt_pref_compdef ad "update"
|
||||
apt_pref_compdef afu "update"
|
||||
apt_pref_compdef ag "upgrade"
|
||||
apt_pref_compdef ai "install"
|
||||
apt_pref_compdef ail "install"
|
||||
apt_pref_compdef ap "purge"
|
||||
apt_pref_compdef ar "remove"
|
||||
apt_pref_compdef ads "dselect-upgrade"
|
||||
|
||||
# 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
|
||||
}
|
||||
|
||||
# List packages by size
|
||||
function apt-list-packages {
|
||||
dpkg-query -W --showformat='${Installed-Size} ${Package} ${Status}\n' | \
|
||||
grep -v deinstall | \
|
||||
sort -n | \
|
||||
awk '{print $1" "$2}'
|
||||
}
|
||||
|
10
oh-my-zsh/plugins/dircycle/dircycle.plugin.zsh
Normal file
10
oh-my-zsh/plugins/dircycle/dircycle.plugin.zsh
Normal file
|
@ -0,0 +1,10 @@
|
|||
##
|
||||
# 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
|
132
oh-my-zsh/plugins/dirhistory/dirhistory.plugin.zsh
Normal file
132
oh-my-zsh/plugins/dirhistory/dirhistory.plugin.zsh
Normal file
|
@ -0,0 +1,132 @@
|
|||
##
|
||||
# Navigate directory history using ALT-LEFT and ALT-RIGHT. ALT-LEFT moves back to directories
|
||||
# that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT.
|
||||
#
|
||||
|
||||
dirhistory_past=($PWD)
|
||||
dirhistory_future=()
|
||||
export dirhistory_past
|
||||
export dirhistory_future
|
||||
|
||||
export DIRHISTORY_SIZE=30
|
||||
|
||||
# Pop the last element of dirhistory_past.
|
||||
# Pass the name of the variable to return the result in.
|
||||
# Returns the element if the array was not empty,
|
||||
# otherwise returns empty string.
|
||||
function pop_past() {
|
||||
eval "$1='$dirhistory_past[$#dirhistory_past]'"
|
||||
if [[ $#dirhistory_past -gt 0 ]]; then
|
||||
dirhistory_past[$#dirhistory_past]=()
|
||||
fi
|
||||
}
|
||||
|
||||
function pop_future() {
|
||||
eval "$1='$dirhistory_future[$#dirhistory_future]'"
|
||||
if [[ $#dirhistory_future -gt 0 ]]; then
|
||||
dirhistory_future[$#dirhistory_future]=()
|
||||
fi
|
||||
}
|
||||
|
||||
# Push a new element onto the end of dirhistory_past. If the size of the array
|
||||
# is >= DIRHISTORY_SIZE, the array is shifted
|
||||
function push_past() {
|
||||
if [[ $#dirhistory_past -ge $DIRHISTORY_SIZE ]]; then
|
||||
shift dirhistory_past
|
||||
fi
|
||||
if [[ $#dirhistory_past -eq 0 || $dirhistory_past[$#dirhistory_past] != "$1" ]]; then
|
||||
dirhistory_past+=($1)
|
||||
fi
|
||||
}
|
||||
|
||||
function push_future() {
|
||||
if [[ $#dirhistory_future -ge $DIRHISTORY_SIZE ]]; then
|
||||
shift dirhistory_future
|
||||
fi
|
||||
if [[ $#dirhistory_future -eq 0 || $dirhistory_futuret[$#dirhistory_future] != "$1" ]]; then
|
||||
dirhistory_future+=($1)
|
||||
fi
|
||||
}
|
||||
|
||||
# Called by zsh when directory changes
|
||||
function chpwd() {
|
||||
push_past $PWD
|
||||
# If DIRHISTORY_CD is not set...
|
||||
if [[ -z "${DIRHISTORY_CD+x}" ]]; then
|
||||
# ... clear future.
|
||||
dirhistory_future=()
|
||||
fi
|
||||
}
|
||||
|
||||
function dirhistory_cd(){
|
||||
DIRHISTORY_CD="1"
|
||||
cd $1
|
||||
unset DIRHISTORY_CD
|
||||
}
|
||||
|
||||
# Move backward in directory history
|
||||
function dirhistory_back() {
|
||||
local cw=""
|
||||
local d=""
|
||||
# Last element in dirhistory_past is the cwd.
|
||||
|
||||
pop_past cw
|
||||
if [[ "" == "$cw" ]]; then
|
||||
# Someone overwrote our variable. Recover it.
|
||||
dirhistory_past=($PWD)
|
||||
return
|
||||
fi
|
||||
|
||||
pop_past d
|
||||
if [[ "" != "$d" ]]; then
|
||||
dirhistory_cd $d
|
||||
push_future $cw
|
||||
else
|
||||
push_past $cw
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Move forward in directory history
|
||||
function dirhistory_forward() {
|
||||
local d=""
|
||||
|
||||
pop_future d
|
||||
if [[ "" != "$d" ]]; then
|
||||
dirhistory_cd $d
|
||||
push_past $d
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Bind keys to history navigation
|
||||
function dirhistory_zle_dirhistory_back() {
|
||||
# Erase current line in buffer
|
||||
zle kill-buffer
|
||||
dirhistory_back
|
||||
zle accept-line
|
||||
}
|
||||
|
||||
function dirhistory_zle_dirhistory_future() {
|
||||
# Erase current line in buffer
|
||||
zle kill-buffer
|
||||
dirhistory_forward
|
||||
zle accept-line
|
||||
}
|
||||
|
||||
zle -N dirhistory_zle_dirhistory_back
|
||||
# xterm in normal mode
|
||||
bindkey "\e[3D" dirhistory_zle_dirhistory_back
|
||||
bindkey "\e[1;3D" dirhistory_zle_dirhistory_back
|
||||
# Putty:
|
||||
bindkey "\e\e[D" dirhistory_zle_dirhistory_back
|
||||
# GNU screen:
|
||||
bindkey "\eO3D" dirhistory_zle_dirhistory_back
|
||||
|
||||
zle -N dirhistory_zle_dirhistory_future
|
||||
bindkey "\e[3C" dirhistory_zle_dirhistory_future
|
||||
bindkey "\e[1;3C" dirhistory_zle_dirhistory_future
|
||||
bindkey "\e\e[C" dirhistory_zle_dirhistory_future
|
||||
bindkey "\eO3C" dirhistory_zle_dirhistory_future
|
||||
|
||||
|
19
oh-my-zsh/plugins/dirpersist/dirpersist.plugin.zsh
Normal file
19
oh-my-zsh/plugins/dirpersist/dirpersist.plugin.zsh
Normal file
|
@ -0,0 +1,19 @@
|
|||
# Save dirstack history to .zdirs
|
||||
# adapted from:
|
||||
# github.com/grml/grml-etc-core/blob/master/etc/zsh/zshrc#L1547
|
||||
|
||||
DIRSTACKSIZE=${DIRSTACKSIZE:-20}
|
||||
dirstack_file=${dirstack_file:-${HOME}/.zdirs}
|
||||
|
||||
if [[ -f ${dirstack_file} ]] && [[ ${#dirstack[*]} -eq 0 ]] ; then
|
||||
dirstack=( ${(f)"$(< $dirstack_file)"} )
|
||||
# "cd -" won't work after login by just setting $OLDPWD, so
|
||||
[[ -d $dirstack[1] ]] && cd $dirstack[1] && cd $OLDPWD
|
||||
fi
|
||||
|
||||
chpwd() {
|
||||
if (( $DIRSTACKSIZE <= 0 )) || [[ -z $dirstack_file ]]; then return; fi
|
||||
local -ax my_stack
|
||||
my_stack=( ${PWD} ${dirstack} )
|
||||
builtin print -l ${(u)my_stack} >! ${dirstack_file}
|
||||
}
|
241
oh-my-zsh/plugins/django/django.plugin.zsh
Normal file
241
oh-my-zsh/plugins/django/django.plugin.zsh
Normal file
|
@ -0,0 +1,241 @@
|
|||
#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-collectstatic(){
|
||||
_arguments -s : \
|
||||
'--link=-[Create a symbolic link to each file instead of copying.]:' \
|
||||
'--noinput=-[Do NOT prompt the user for input of any kind.]:' \
|
||||
'--no-post-process=-[Do NOT post process collected files.]:' \
|
||||
'--ignore=-[Ignore files or directories matching this glob-style pattern. Use multiple times to ignore more.]:' \
|
||||
'--dry-run=-[Do everything except modify the filesystem.]:' \
|
||||
'--clear=-[Clear the existing files using the storage before trying to copy or link the original file.]:' \
|
||||
'--link=-[Create a symbolic link to each file instead of copying.]:' \
|
||||
'--no-default-ignore=-[Do not ignore the common private glob-style patterns "CVS", ".*" and "*~".]:' \
|
||||
$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-startproject(){}
|
||||
|
||||
_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.'
|
||||
'collectstatic:Collect static files in a single location.'
|
||||
'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."
|
||||
"startproject:Creates a Django project directory structure for the given project name in this current 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-admin
|
||||
compdef _managepy django-admin.py
|
||||
compdef _managepy django-manage
|
19
oh-my-zsh/plugins/docker/README.md
Normal file
19
oh-my-zsh/plugins/docker/README.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
## Docker autocomplete plugin
|
||||
|
||||
- Adds autocomplete options for all docker commands.
|
||||
- Will also show containerIDs and Image names where applicable
|
||||
|
||||
####Shows help for all commands
|
||||

|
||||
|
||||
|
||||
####Shows your downloaded images where applicable
|
||||

|
||||
|
||||
|
||||
####Shows your running containers where applicable
|
||||

|
||||
|
||||
|
||||
|
||||
Maintainer : Ahmed Azaan ([@aeonazaan](https://twitter.com/aeonazaan))
|
368
oh-my-zsh/plugins/docker/_docker
Normal file
368
oh-my-zsh/plugins/docker/_docker
Normal file
|
@ -0,0 +1,368 @@
|
|||
#compdef docker
|
||||
|
||||
# Docker autocompletion for oh-my-zsh
|
||||
# Requires: Docker installed
|
||||
# Author: Azaan (@aeonazaan)
|
||||
# Updates: Bob Maerten (@bobmaerten) for Docker v0.9+
|
||||
# Paul van den Berg (@bergvandenp) for Docker v1.3+
|
||||
|
||||
|
||||
# ----- Helper functions
|
||||
# Output a selectable list of all running docker containers
|
||||
__docker_containers() {
|
||||
declare -a cont_cmd
|
||||
cont_cmd=($(docker ps | awk 'NR>1{print $1":[CON("$1")"$2"("$3")]"}'))
|
||||
_describe 'containers' cont_cmd
|
||||
}
|
||||
|
||||
# output a selectable list of all docker images
|
||||
__docker_images() {
|
||||
declare -a img_cmd
|
||||
img_cmd=($(docker images | awk 'NR>1{print $1}'))
|
||||
_describe 'images' img_cmd
|
||||
}
|
||||
|
||||
# ----- Commands
|
||||
# Seperate function for each command, makes extension easier later
|
||||
# ---------------------------
|
||||
__attach() {
|
||||
_arguments \
|
||||
'--no-stdin[Do not attach stdin]' \
|
||||
'--sig-proxy[Proxify all received signal to the process (even in non-tty mode)]'
|
||||
__docker_containers
|
||||
}
|
||||
|
||||
__build() {
|
||||
_arguments \
|
||||
'--no-cache[Do not use cache when building the image]' \
|
||||
'(-q,--quiet)'{-q,--quiet}'[Suppress the verbose output generated by the containers]' \
|
||||
'--rm[Remove intermediate containers after a successful build]' \
|
||||
'(-t,--tag=)'{-t,--tag=}'[Repository name (and optionally a tag) to be applied to the resulting image in case of success]' \
|
||||
'*:files:_files'
|
||||
}
|
||||
|
||||
__commit() {
|
||||
_arguments \
|
||||
'(-a,--author=)'{-a,--author=}'[Author (eg. "John Hannibal Smith <hannibal@a-team.com>"]' \
|
||||
'(-m,--message=)'{-m,--message=}'[Commit message]' \
|
||||
'--run=[Config automatically applied when the image is run.]'
|
||||
__docker_containers
|
||||
}
|
||||
|
||||
__cp() {
|
||||
__docker_containers
|
||||
}
|
||||
|
||||
__diff() {
|
||||
__docker_containers
|
||||
}
|
||||
|
||||
__events() {
|
||||
_arguments \
|
||||
'--since=[Show previously created events and then stream.]'
|
||||
}
|
||||
|
||||
__export() {
|
||||
__docker_containers
|
||||
}
|
||||
|
||||
__history() {
|
||||
_arguments \
|
||||
'--no-trunc=[Don''t truncate output]' \
|
||||
'(-q,--quiet)'{-q,--quiet}'[Only show numeric IDs]'
|
||||
__docker_images
|
||||
}
|
||||
|
||||
__images() {
|
||||
_arguments \
|
||||
'(-a,--all)'{-a,--all}'[Show all images (by default filter out the intermediate images used to build)]' \
|
||||
'--no-trunc[Don''t truncate output]' \
|
||||
'(-q,--quiet=)'{-q,--quiet=}'[Only show numeric IDs]' \
|
||||
'(-t,--tree=)'{-t,--tree=}'[Output graph in tree format]' \
|
||||
'(-v,--viz=)'{-v,--viz=}'[Output graph in graphviz format]'
|
||||
__docker_images
|
||||
}
|
||||
|
||||
__import() {
|
||||
_arguments '*:files:_files'
|
||||
}
|
||||
|
||||
__info() {
|
||||
# no arguments
|
||||
}
|
||||
|
||||
__insert() {
|
||||
__docker_images
|
||||
_arguments '*:files:_files'
|
||||
}
|
||||
|
||||
__inspect() {
|
||||
__docker_images
|
||||
__docker_containers
|
||||
}
|
||||
|
||||
__kill() {
|
||||
__docker_containers
|
||||
}
|
||||
|
||||
__load() {
|
||||
_arguments '*:files:_files'
|
||||
}
|
||||
|
||||
__login() {
|
||||
_arguments \
|
||||
'(-e,--email=)'{-e,-email=}'[Email]' \
|
||||
'(-p,--password=)'{-p,-password=}'[Password]' \
|
||||
'(-u,--username=)'{-u,-username=}'[Username]'
|
||||
}
|
||||
|
||||
__logs() {
|
||||
_arguments \
|
||||
'(-f,--follow)'{-f,-follow}'[Follow log output]'
|
||||
__docker_containers
|
||||
}
|
||||
|
||||
__port() {
|
||||
__docker_containers
|
||||
}
|
||||
|
||||
__top() {
|
||||
__docker_containers
|
||||
}
|
||||
|
||||
__ps() {
|
||||
_arguments \
|
||||
'(-a,--all)'{-a,--all}'[Show all containers. Only running containers are shown by default.]' \
|
||||
'--before-id=[Show only container created before Id, include non-running ones.]' \
|
||||
'(-l,--latest)'{-l,--latest}'[Show only the latest created container, include non-running ones.]' \
|
||||
'-n=[Show n last created containers, include non-running ones. default=-1.]' \
|
||||
'--no-trunc[Don''t truncate output]' \
|
||||
'(-q,--quiet)'{-q,--quiet}'[Only display numeric IDs]' \
|
||||
'(-s,--size)'{-s,--size}'[Display sizes]' \
|
||||
'--since-id=[Show only containers created since Id, include non-running ones.]'
|
||||
}
|
||||
|
||||
__pull() {
|
||||
_arguments \
|
||||
'(-t,--tag=)'{-t,--tag=}'[Download tagged image in repository]'
|
||||
}
|
||||
|
||||
__push() {
|
||||
# no arguments
|
||||
}
|
||||
|
||||
__restart() {
|
||||
_arguments \
|
||||
'(-t,--time=)'{-t,--time=}'[Number of seconds to try to stop for before killing the container. Once killed it will then be restarted. Default=10]'
|
||||
__docker_containers
|
||||
}
|
||||
|
||||
__rm() {
|
||||
_arguments \
|
||||
'(-f,--force=)'{-f,--force=}'[Force removal of running container]' \
|
||||
'(-l,--link=)'{-l,--link=}'[Remove the specified link and not the underlying container]' \
|
||||
'(-v,--volumes=)'{-v,--volumes=}'[Remove the volumes associated to the container]'
|
||||
__docker_containers
|
||||
}
|
||||
|
||||
__rmi() {
|
||||
_arguments \
|
||||
'(-f,--force=)'{-f,--force=}'[Force]'
|
||||
__docker_images
|
||||
}
|
||||
|
||||
__run() {
|
||||
_arguments \
|
||||
'(-P,--publish-all=)'{-P,--publish-all=}'[Publish all exposed ports to the host interfaces]' \
|
||||
'(-a,--attach=)'{-a,--attach=}'[Attach to stdin, stdout or stderr.]' \
|
||||
'(-c,--cpu-shares=)'{-c,--cpu-shares=}': CPU shares (relative weight)]' \
|
||||
'--cidfile=[Write the container ID to the file]' \
|
||||
'(-d,--detach=)'{-d,--detach=}'[Detached mode: Run container in the background, print new container id]' \
|
||||
'--dns=[Set custom dns servers]' \
|
||||
'(-e,--env=)'{-e,--env=}'[Set environment variables]' \
|
||||
'--entrypoint=[Overwrite the default entrypoint of the image]' \
|
||||
'--expose=[Expose a port from the container without publishing it to your host]' \
|
||||
'(-h,--hostname=)'{-h,--hostname=}'[Container host name]' \
|
||||
'(-i,--interactive=)'{-i,--interactive=}'[Keep stdin open even if not attached]' \
|
||||
'--link=[Add link to another container (name:alias)]' \
|
||||
'--lxc-conf=[Add custom lxc options -lxc-conf="lxc.cgroup.cpuset.cpus = 0,1"]' \
|
||||
'(-m,--memory=)'{-m,--memory=}'[Memory limit (format: <number><optional unit>, where unit = b, k, m or g)]' \
|
||||
'(-n,--networking=)'{-n,--networking=}'[Enable networking for this container]' \
|
||||
'--name=[Assign a name to the container]' \
|
||||
'(-p,--publish=)'{-p,--publish=}'[Publish a container''s port to the host (format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort) (use "docker port" to see the actual mapping)]' \
|
||||
'--privileged=[Give extended privileges to this container]' \
|
||||
'--rm=[Automatically remove the container when it exits (incompatible with -d)]' \
|
||||
'--sig-proxy=[Proxify all received signal to the process (even in non-tty mode)]' \
|
||||
'(-t,--tty=)'{-t,--tty=}'[Allocate a pseudo-tty]' \
|
||||
'(-u,--user=)'{-u,--user=}'[Username or UID]' \
|
||||
'(-v,--volume=)'{-v,--volume=}'[Bind mount a volume (e.g. from the host: -v /host:/container, from docker: -v /container)]' \
|
||||
'--volumes-from=[Mount volumes from the specified container(s)]' \
|
||||
'(-w,--workdir=)'{-w,--workdir=}'[Working directory inside the container]'
|
||||
__docker_images
|
||||
}
|
||||
|
||||
__search() {
|
||||
_arguments \
|
||||
'--no-trunc=[Don''t truncate output]' \
|
||||
'-s,--stars=)'{-s,--stars=}'[Only displays with at least xxx stars]' \
|
||||
'-t,--trusted=)'{-t,--trusted=}'[Only show trusted builds]'
|
||||
}
|
||||
|
||||
__save() {
|
||||
__docker_images
|
||||
}
|
||||
|
||||
__start() {
|
||||
_arguments \
|
||||
'(-a,--attach=)'{-a,--attach=}'[Attach container''s stdout/stderr and forward all signals to the process]' \
|
||||
'(-i,--interactive=)'{-i,--interactive=}'[Attach container''s stdin]'
|
||||
__docker_containers
|
||||
}
|
||||
|
||||
__stop() {
|
||||
_arguments \
|
||||
'(-t,--time=)'{-t,--time=}'[Number of seconds to wait for the container to stop before killing it.]'
|
||||
__docker_containers
|
||||
}
|
||||
|
||||
__tag() {
|
||||
_arguments \
|
||||
'(-f,--force=)'{-f,--force=}'[Force]'
|
||||
__docker_images
|
||||
}
|
||||
|
||||
__version() {
|
||||
# no arguments
|
||||
}
|
||||
|
||||
__wait() {
|
||||
__docker_containers
|
||||
}
|
||||
|
||||
__exec() {
|
||||
_arguments \
|
||||
'(-d,--detach=)'{-d,--detach=}'[Detached mode: run command in the background]' \
|
||||
'(-i,--interactive=)'{-i,--interactive=}'[Keep STDIN open even if not attached]' \
|
||||
'(-t,--tty=)'{-t,--tty=}'[Allocate a pseudo-TTY]'
|
||||
__docker_containers
|
||||
}
|
||||
|
||||
# end commands ---------
|
||||
# ----------------------
|
||||
|
||||
local -a _1st_arguments
|
||||
_1st_arguments=(
|
||||
"attach":"Attach to a running container"
|
||||
"build":"Build a container from a Dockerfile"
|
||||
"commit":"Create a new image from a container's changes"
|
||||
"cp":"Copy files/folders from the containers filesystem to the host path"
|
||||
"diff":"Inspect changes on a container's filesystem"
|
||||
"events":"Get real time events from the server"
|
||||
"export":"Stream the contents of a container as a tar archive"
|
||||
"history":"Show the history of an image"
|
||||
"images":"List images"
|
||||
"import":"Create a new filesystem image from the contents of a tarball"
|
||||
"info":"Display system-wide information"
|
||||
"insert":"Insert a file in an image"
|
||||
"inspect":"Return low-level information on a container"
|
||||
"kill":"Kill a running container"
|
||||
"load":"Load an image from a tar archive"
|
||||
"login":"Register or Login to the docker registry server"
|
||||
"logs":"Fetch the logs of a container"
|
||||
"port":"Lookup the public-facing port which is NAT-ed to PRIVATE_PORT"
|
||||
"ps":"List containers"
|
||||
"pull":"Pull an image or a repository from the docker registry server"
|
||||
"push":"Push an image or a repository to the docker registry server"
|
||||
"restart":"Restart a running container"
|
||||
"rm":"Remove one or more containers"
|
||||
"rmi":"Remove one or more images"
|
||||
"run":"Run a command in a new container"
|
||||
"save":"Save an image to a tar archive"
|
||||
"search":"Search for an image in the docker index"
|
||||
"start":"Start a stopped container"
|
||||
"stop":"Stop a running container"
|
||||
"tag":"Tag an image into a repository"
|
||||
"top":"Lookup the running processes of a container"
|
||||
"version":"Show the docker version information"
|
||||
"wait":"Block until a container stops, then print its exit code"
|
||||
"exec":"Run a task inside a running container"
|
||||
)
|
||||
|
||||
_arguments '*:: :->command'
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "docker command" _1st_arguments
|
||||
return
|
||||
fi
|
||||
|
||||
local -a _command_args
|
||||
case "$words[1]" in
|
||||
attach)
|
||||
__attach ;;
|
||||
build)
|
||||
__build ;;
|
||||
commit)
|
||||
__commit ;;
|
||||
cp)
|
||||
__cp ;;
|
||||
diff)
|
||||
__diff ;;
|
||||
events)
|
||||
__events ;;
|
||||
export)
|
||||
__export ;;
|
||||
history)
|
||||
__history ;;
|
||||
images)
|
||||
__images ;;
|
||||
import)
|
||||
__import ;;
|
||||
info)
|
||||
__info ;;
|
||||
insert)
|
||||
__insert ;;
|
||||
inspect)
|
||||
__inspect ;;
|
||||
kill)
|
||||
__kill ;;
|
||||
load)
|
||||
__load ;;
|
||||
login)
|
||||
__login ;;
|
||||
logs)
|
||||
__logs ;;
|
||||
port)
|
||||
__port ;;
|
||||
ps)
|
||||
__ps ;;
|
||||
pull)
|
||||
__pull ;;
|
||||
push)
|
||||
__push ;;
|
||||
restart)
|
||||
__restart ;;
|
||||
rm)
|
||||
__rm ;;
|
||||
rmi)
|
||||
__rmi ;;
|
||||
run)
|
||||
__run ;;
|
||||
save)
|
||||
__save ;;
|
||||
search)
|
||||
__search ;;
|
||||
start)
|
||||
__start ;;
|
||||
stop)
|
||||
__stop ;;
|
||||
tag)
|
||||
__tag ;;
|
||||
top)
|
||||
__top ;;
|
||||
version)
|
||||
__version ;;
|
||||
wait)
|
||||
__wait ;;
|
||||
exec)
|
||||
__exec ;;
|
||||
esac
|
56
oh-my-zsh/plugins/emacs/emacs.plugin.zsh
Normal file
56
oh-my-zsh/plugins/emacs/emacs.plugin.zsh
Normal file
|
@ -0,0 +1,56 @@
|
|||
# Emacs 23 daemon capability is a killing feature.
|
||||
# One emacs process handles all your frames whether
|
||||
# you use a frame opened in a terminal via a ssh connection or X frames
|
||||
# opened on the same host.
|
||||
|
||||
# Benefits are multiple
|
||||
# - You don't have the cost of starting Emacs all the time anymore
|
||||
# - Opening a file is as fast as Emacs does not have anything else to do.
|
||||
# - You can share opened buffered across opened frames.
|
||||
# - Configuration changes made at runtime are applied to all frames.
|
||||
|
||||
|
||||
if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then
|
||||
export EMACS_PLUGIN_LAUNCHER="$ZSH/plugins/emacs/emacsclient.sh"
|
||||
|
||||
# set EDITOR if not already defined.
|
||||
export EDITOR="${EDITOR:-${EMACS_PLUGIN_LAUNCHER}}"
|
||||
|
||||
alias emacs="$EMACS_PLUGIN_LAUNCHER --no-wait"
|
||||
alias e=emacs
|
||||
|
||||
# same than M-x eval but from outside Emacs.
|
||||
alias eeval="$EMACS_PLUGIN_LAUNCHER --eval"
|
||||
# create a new X frame
|
||||
alias eframe='emacsclient --alternate-editor "" --create-frame'
|
||||
|
||||
# to code all night long
|
||||
alias emasc=emacs
|
||||
alias emcas=emacs
|
||||
|
||||
# Write to standard output the path to the file
|
||||
# opened in the current buffer.
|
||||
function efile {
|
||||
local cmd="(buffer-file-name (window-buffer))"
|
||||
"$EMACS_PLUGIN_LAUNCHER" --eval "$cmd" | tr -d \"
|
||||
}
|
||||
|
||||
# Write to standard output the directory of the file
|
||||
# opened in the the current buffer
|
||||
function ecd {
|
||||
local cmd="(let ((buf-name (buffer-file-name (window-buffer))))
|
||||
(if buf-name (file-name-directory buf-name)))"
|
||||
|
||||
local dir="$($EMACS_PLUGIN_LAUNCHER --eval $cmd | tr -d \")"
|
||||
if [ -n "$dir" ] ;then
|
||||
echo "$dir"
|
||||
else
|
||||
echo "can not deduce current buffer filename." >/dev/stderr
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
fi
|
||||
|
||||
## Local Variables:
|
||||
## mode: sh
|
||||
## End:
|
12
oh-my-zsh/plugins/emacs/emacsclient.sh
Executable file
12
oh-my-zsh/plugins/emacs/emacsclient.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
# get list of available X windows.
|
||||
x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null`
|
||||
|
||||
if [ -z "$x" ] || [ "$x" = "nil" ] ;then
|
||||
# Create one if there is no X window yet.
|
||||
emacsclient --alternate-editor "" --create-frame "$@"
|
||||
else
|
||||
# prevent creating another X frame if there is at least one present.
|
||||
emacsclient --alternate-editor "" "$@"
|
||||
fi
|
33
oh-my-zsh/plugins/emoji-clock/emoji-clock.plugin.zsh
Normal file
33
oh-my-zsh/plugins/emoji-clock/emoji-clock.plugin.zsh
Normal file
|
@ -0,0 +1,33 @@
|
|||
# ------------------------------------------------------------------------------
|
||||
# FILE: emoji-clock.plugin.zsh
|
||||
# DESCRIPTION: The current time with half hour accuracy as an emoji symbol.
|
||||
# Inspired by Andre Torrez' "Put A Burger In Your Shell"
|
||||
# http://notes.torrez.org/2013/04/put-a-burger-in-your-shell.html
|
||||
# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net)
|
||||
# VERSION: 1.0.0
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
function emoji-clock() {
|
||||
# Add 15 minutes to the current time and save the value as $minutes.
|
||||
(( minutes = $(date '+%M') + 15 ))
|
||||
(( hour = $(date '+%I') + minutes / 60 ))
|
||||
# make sure minutes and hours don't exceed 60 nor 12 respectively
|
||||
(( minutes %= 60 )); (( hour %= 12 ))
|
||||
|
||||
case $hour in
|
||||
0) clock="🕛"; [ $minutes -ge 30 ] && clock="🕧";;
|
||||
1) clock="🕐"; [ $minutes -ge 30 ] && clock="🕜";;
|
||||
2) clock="🕑"; [ $minutes -ge 30 ] && clock="🕝";;
|
||||
3) clock="🕒"; [ $minutes -ge 30 ] && clock="🕞";;
|
||||
4) clock="🕓"; [ $minutes -ge 30 ] && clock="🕟";;
|
||||
5) clock="🕔"; [ $minutes -ge 30 ] && clock="🕠";;
|
||||
6) clock="🕕"; [ $minutes -ge 30 ] && clock="🕡";;
|
||||
7) clock="🕖"; [ $minutes -ge 30 ] && clock="🕢";;
|
||||
8) clock="🕗"; [ $minutes -ge 30 ] && clock="🕣";;
|
||||
9) clock="🕘"; [ $minutes -ge 30 ] && clock="🕤";;
|
||||
10) clock="🕙"; [ $minutes -ge 30 ] && clock="🕥";;
|
||||
11) clock="🕚"; [ $minutes -ge 30 ] && clock="🕦";;
|
||||
*) clock="⌛";;
|
||||
esac
|
||||
echo $clock
|
||||
}
|
4
oh-my-zsh/plugins/encode64/encode64.plugin.zsh
Normal file
4
oh-my-zsh/plugins/encode64/encode64.plugin.zsh
Normal file
|
@ -0,0 +1,4 @@
|
|||
encode64(){ echo -n $1 | base64 }
|
||||
decode64(){ echo -n $1 | base64 --decode }
|
||||
alias e64=encode64
|
||||
alias d64=decode64
|
8
oh-my-zsh/plugins/extract/_extract
Normal file
8
oh-my-zsh/plugins/extract/_extract
Normal file
|
@ -0,0 +1,8 @@
|
|||
#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
|
||||
|
||||
|
80
oh-my-zsh/plugins/extract/extract.plugin.zsh
Normal file
80
oh-my-zsh/plugins/extract/extract.plugin.zsh
Normal file
|
@ -0,0 +1,80 @@
|
|||
# ------------------------------------------------------------------------------
|
||||
# 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) [ -z $commands[pigz] ] && tar zxvf "$1" || pigz -dc "$1" | tar xv ;;
|
||||
(*.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) [ -z $commands[pigz] ] && gunzip "$1" || pigz -d "$1" ;;
|
||||
(*.bz2) bunzip2 "$1" ;;
|
||||
(*.xz) unxz "$1" ;;
|
||||
(*.lzma) unlzma "$1" ;;
|
||||
(*.Z) uncompress "$1" ;;
|
||||
(*.zip|*.war|*.jar|*.sublime-package) unzip "$1" -d $extract_dir ;;
|
||||
(*.rar) unrar x -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
|
||||
|
60
oh-my-zsh/plugins/fabric/_fab
Normal file
60
oh-my-zsh/plugins/fabric/_fab
Normal file
|
@ -0,0 +1,60 @@
|
|||
#compdef fab
|
||||
#autoload
|
||||
|
||||
local curcontext=$curcontext state line
|
||||
declare -A opt_args
|
||||
|
||||
declare target_list
|
||||
target_list=(`fab --shortlist 2>/dev/null`)
|
||||
|
||||
_targets() {
|
||||
_describe -t commands "fabric targets" target_list
|
||||
}
|
||||
|
||||
output_levels=(
|
||||
'status: Status messages, i.e. noting when Fabric is done running, if the user used a keyboard interrupt, or when servers are disconnected from. These messages are almost always relevant and rarely verbose.'
|
||||
'aborts: Abort messages. Like status messages, these should really only be turned off when using Fabric as a library, and possibly not even then. Note that even if this output group is turned off, aborts will still occur – there just won’t be any output about why Fabric aborted!'
|
||||
'warnings: Warning messages. These are often turned off when one expects a given operation to fail, such as when using grep to test existence of text in a file. If paired with setting env.warn_only to True, this can result in fully silent warnings when remote programs fail. As with aborts, this setting does not control actual warning behavior, only whether warning messages are printed or hidden.'
|
||||
'running: Printouts of commands being executed or files transferred, e.g. [myserver] run: ls /var/www. Also controls printing of tasks being run, e.g. [myserver] Executing task ''foo''.'
|
||||
'stdout: Local, or remote, stdout, i.e. non-error output from commands.'
|
||||
'stderr: Local, or remote, stderr, i.e. error-related output from commands.'
|
||||
'user: User-generated output, i.e. local output printed by fabfile code via use of the fastprint or puts functions.'
|
||||
)
|
||||
|
||||
_arguments -w -S -C \
|
||||
'(-)'{-h,--help}'[show this help message and exit]: :->noargs' \
|
||||
'(-)'{-V,--version}'[show program''s version number and exit]: :->noargs' \
|
||||
'(-)--list[print list of possible commands and exit]: :->noargs' \
|
||||
'(-)--shortlist[print non-verbose list of possible commands and exit]: :->noargs' \
|
||||
'(--reject-unknown-hosts)--reject-unknown-hosts[reject unknown hosts]' \
|
||||
'(--no-pty)--no-pty[do not use pseudo-terminal in run/sudo]' \
|
||||
"(-d+ --display=-)"{-d+,--display=-}"[print detailed info about a given command]: :_targets" \
|
||||
'(-D --disable-known-hosts)'{-D,--disable-known-hosts}'[do not load user known_hosts file]' \
|
||||
'(-r --reject-unknown-hosts)'{-r,--reject-unknown-hosts}'[reject unknown hosts]' \
|
||||
'(-u+ --user=-)'{-u+,--user=-}'[username to use when connecting to remote hosts]: :' \
|
||||
'(-p+ --password=-)'{-p+,--password=-}'[password for use with authentication and/or sudo]: :' \
|
||||
'(-H+ --hosts=-)'{-H+,--hosts=-}'[comma separated list of hosts to operate on]: :' \
|
||||
'(-R+ --roles=-)'{-R+,--roles=-}'[comma separated list of roles to operate on]: :' \
|
||||
'(-a --no-agent)'{-a,--no-agent}'[don''t use the running SSH agent]' \
|
||||
'(-k --no-keys)'{-k,--no-keys}'[don''t load private key files from ~/.ssh/]' \
|
||||
'(-w --warn-only)'{-w,--warn-only}'[warn instead of abort, when commands fail]' \
|
||||
'-i+[path to SSH private key file. May be repeated]: :_files' \
|
||||
"(-f+ --fabfile=)"{-f+,--fabfile=}"[Python module file to import]: :_files -g *.py" \
|
||||
'(-c+ --config=-)'{-c+,--config=-}'[specify location of config file to use]: :_files' \
|
||||
'(-s+ --shell=-)'{-s+,--shell=-}'[specify a new shell, defaults to ''/bin/bash -l -c'']: :' \
|
||||
'(--hide=-)--hide=-[comma-separated list of output levels to hide]: :->levels' \
|
||||
'(--show=-)--show=-[comma-separated list of output levels to show]: :->levels' \
|
||||
'*::: :->subcmds' && return 0
|
||||
|
||||
if [[ CURRENT -ge 1 ]]; then
|
||||
case $state in
|
||||
noargs)
|
||||
_message "nothing to complete";;
|
||||
levels)
|
||||
_describe -t commands "output levels" output_levels;;
|
||||
*)
|
||||
_targets;;
|
||||
esac
|
||||
|
||||
return
|
||||
fi
|
1
oh-my-zsh/plugins/fabric/fabric.plugin.zsh
Normal file
1
oh-my-zsh/plugins/fabric/fabric.plugin.zsh
Normal file
|
@ -0,0 +1 @@
|
|||
# DECLARION: This plugin was created by vhbit. What I did is just making a portal from https://github.com/vhbit/fabric-zsh-autocomplete.
|
11
oh-my-zsh/plugins/fasd/fasd.plugin.zsh
Normal file
11
oh-my-zsh/plugins/fasd/fasd.plugin.zsh
Normal file
|
@ -0,0 +1,11 @@
|
|||
if [ $commands[fasd] ]; then # check if fasd is installed
|
||||
fasd_cache="$HOME/.fasd-init-cache"
|
||||
if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then
|
||||
fasd --init auto >| "$fasd_cache"
|
||||
fi
|
||||
source "$fasd_cache"
|
||||
unset fasd_cache
|
||||
alias v='f -e vim'
|
||||
alias o='a -e open'
|
||||
fi
|
||||
|
138
oh-my-zsh/plugins/fastfile/fastfile.plugin.zsh
Normal file
138
oh-my-zsh/plugins/fastfile/fastfile.plugin.zsh
Normal file
|
@ -0,0 +1,138 @@
|
|||
################################################################################
|
||||
# FILE: fastfile.plugin.zsh
|
||||
# DESCRIPTION: oh-my-zsh plugin file.
|
||||
# AUTHOR: Michael Varner (musikmichael@web.de)
|
||||
# VERSION: 1.0.0
|
||||
#
|
||||
# This plugin adds the ability to on the fly generate and access file shortcuts.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
###########################
|
||||
# Settings
|
||||
|
||||
# These can be overwritten any time.
|
||||
# If they are not set yet, they will be
|
||||
# overwritten with their default values
|
||||
|
||||
default fastfile_dir "${HOME}/.fastfile/"
|
||||
default fastfile_var_prefix "§"
|
||||
|
||||
###########################
|
||||
# Impl
|
||||
|
||||
#
|
||||
# Generate a shortcut
|
||||
#
|
||||
# Arguments:
|
||||
# 1. name - The name of the shortcut (default: name of the file)
|
||||
# 2. file - The file or directory to make the shortcut for
|
||||
# STDOUT:
|
||||
# => fastfle_print
|
||||
#
|
||||
function fastfile() {
|
||||
test "$2" || 2="."
|
||||
file=$(readlink -f "$2")
|
||||
|
||||
test "$1" || 1="$(basename "$file")"
|
||||
name=$(echo "$1" | tr " " "_")
|
||||
|
||||
|
||||
mkdir -p "${fastfile_dir}"
|
||||
echo "$file" > "$(fastfile_resolv "$name")"
|
||||
|
||||
fastfile_sync
|
||||
fastfile_print "$name"
|
||||
}
|
||||
|
||||
#
|
||||
# Resolve the location of a shortcut file (the database file, where the value is written!)
|
||||
#
|
||||
# Arguments:
|
||||
# 1. name - The name of the shortcut
|
||||
# STDOUT:
|
||||
# The path
|
||||
#
|
||||
function fastfile_resolv() {
|
||||
echo "${fastfile_dir}${1}"
|
||||
}
|
||||
|
||||
#
|
||||
# Get the real path of a shortcut
|
||||
#
|
||||
# Arguments:
|
||||
# 1. name - The name of the shortcut
|
||||
# STDOUT:
|
||||
# The path
|
||||
#
|
||||
function fastfile_get() {
|
||||
cat "$(fastfile_resolv "$1")"
|
||||
}
|
||||
|
||||
#
|
||||
# Print a shortcut
|
||||
#
|
||||
# Arguments:
|
||||
# 1. name - The name of the shortcut
|
||||
# STDOUT:
|
||||
# Name and value of the shortcut
|
||||
#
|
||||
function fastfile_print() {
|
||||
echo "${fastfile_var_prefix}${1} -> $(fastfile_get "$1")"
|
||||
}
|
||||
|
||||
#
|
||||
# List all shortcuts
|
||||
#
|
||||
# STDOUT:
|
||||
# (=> fastfle_print) for each shortcut
|
||||
#
|
||||
function fastfile_ls() {
|
||||
for f in "${fastfile_dir}"/*; do
|
||||
file=`basename "$f"` # To enable simpler handeling of spaces in file names
|
||||
varkey=`echo "$file" | tr " " "_"`
|
||||
|
||||
# Special format for colums
|
||||
echo "${fastfile_var_prefix}${varkey}|->|$(fastfile_get "$file")"
|
||||
done | column -t -s "|"
|
||||
}
|
||||
|
||||
#
|
||||
# Remove a shortcut
|
||||
#
|
||||
# Arguments:
|
||||
# 1. name - The name of the shortcut (default: name of the file)
|
||||
# 2. file - The file or directory to make the shortcut for
|
||||
# STDOUT:
|
||||
# => fastfle_print
|
||||
#
|
||||
function fastfile_rm() {
|
||||
fastfile_print "$1"
|
||||
rm "$(fastfile_resolv "$1")"
|
||||
}
|
||||
|
||||
#
|
||||
# Generate the aliases for the shortcuts
|
||||
#
|
||||
function fastfile_sync() {
|
||||
for f in "${fastfile_dir}"/*; do
|
||||
file=`basename "$f"` # To enable simpler handeling of spaces in file names
|
||||
varkey=`echo "$file" | tr " " "_"`
|
||||
|
||||
alias -g "${fastfile_var_prefix}${varkey}"="'$(fastfile_get "$file")'"
|
||||
done
|
||||
}
|
||||
|
||||
##################################
|
||||
# Shortcuts
|
||||
|
||||
alias ff=fastfile
|
||||
alias ffp=fastfile_print
|
||||
alias ffrm=fastfile_rm
|
||||
alias ffls=fastfile_ls
|
||||
alias ffsync=fastfile_sync
|
||||
|
||||
##################################
|
||||
# Init
|
||||
|
||||
fastfile_sync
|
6
oh-my-zsh/plugins/fbterm/fbterm.plugin.zsh
Normal file
6
oh-my-zsh/plugins/fbterm/fbterm.plugin.zsh
Normal file
|
@ -0,0 +1,6 @@
|
|||
# start fbterm automatically in /dev/tty*
|
||||
|
||||
if [[ $(tty|grep -o '/dev/tty') = /dev/tty ]] ; then
|
||||
fbterm
|
||||
exit
|
||||
fi
|
69
oh-my-zsh/plugins/forklift/forklift.plugin.zsh
Normal file
69
oh-my-zsh/plugins/forklift/forklift.plugin.zsh
Normal file
|
@ -0,0 +1,69 @@
|
|||
# Open folder in ForkLift.app or ForkLift2.app from console
|
||||
# Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
|
||||
# Updated to support ForkLift2 by Johan Kaving
|
||||
#
|
||||
# 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
|
||||
|
||||
try
|
||||
tell application "Finder"
|
||||
set appName to name of application file id "com.binarynights.ForkLift2"
|
||||
end tell
|
||||
on error err_msg number err_num
|
||||
tell application "Finder"
|
||||
set appName to name of application file id "com.binarynights.ForkLift"
|
||||
end tell
|
||||
end try
|
||||
|
||||
if application appName is running
|
||||
tell application appName
|
||||
activate
|
||||
end tell
|
||||
else
|
||||
tell application appName
|
||||
activate
|
||||
end tell
|
||||
repeat until application appName is running
|
||||
delay 1
|
||||
end repeat
|
||||
tell application appName
|
||||
activate
|
||||
end tell
|
||||
end if
|
||||
|
||||
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
|
||||
}
|
82
oh-my-zsh/plugins/frontend-search/README.md
Normal file
82
oh-my-zsh/plugins/frontend-search/README.md
Normal file
|
@ -0,0 +1,82 @@
|
|||
## Rationale ##
|
||||
|
||||
The idea for this script is to help searches in important doc contents from frontend.
|
||||
|
||||
## Instalation ##
|
||||
|
||||
I will send a Pull Request with this plugin for .oh-my-zsh official repository. If accept them, it's only add in plugins list that exists in ```.zshrc``` file.
|
||||
|
||||
For now, you can clone this repository and add in ```custom/plugins``` folder
|
||||
|
||||
```bash
|
||||
$ git clone git://github.com/willmendesneto/frontend-search.git ~/.oh-my-zsh/custom/plugins/frontend-search
|
||||
```
|
||||
|
||||
After this, restart your terminal and frontend-search plugin is configurated in you CLI.
|
||||
|
||||
```bash
|
||||
...
|
||||
plugins=( <your-plugins-list>... frontend-search)
|
||||
...
|
||||
```
|
||||
|
||||
## Commands ##
|
||||
|
||||
All command searches are accept only in format
|
||||
|
||||
* `frontend <search-content> <search-term>`
|
||||
|
||||
The search content are
|
||||
|
||||
* `jquery <api.jquery.com>`
|
||||
* `mdn <developer.mozilla.org>`
|
||||
* `compass <compass-style.org>`
|
||||
* `html5please <html5please.com>`
|
||||
* `caniuse <caniuse.com>`
|
||||
* `aurajs <aurajs.com>`
|
||||
* `dartlang <api.dartlang.org/apidocs/channels/stable/dartdoc-viewer>`
|
||||
* `lodash <search>`
|
||||
* `qunit <api.qunitjs.com>`
|
||||
* `fontello <fontello.com>`
|
||||
* `bootsnipp <bootsnipp.com>`
|
||||
* `cssflow <cssflow.com>`
|
||||
* `codepen <codepen.io>`
|
||||
* `unheap <www.unheap.com>`
|
||||
* `bem <google.com/search?as_q=<search-term>&as_sitesearch=bem.info>`
|
||||
* `smacss <google.com/search?as_q=<search-term>&as_sitesearch=smacss.com>`
|
||||
* `angularjs <google.com/search?as_q=<search-term>&as_sitesearch=angularjs.org>`
|
||||
* `reactjs <google.com/search?as_q=<search-term>&as_sitesearch=facebook.github.io/react>`
|
||||
* `emberjs <emberjs.com>`
|
||||
|
||||
|
||||
## Aliases ##
|
||||
|
||||
There are a few aliases presented as well:
|
||||
|
||||
* `jquery` A shorthand for `frontend jquery`
|
||||
* `mdn` A shorthand for `frontend mdn`
|
||||
* `compass` A shorthand for `frontend compass`
|
||||
* `html5please` A shorthand for `frontend html5please`
|
||||
* `caniuse` A shorthand for `frontend caniuse`
|
||||
* `aurajs` A shorthand for `frontend aurajs`
|
||||
* `dartlang` A shorthand for `frontend dartlang`
|
||||
* `lodash` A shorthand for `frontend lodash`
|
||||
* `qunit` A shorthand for `frontend qunit`
|
||||
* `fontello` A shorthand for `frontend fontello`
|
||||
* `bootsnipp` A shorthand for `frontend bootsnipp`
|
||||
* `cssflow` A shorthand for `frontend cssflow`
|
||||
* `codepen` A shorthand for `frontend codepen`
|
||||
* `unheap` A shorthand for `frontend unheap`
|
||||
* `bem` A shorthand for `frontend bem`
|
||||
* `smacss` A shorthand for `frontend smacss`
|
||||
* `angularjs` A shorthand for `frontend angularjs`
|
||||
* `reactjs` A shorthand for `frontend reactjs`
|
||||
* `emberjs` A shorthand for `frontend emberjs`
|
||||
|
||||
## Author
|
||||
|
||||
**Wilson Mendes (willmendesneto)**
|
||||
+ <https://twitter.com/willmendesneto>
|
||||
+ <http://github.com/willmendesneto>
|
||||
|
||||
New features comming soon.
|
151
oh-my-zsh/plugins/frontend-search/frontend-search.plugin.zsh
Normal file
151
oh-my-zsh/plugins/frontend-search/frontend-search.plugin.zsh
Normal file
|
@ -0,0 +1,151 @@
|
|||
# frontend from terminal
|
||||
|
||||
function frontend() {
|
||||
|
||||
# get the open command
|
||||
local open_cmd
|
||||
if [[ $(uname -s) == 'Darwin' ]]; then
|
||||
open_cmd='open'
|
||||
else
|
||||
open_cmd='xdg-open'
|
||||
fi
|
||||
|
||||
# no keyword provided, simply show how call methods
|
||||
if [[ $# -le 1 ]]; then
|
||||
echo "Please provide a search-content and a search-term for app.\nEx:\nfrontend <search-content> <search-term>\n"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# check whether the search engine is supported
|
||||
if [[ ! $1 =~ '(jquery|mdn|compass|html5please|caniuse|aurajs|dartlang|qunit|fontello|bootsnipp|cssflow|codepen|unheap|bem|smacss|angularjs|reactjs|emberjs)' ]];
|
||||
then
|
||||
echo "Search valid search content $1 not supported."
|
||||
echo "Valid contents: (formats 'frontend <search-content>' or '<search-content>')"
|
||||
echo "* jquery"
|
||||
echo "* mdn"
|
||||
echo "* compass"
|
||||
echo "* html5please"
|
||||
echo "* caniuse"
|
||||
echo "* aurajs"
|
||||
echo "* dartlang"
|
||||
echo "* lodash"
|
||||
echo "* qunit"
|
||||
echo "* fontello"
|
||||
echo "* bootsnipp"
|
||||
echo "* cssflow"
|
||||
echo "* codepen"
|
||||
echo "* unheap"
|
||||
echo "* bem"
|
||||
echo "* smacss"
|
||||
echo "* angularjs"
|
||||
echo "* reactjs"
|
||||
echo "* emberjs"
|
||||
echo ""
|
||||
|
||||
return 1
|
||||
fi
|
||||
|
||||
local url="http://"
|
||||
local query=""
|
||||
|
||||
case "$1" in
|
||||
"jquery")
|
||||
url="${url}api.jquery.com"
|
||||
url="${url}/?s=$2" ;;
|
||||
"mdn")
|
||||
url="${url}developer.mozilla.org"
|
||||
url="${url}/search?q=$2" ;;
|
||||
"compass")
|
||||
url="${url}compass-style.org"
|
||||
url="${url}/search?q=$2" ;;
|
||||
"html5please")
|
||||
url="${url}html5please.com"
|
||||
url="${url}/#$2" ;;
|
||||
"caniuse")
|
||||
url="${url}caniuse.com"
|
||||
url="${url}/#search=$2" ;;
|
||||
"aurajs")
|
||||
url="${url}aurajs.com"
|
||||
url="${url}/api/#stq=$2" ;;
|
||||
"dartlang")
|
||||
url="${url}api.dartlang.org/apidocs/channels/stable/dartdoc-viewer"
|
||||
url="${url}/dart-$2" ;;
|
||||
"qunit")
|
||||
url="${url}api.qunitjs.com"
|
||||
url="${url}/?s=$2" ;;
|
||||
"fontello")
|
||||
url="${url}fontello.com"
|
||||
url="${url}/#search=$2" ;;
|
||||
"bootsnipp")
|
||||
url="${url}bootsnipp.com"
|
||||
url="${url}/search?q=$2" ;;
|
||||
"cssflow")
|
||||
url="${url}cssflow.com"
|
||||
url="${url}/search?q=$2" ;;
|
||||
"codepen")
|
||||
url="${url}codepen.io"
|
||||
url="${url}/search?q=$2" ;;
|
||||
"unheap")
|
||||
url="${url}www.unheap.com"
|
||||
url="${url}/?s=$2" ;;
|
||||
"bem")
|
||||
url="${url}google.com"
|
||||
url="${url}/search?as_q=$2&as_sitesearch=bem.info" ;;
|
||||
"smacss")
|
||||
url="${url}google.com"
|
||||
url="${url}/search?as_q=$2&as_sitesearch=smacss.com" ;;
|
||||
"angularjs")
|
||||
url="${url}google.com"
|
||||
url="${url}/search?as_q=$2&as_sitesearch=angularjs.org" ;;
|
||||
"reactjs")
|
||||
url="${url}google.com"
|
||||
url="${url}/search?as_q=$2&as_sitesearch=facebook.github.io/react" ;;
|
||||
"emberjs")
|
||||
url="${url}emberjs.com"
|
||||
url="${url}/api/#stq=$2&stp=1" ;;
|
||||
*) echo "INVALID PARAM!"
|
||||
return ;;
|
||||
esac
|
||||
|
||||
echo "$url"
|
||||
|
||||
$open_cmd "$url"
|
||||
|
||||
}
|
||||
|
||||
# javascript
|
||||
alias jquery='frontend jquery'
|
||||
alias mdn='frontend mdn'
|
||||
|
||||
# pre processors frameworks
|
||||
alias compassdoc='frontend compass'
|
||||
|
||||
# important links
|
||||
alias html5please='frontend html5please'
|
||||
alias caniuse='frontend caniuse'
|
||||
|
||||
# components and libraries
|
||||
alias aurajs='frontend aurajs'
|
||||
alias dartlang='frontend dartlang'
|
||||
alias lodash='frontend lodash'
|
||||
|
||||
#tests
|
||||
alias qunit='frontend qunit'
|
||||
|
||||
#fonts
|
||||
alias fontello='frontend fontello'
|
||||
|
||||
# snippets
|
||||
alias bootsnipp='frontend bootsnipp'
|
||||
alias cssflow='frontend cssflow'
|
||||
alias codepen='frontend codepen'
|
||||
alias unheap='frontend unheap'
|
||||
|
||||
# css architecture
|
||||
alias bem='frontend bem'
|
||||
alias smacss='frontend smacss'
|
||||
|
||||
# frameworks
|
||||
alias angularjs='frontend angularjs'
|
||||
alias reactjs='frontend reactjs'
|
||||
alias emberjs='frontend emberjs'
|
39
oh-my-zsh/plugins/gas/_gas
Normal file
39
oh-my-zsh/plugins/gas/_gas
Normal file
|
@ -0,0 +1,39 @@
|
|||
#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"
|
||||
"ssh:Creates a new ssh key for an existing gas author"
|
||||
"show:Shows your current user"
|
||||
"list:Lists your authors"
|
||||
"import:Imports current user to gasconfig"
|
||||
"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)
|
||||
VERSION=$(gas -v)
|
||||
if [[ $VERSION == <1->.*.* ]] || [[ $VERSION == 0.<2->.* ]] || [[ $VERSION == 0.1.<6-> ]] then
|
||||
_values -S , 'authors' $(cat ~/.gas/gas.authors | sed -n -e 's/^.*\[\(.*\)\]/\1/p') && ret=0
|
||||
else
|
||||
_values -S , 'authors' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0
|
||||
fi
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
72
oh-my-zsh/plugins/gem/_gem
Normal file
72
oh-my-zsh/plugins/gem/_gem
Normal file
|
@ -0,0 +1,72 @@
|
|||
#compdef gem
|
||||
#autoload
|
||||
|
||||
# gem zsh completion, based on homebrew completion
|
||||
|
||||
_gem_installed() {
|
||||
installed_gems=(${(f)"$(gem list --local --no-versions)"})
|
||||
}
|
||||
|
||||
local -a _1st_arguments
|
||||
|
||||
_1st_arguments=(
|
||||
'build:Build a gem from a gemspec'
|
||||
'cert:Manage RubyGems certificates and signing settings'
|
||||
'check:Check a gem repository for added or missing files'
|
||||
'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 all gem files (requires rubygems-mirror)'
|
||||
'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 installed gems to the latest version'
|
||||
'which:Find the location of a library file you can require'
|
||||
'yank:Remove a specific gem version release from RubyGems.org'
|
||||
)
|
||||
|
||||
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
|
||||
build)
|
||||
_files -g "*.gemspec"
|
||||
;;
|
||||
install)
|
||||
_files ;;
|
||||
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
|
7
oh-my-zsh/plugins/gem/gem.plugin.zsh
Normal file
7
oh-my-zsh/plugins/gem/gem.plugin.zsh
Normal file
|
@ -0,0 +1,7 @@
|
|||
alias gemb="gem build *.gemspec"
|
||||
alias gemp="gem push *.gem"
|
||||
|
||||
# gemy GEM 0.0.0 = gem yank GEM -v 0.0.0
|
||||
function gemy {
|
||||
gem yank $1 -v $2
|
||||
}
|
285
oh-my-zsh/plugins/git-extras/git-extras.plugin.zsh
Normal file
285
oh-my-zsh/plugins/git-extras/git-extras.plugin.zsh
Normal file
|
@ -0,0 +1,285 @@
|
|||
#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' \
|
419
oh-my-zsh/plugins/git-flow-avh/git-flow-avh.plugin.zsh
Normal file
419
oh-my-zsh/plugins/git-flow-avh/git-flow-avh.plugin.zsh
Normal file
|
@ -0,0 +1,419 @@
|
|||
#!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.'
|
||||
'config:Manage your configuration.'
|
||||
'release:Manage your release branches.'
|
||||
'hotfix:Manage your hotfix branches.'
|
||||
'support:Manage your support branches.'
|
||||
'version:Shows version information.'
|
||||
'finish:Finish the branch you are currently on.'
|
||||
'delete:Delete the branch you are currently on.'
|
||||
'publish:Publish the branch you are currently on.'
|
||||
)
|
||||
_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
|
||||
;;
|
||||
(config)
|
||||
__git-flow-config
|
||||
;;
|
||||
|
||||
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`)'
|
||||
'publish:Publish release branch to remote.'
|
||||
'track:Checkout remote release branch.'
|
||||
'delete:Delete a release branch.'
|
||||
)
|
||||
_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]'\
|
||||
':version:__git_flow_version_list'
|
||||
;;
|
||||
|
||||
(delete)
|
||||
_arguments \
|
||||
-f'[Force deletion]' \
|
||||
-r'[Delete remote branch]' \
|
||||
':version:__git_flow_version_list'
|
||||
;;
|
||||
|
||||
(publish)
|
||||
_arguments \
|
||||
':version:__git_flow_version_list'
|
||||
;;
|
||||
|
||||
(track)
|
||||
_arguments \
|
||||
':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.'
|
||||
'delete:Delete 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]'\
|
||||
':hotfix:__git_flow_hotfix_list'
|
||||
;;
|
||||
|
||||
(delete)
|
||||
_arguments \
|
||||
-f'[Force deletion]' \
|
||||
-r'[Delete remote branch]' \
|
||||
':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.'
|
||||
'delete:Delete a feature branch.'
|
||||
'list:List all your feature branches. (Alias to `git flow feature`)'
|
||||
'publish:Publish feature branch to remote.'
|
||||
'track:Checkout remote feature branch.'
|
||||
'diff:Show all changes.'
|
||||
'rebase:Rebase from integration branch.'
|
||||
'checkout:Checkout local feature branch.'
|
||||
'pull:Pull changes from remote.'
|
||||
)
|
||||
_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]'\
|
||||
':feature:__git_flow_feature_list'
|
||||
;;
|
||||
|
||||
(delete)
|
||||
_arguments \
|
||||
-f'[Force deletion]' \
|
||||
-r'[Delete remote branch]' \
|
||||
':feature:__git_flow_feature_list'
|
||||
;;
|
||||
|
||||
(publish)
|
||||
_arguments \
|
||||
':feature:__git_flow_feature_list'\
|
||||
;;
|
||||
|
||||
(track)
|
||||
_arguments \
|
||||
':feature:__git_flow_feature_list'\
|
||||
;;
|
||||
|
||||
(diff)
|
||||
_arguments \
|
||||
':branch:__git_branch_names'\
|
||||
;;
|
||||
|
||||
(rebase)
|
||||
_arguments \
|
||||
-i'[Do an interactive rebase]' \
|
||||
':branch:__git_branch_names'
|
||||
;;
|
||||
|
||||
(checkout)
|
||||
_arguments \
|
||||
':branch:__git_flow_feature_list'\
|
||||
;;
|
||||
|
||||
(pull)
|
||||
_arguments \
|
||||
':remote:__git_remotes'\
|
||||
':branch:__git_branch_names'
|
||||
;;
|
||||
|
||||
*)
|
||||
_arguments \
|
||||
-v'[Verbose (more) output]'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
__git-flow-config ()
|
||||
{
|
||||
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 the configuration. (Alias to `git flow config`)'
|
||||
'set:Set the configuration option'
|
||||
)
|
||||
_describe -t commands 'git flow config' subcommands
|
||||
;;
|
||||
|
||||
(options)
|
||||
case $line[1] in
|
||||
|
||||
(set)
|
||||
_arguments \
|
||||
--local'[Use repository config file]' \
|
||||
--global'[Use global config file]'\
|
||||
--system'[Use system config file]'\
|
||||
--file'[Use given config file]'\
|
||||
':option:(master develop feature hotfix release support versiontagprefix)'
|
||||
;;
|
||||
|
||||
*)
|
||||
_arguments \
|
||||
--local'[Use repository config file]' \
|
||||
--global'[Use global config file]'\
|
||||
--system'[Use system config file]'\
|
||||
--file'[Use given config file]'
|
||||
;;
|
||||
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:'provide high-level repository operations'
|
355
oh-my-zsh/plugins/git-flow/git-flow.plugin.zsh
Normal file
355
oh-my-zsh/plugins/git-flow/git-flow.plugin.zsh
Normal file
|
@ -0,0 +1,355 @@
|
|||
#!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.
|
||||
#
|
||||
|
||||
#Alias
|
||||
alias gf='git flow'
|
||||
alias gcd='git checkout develop'
|
||||
alias gch='git checkout hotfix'
|
||||
alias gcr='git checkout release'
|
||||
|
||||
_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`)'
|
||||
'publish: public'
|
||||
'track: track'
|
||||
)
|
||||
_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'
|
||||
;;
|
||||
|
||||
(publish)
|
||||
_arguments \
|
||||
':version:__git_flow_version_list'\
|
||||
;;
|
||||
|
||||
(track)
|
||||
_arguments \
|
||||
':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'
|
348
oh-my-zsh/plugins/git-hubflow/git-hubflow.plugin.zsh
Normal file
348
oh-my-zsh/plugins/git-hubflow/git-hubflow.plugin.zsh
Normal file
|
@ -0,0 +1,348 @@
|
|||
#!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'
|
60
oh-my-zsh/plugins/git-prompt/git-prompt.plugin.zsh
Normal file
60
oh-my-zsh/plugins/git-prompt/git-prompt.plugin.zsh
Normal file
|
@ -0,0 +1,60 @@
|
|||
# ZSH Git Prompt Plugin from:
|
||||
# http://github.com/olivierverdier/zsh-git-prompt
|
||||
#
|
||||
export __GIT_PROMPT_DIR=$ZSH/plugins/git-prompt
|
||||
# Initialize colors.
|
||||
autoload -U colors
|
||||
colors
|
||||
|
||||
# Allow for functions in the prompt.
|
||||
setopt PROMPT_SUBST
|
||||
|
||||
## Enable auto-execution of functions.
|
||||
typeset -ga preexec_functions
|
||||
typeset -ga precmd_functions
|
||||
typeset -ga chpwd_functions
|
||||
|
||||
# Append git functions needed for prompt.
|
||||
preexec_functions+='preexec_update_git_vars'
|
||||
precmd_functions+='precmd_update_git_vars'
|
||||
chpwd_functions+='chpwd_update_git_vars'
|
||||
|
||||
## Function definitions
|
||||
function preexec_update_git_vars() {
|
||||
case "$2" in
|
||||
git*)
|
||||
__EXECUTED_GIT_COMMAND=1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function precmd_update_git_vars() {
|
||||
if [ -n "$__EXECUTED_GIT_COMMAND" ]; then
|
||||
update_current_git_vars
|
||||
unset __EXECUTED_GIT_COMMAND
|
||||
fi
|
||||
}
|
||||
|
||||
function chpwd_update_git_vars() {
|
||||
update_current_git_vars
|
||||
}
|
||||
|
||||
function update_current_git_vars() {
|
||||
unset __CURRENT_GIT_STATUS
|
||||
|
||||
local gitstatus="$__GIT_PROMPT_DIR/gitstatus.py"
|
||||
_GIT_STATUS=`python ${gitstatus}`
|
||||
__CURRENT_GIT_STATUS=("${(f)_GIT_STATUS}")
|
||||
}
|
||||
|
||||
function prompt_git_info() {
|
||||
if [ -n "$__CURRENT_GIT_STATUS" ]; then
|
||||
echo "(%{${fg[red]}%}$__CURRENT_GIT_STATUS[1]%{${fg[default]}%}$__CURRENT_GIT_STATUS[2]%{${fg[magenta]}%}$__CURRENT_GIT_STATUS[3]%{${fg[default]}%})"
|
||||
fi
|
||||
}
|
||||
|
||||
# Set the prompt.
|
||||
#PROMPT='%B%m%~%b$(prompt_git_info) %# '
|
||||
# for a right prompt:
|
||||
#RPROMPT='%b$(prompt_git_info)'
|
||||
RPROMPT='$(prompt_git_info)'
|
82
oh-my-zsh/plugins/git-prompt/gitstatus.py
Normal file
82
oh-my-zsh/plugins/git-prompt/gitstatus.py
Normal file
|
@ -0,0 +1,82 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: UTF-8 -*-
|
||||
from subprocess import Popen, PIPE
|
||||
import re
|
||||
|
||||
# change those symbols to whatever you prefer
|
||||
symbols = {
|
||||
'ahead of': '↑',
|
||||
'behind': '↓',
|
||||
'staged': '♦',
|
||||
'changed': '‣',
|
||||
'untracked': '…',
|
||||
'clean': '⚡',
|
||||
'unmerged': '≠',
|
||||
'sha1': ':'
|
||||
}
|
||||
|
||||
output, error = Popen(
|
||||
['git', 'status'], stdout=PIPE, stderr=PIPE, universal_newlines=True).communicate()
|
||||
|
||||
if error:
|
||||
import sys
|
||||
sys.exit(0)
|
||||
lines = output.splitlines()
|
||||
|
||||
behead_re = re.compile(
|
||||
r"^# Your branch is (ahead of|behind) '(.*)' by (\d+) commit")
|
||||
diverge_re = re.compile(r"^# and have (\d+) and (\d+) different")
|
||||
|
||||
status = ''
|
||||
staged = re.compile(r'^# Changes to be committed:$', re.MULTILINE)
|
||||
changed = re.compile(r'^# Changed but not updated:$', re.MULTILINE)
|
||||
untracked = re.compile(r'^# Untracked files:$', re.MULTILINE)
|
||||
unmerged = re.compile(r'^# Unmerged paths:$', re.MULTILINE)
|
||||
|
||||
|
||||
def execute(*command):
|
||||
out, err = Popen(stdout=PIPE, stderr=PIPE, *command).communicate()
|
||||
if not err:
|
||||
nb = len(out.splitlines())
|
||||
else:
|
||||
nb = '?'
|
||||
return nb
|
||||
|
||||
if staged.search(output):
|
||||
nb = execute(
|
||||
['git', 'diff', '--staged', '--name-only', '--diff-filter=ACDMRT'])
|
||||
status += '%s%s' % (symbols['staged'], nb)
|
||||
if unmerged.search(output):
|
||||
nb = execute(['git', 'diff', '--staged', '--name-only', '--diff-filter=U'])
|
||||
status += '%s%s' % (symbols['unmerged'], nb)
|
||||
if changed.search(output):
|
||||
nb = execute(['git', 'diff', '--name-only', '--diff-filter=ACDMRT'])
|
||||
status += '%s%s' % (symbols['changed'], nb)
|
||||
if untracked.search(output):
|
||||
status += symbols['untracked']
|
||||
if status == '':
|
||||
status = symbols['clean']
|
||||
|
||||
remote = ''
|
||||
|
||||
bline = lines[0]
|
||||
if bline.find('Not currently on any branch') != -1:
|
||||
branch = symbols['sha1'] + Popen([
|
||||
'git',
|
||||
'rev-parse',
|
||||
'--short',
|
||||
'HEAD'], stdout=PIPE).communicate()[0][:-1]
|
||||
else:
|
||||
branch = bline.split(' ')[-1]
|
||||
bstatusline = lines[1]
|
||||
match = behead_re.match(bstatusline)
|
||||
if match:
|
||||
remote = symbols[match.groups()[0]]
|
||||
remote += match.groups()[2]
|
||||
elif lines[2:]:
|
||||
div_match = diverge_re.match(lines[2])
|
||||
if div_match:
|
||||
remote = "{behind}{1}{ahead of}{0}".format(
|
||||
*div_match.groups(), **symbols)
|
||||
|
||||
print('\n'.join([branch, remote, status]))
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user