mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-02 02:19:06 +01:00
Merge branch 'master' of git://github.com/robbyrussell/oh-my-zsh into agnoster_theme_show_exit_status
This commit is contained in:
commit
358f0fe89e
23 changed files with 3301 additions and 23 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,7 +1,6 @@
|
|||
locals.zsh
|
||||
log/.zsh_history
|
||||
projects.zsh
|
||||
custom/*
|
||||
!custom/example
|
||||
!custom/example.zsh
|
||||
*.swp
|
||||
|
|
|
|||
124
custom/totvs.zsh
Normal file
124
custom/totvs.zsh
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
#
|
||||
# Just some utilities for use in ecm development.
|
||||
#
|
||||
|
||||
setopt rmstarsilent
|
||||
|
||||
HOME="/home/carlos"
|
||||
ECM_WS="$HOME/totvs/ws"
|
||||
ECM_JBOSS="$HOME/Public/ecm/JBoss-7.1.1"
|
||||
ECM_PORT="8080"
|
||||
VOLDEMORT=$ECM_WS/voldemort
|
||||
ECM=$ECM_WS/ecm
|
||||
INSTALLER="n"
|
||||
DRY_CLEAN="n"
|
||||
|
||||
# fuckin aliases
|
||||
alias ecmu=ecmup
|
||||
alias ecmb=ecmbuild
|
||||
alias ecmc=ecmclean
|
||||
alias ecms=ecmstart
|
||||
alias ecmo=ecmstop
|
||||
alias ecmi=ecminstall
|
||||
alias ecmri=ecmruninstall
|
||||
alias ecm=ecmfull
|
||||
alias e='MAVEN_OPTS="-Xmx2048m -XX:MaxPermSize=512m -DskipTests=true" ecm'
|
||||
|
||||
|
||||
# update ecm
|
||||
ecmup() {
|
||||
echo "update all the things!"
|
||||
cd $VOLDEMORT && svn up
|
||||
cd $ECM && svn up
|
||||
}
|
||||
|
||||
# build it!
|
||||
ecmbuild() {
|
||||
echo "build? no problem sir..."
|
||||
cd $VOLDEMORT && mvncie && \
|
||||
cd $VOLDEMORT/social-ecm && \
|
||||
cd $VOLDEMORT/wcm && mvncie && \
|
||||
cd $ECM/wecmpackage && mvncie && \
|
||||
cd $VOLDEMORT/ecm && mvncie && \
|
||||
ecminstall
|
||||
}
|
||||
|
||||
# gen installer or cp wars...
|
||||
ecminstall() {
|
||||
case $@ in
|
||||
-*i*)
|
||||
INSTALLER=y
|
||||
;;
|
||||
esac
|
||||
if [[ "$INSTALLER" == "y" ]]; then
|
||||
echo "generating installer..."
|
||||
cd $VOLDEMORT/ecm/installer
|
||||
mvnci -am -Drun=installer -DLinux64=true -DappServer=jboss
|
||||
else
|
||||
echo "cpying wars..."
|
||||
cd $VOLDEMORT/ecm/build && mvnci && \
|
||||
cd $VOLDEMORT/wcm/build && mvnci && \
|
||||
cd $VOLDEMORT/social-ecm/build && mvnci
|
||||
fi
|
||||
}
|
||||
|
||||
# clean jboss trash folders
|
||||
ecmclean() {
|
||||
echo "cleaning jboss shit"
|
||||
case $@ in
|
||||
-*d*)
|
||||
DRY_CLEAN="y"
|
||||
;;
|
||||
esac
|
||||
if [[ "$DRY_CLEAN" == "y" ]]; then
|
||||
rm -rf $ECM_JBOSS/standalone/deployments/*.{failed,deployed,dodeploy,deploying}
|
||||
else
|
||||
rm -rf $ECM_JBOSS/standalone/deployments/*
|
||||
fi
|
||||
rm -rf $ECM_JBOSS/standalone/{log,tmp,data}
|
||||
rm -rf $ECM_JBOSS/solr/zoo_data
|
||||
}
|
||||
|
||||
# start jboss server
|
||||
ecmstart() {
|
||||
# why shall I start server if i just gen a installer?
|
||||
if [[ "$INSTALLER" == "y" ]]; then
|
||||
ecmruninstall
|
||||
else
|
||||
echo "starting jboss"
|
||||
cd $ECM_JBOSS/bin
|
||||
JAVA_OPTS="-Xmx2048m -XX:MaxPermSize=512m -DzkRun -Dbootstrap_conf=true" ./standalone.sh
|
||||
fi
|
||||
}
|
||||
|
||||
ecmruninstall() {
|
||||
echo "ok, lets install this crap :)"
|
||||
cd $VOLDEMORT/ecm/installer/izpack/target
|
||||
if [[ -f ECM-Linux64.zip ]]; then
|
||||
mkdir -p /tmp/ecmi
|
||||
rm -rf /tmp/ecmi/*
|
||||
unzip ECM-Linux64 -d /tmp/ecmi/
|
||||
cd /tmp/ecmi/
|
||||
chmod a+x ECM-Installer-64.sh
|
||||
./ECM-Installer-64.sh
|
||||
else
|
||||
echo "uhoh, installer doesnt exist ($VOLDEMORT/ecm/installer/izpack/target/ECM-Linux64.zip)"
|
||||
fi
|
||||
}
|
||||
|
||||
# stop jboss (usually on 8080)
|
||||
ecmstop() {
|
||||
echo "kill jboss (or whatever you are running on 8080"
|
||||
fuser -k $ECM_PORT/tcp
|
||||
}
|
||||
|
||||
# do all the things
|
||||
ecmfull() {
|
||||
echo "serious business here. let's have a coffee.."
|
||||
ecmstop
|
||||
ecmclean
|
||||
ecmup
|
||||
ecmbuild && ecmstart
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
function zsh_stats() {
|
||||
history | awk '{print $2}' | sort | uniq -c | sort -rn | head
|
||||
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n20
|
||||
}
|
||||
|
||||
function uninstall_oh_my_zsh() {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
# get the name of the branch we are on
|
||||
function rvm_prompt_info() {
|
||||
ruby_version=$(~/.rvm/bin/rvm-prompt 2> /dev/null) || return
|
||||
echo "($ruby_version)"
|
||||
[[ ! -z $ruby_version ]] && echo "($ruby_version)"
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ if [ $commands[autojump] ]; then # check if autojump is installed
|
|||
. /etc/profile.d/autojump.zsh
|
||||
elif [ -f /opt/local/etc/profile.d/autojump.zsh ]; then # mac os x with ports
|
||||
. /opt/local/etc/profile.d/autojump.zsh
|
||||
elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump ]; then # mac os x with brew
|
||||
. `brew --prefix`/etc/autojump
|
||||
elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.zsh ]; then # mac os x with brew
|
||||
. `brew --prefix`/etc/autojump.zsh
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,8 +1,30 @@
|
|||
function _cap_does_task_list_need_generating () {
|
||||
if [ ! -f .cap_tasks~ ]; then return 0;
|
||||
stat -f%m . > /dev/null 2>&1
|
||||
if [ "$?" = 0 ]; then
|
||||
stat_cmd=(stat -f%m)
|
||||
else
|
||||
stat_cmd=(stat -L --format=%y)
|
||||
fi
|
||||
|
||||
# Cache filename
|
||||
_cap_show_undescribed_tasks=0
|
||||
|
||||
# Cache filename
|
||||
_cap_task_cache_file='.cap_task_cache'
|
||||
|
||||
_cap_get_task_list () {
|
||||
if [ ${_cap_show_undescribed_tasks} -eq 0 ]; then
|
||||
cap -T | grep '^cap' | cut -d " " -f 2
|
||||
else
|
||||
accurate=$(stat -f%m .cap_tasks~)
|
||||
changed=$(stat -f%m config/deploy.rb)
|
||||
cap -vT | grep '^cap' | cut -d " " -f 2
|
||||
fi
|
||||
}
|
||||
|
||||
_cap_does_task_list_need_generating () {
|
||||
|
||||
if [ ! -f ${_cap_task_cache_file} ]; then return 0;
|
||||
else
|
||||
accurate=$($stat_cmd $_cap_task_cache_file)
|
||||
changed=$($stat_cmd config/deploy.rb)
|
||||
return $(expr $accurate '>=' $changed)
|
||||
fi
|
||||
}
|
||||
|
|
@ -10,12 +32,10 @@ function _cap_does_task_list_need_generating () {
|
|||
function _cap () {
|
||||
if [ -f config/deploy.rb ]; then
|
||||
if _cap_does_task_list_need_generating; then
|
||||
echo "\nGenerating .cap_tasks~..." > /dev/stderr
|
||||
cap show_tasks -q | cut -d " " -f 1 | sed -e '/^ *$/D' -e '1,2D'
|
||||
> .cap_tasks~
|
||||
_cap_get_task_list > ${_cap_task_cache_file}
|
||||
fi
|
||||
compadd `cat .cap_tasks~`
|
||||
compadd `cat ${_cap_task_cache_file}`
|
||||
fi
|
||||
}
|
||||
|
||||
compctl -K _cap cap
|
||||
compdef _cap cap
|
||||
|
|
|
|||
29
plugins/composer/composer.plugin.zsh
Normal file
29
plugins/composer/composer.plugin.zsh
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# ------------------------------------------------------------------------------
|
||||
# FILE: composer.plugin.zsh
|
||||
# DESCRIPTION: oh-my-zsh composer plugin file.
|
||||
# AUTHOR: Daniel Gomes (me@danielcsgomes.com)
|
||||
# VERSION: 1.0.0
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Composer basic command completion
|
||||
_composer_get_command_list () {
|
||||
composer --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }'
|
||||
}
|
||||
|
||||
_composer () {
|
||||
if [ -f composer.json ]; then
|
||||
compadd `_composer_get_command_list`
|
||||
fi
|
||||
}
|
||||
|
||||
compdef _composer composer
|
||||
|
||||
# Aliases
|
||||
alias c='composer'
|
||||
alias csu='composer self-update'
|
||||
alias cu='composer update'
|
||||
alias ci='composer install'
|
||||
alias ccp='composer create-project'
|
||||
|
||||
# install composer in the current directory
|
||||
alias cget='curl -s https://getcomposer.org/installer | php'
|
||||
|
|
@ -61,7 +61,8 @@ if [[ $use_sudo -eq 1 ]]; then
|
|||
# Install all .deb files in the current directory.
|
||||
# Warning: you will need to put the glob in single quotes if you use:
|
||||
# glob_subst
|
||||
alias di='sudo dpkg -i ./*.deb'
|
||||
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) \
|
||||
|
|
@ -100,7 +101,8 @@ else
|
|||
|
||||
# Install all .deb files in the current directory
|
||||
# Assumes glob_subst is off
|
||||
alias di='su -lc "dpkg -i ./*.deb" root'
|
||||
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) \
|
||||
|
|
|
|||
|
|
@ -39,6 +39,10 @@ compdef _git gm=git-merge
|
|||
alias grh='git reset HEAD'
|
||||
alias grhh='git reset HEAD --hard'
|
||||
|
||||
# Will cd into the top of the current repository
|
||||
# or submodule.
|
||||
alias grt='cd $(git rev-parse --show-toplevel || echo ".")'
|
||||
|
||||
# Git and svn mix
|
||||
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
|
||||
compdef git-svn-dcommit-push=git
|
||||
|
|
|
|||
78
plugins/gitfast/_git
Normal file
78
plugins/gitfast/_git
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
#compdef git gitk
|
||||
|
||||
# zsh completion wrapper for git
|
||||
#
|
||||
# You need git's bash completion script installed somewhere, by default on the
|
||||
# same directory as this script.
|
||||
#
|
||||
# If your script is on ~/.git-completion.sh instead, you can configure it on
|
||||
# your ~/.zshrc:
|
||||
#
|
||||
# zstyle ':completion:*:*:git:*' script ~/.git-completion.sh
|
||||
#
|
||||
# The recommended way to install this script is to copy to
|
||||
# '~/.zsh/completion/_git', and then add the following to your ~/.zshrc file:
|
||||
#
|
||||
# fpath=(~/.zsh/completion $fpath)
|
||||
|
||||
complete ()
|
||||
{
|
||||
# do nothing
|
||||
return 0
|
||||
}
|
||||
|
||||
zstyle -s ":completion:*:*:git:*" script script
|
||||
test -z "$script" && script="$(dirname ${funcsourcetrace[1]%:*})"/git-completion.bash
|
||||
ZSH_VERSION='' . "$script"
|
||||
|
||||
__gitcomp ()
|
||||
{
|
||||
emulate -L zsh
|
||||
|
||||
local cur_="${3-$cur}"
|
||||
|
||||
case "$cur_" in
|
||||
--*=)
|
||||
;;
|
||||
*)
|
||||
local c IFS=$' \t\n'
|
||||
local -a array
|
||||
for c in ${=1}; do
|
||||
c="$c${4-}"
|
||||
case $c in
|
||||
--*=*|*.) ;;
|
||||
*) c="$c " ;;
|
||||
esac
|
||||
array+=("$c")
|
||||
done
|
||||
compset -P '*[=:]'
|
||||
compadd -Q -S '' -p "${2-}" -a -- array && _ret=0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
__gitcomp_nl ()
|
||||
{
|
||||
emulate -L zsh
|
||||
|
||||
local IFS=$'\n'
|
||||
compset -P '*[=:]'
|
||||
compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
|
||||
}
|
||||
|
||||
_git ()
|
||||
{
|
||||
local _ret=1
|
||||
() {
|
||||
emulate -L ksh
|
||||
local cur cword prev
|
||||
cur=${words[CURRENT-1]}
|
||||
prev=${words[CURRENT-2]}
|
||||
let cword=CURRENT-1
|
||||
__${service}_main
|
||||
}
|
||||
let _ret && _default -S '' && _ret=0
|
||||
return _ret
|
||||
}
|
||||
|
||||
_git
|
||||
2483
plugins/gitfast/git-completion.bash
Normal file
2483
plugins/gitfast/git-completion.bash
Normal file
File diff suppressed because it is too large
Load diff
290
plugins/gitfast/git-prompt.sh
Normal file
290
plugins/gitfast/git-prompt.sh
Normal file
|
|
@ -0,0 +1,290 @@
|
|||
# bash/zsh git prompt support
|
||||
#
|
||||
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
|
||||
# Distributed under the GNU General Public License, version 2.0.
|
||||
#
|
||||
# This script allows you to see the current branch in your prompt.
|
||||
#
|
||||
# To enable:
|
||||
#
|
||||
# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh).
|
||||
# 2) Add the following line to your .bashrc/.zshrc:
|
||||
# source ~/.git-prompt.sh
|
||||
# 3) Change your PS1 to also show the current branch:
|
||||
# Bash: PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
|
||||
# ZSH: PS1='[%n@%m %c$(__git_ps1 " (%s)")]\$ '
|
||||
#
|
||||
# The argument to __git_ps1 will be displayed only if you are currently
|
||||
# in a git repository. The %s token will be the name of the current
|
||||
# branch.
|
||||
#
|
||||
# In addition, if you set GIT_PS1_SHOWDIRTYSTATE to a nonempty value,
|
||||
# unstaged (*) and staged (+) changes will be shown next to the branch
|
||||
# name. You can configure this per-repository with the
|
||||
# bash.showDirtyState variable, which defaults to true once
|
||||
# GIT_PS1_SHOWDIRTYSTATE is enabled.
|
||||
#
|
||||
# You can also see if currently something is stashed, by setting
|
||||
# GIT_PS1_SHOWSTASHSTATE to a nonempty value. If something is stashed,
|
||||
# then a '$' will be shown next to the branch name.
|
||||
#
|
||||
# If you would like to see if there're untracked files, then you can set
|
||||
# GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're untracked
|
||||
# files, then a '%' will be shown next to the branch name.
|
||||
#
|
||||
# If you would like to see the difference between HEAD and its upstream,
|
||||
# set GIT_PS1_SHOWUPSTREAM="auto". A "<" indicates you are behind, ">"
|
||||
# indicates you are ahead, "<>" indicates you have diverged and "="
|
||||
# indicates that there is no difference. You can further control
|
||||
# behaviour by setting GIT_PS1_SHOWUPSTREAM to a space-separated list
|
||||
# of values:
|
||||
#
|
||||
# verbose show number of commits ahead/behind (+/-) upstream
|
||||
# legacy don't use the '--count' option available in recent
|
||||
# versions of git-rev-list
|
||||
# git always compare HEAD to @{upstream}
|
||||
# svn always compare HEAD to your SVN upstream
|
||||
#
|
||||
# By default, __git_ps1 will compare HEAD to your SVN upstream if it can
|
||||
# find one, or @{upstream} otherwise. Once you have set
|
||||
# GIT_PS1_SHOWUPSTREAM, you can override it on a per-repository basis by
|
||||
# setting the bash.showUpstream config variable.
|
||||
|
||||
# __gitdir accepts 0 or 1 arguments (i.e., location)
|
||||
# returns location of .git repo
|
||||
__gitdir ()
|
||||
{
|
||||
# Note: this function is duplicated in git-completion.bash
|
||||
# When updating it, make sure you update the other one to match.
|
||||
if [ -z "${1-}" ]; then
|
||||
if [ -n "${__git_dir-}" ]; then
|
||||
echo "$__git_dir"
|
||||
elif [ -n "${GIT_DIR-}" ]; then
|
||||
test -d "${GIT_DIR-}" || return 1
|
||||
echo "$GIT_DIR"
|
||||
elif [ -d .git ]; then
|
||||
echo .git
|
||||
else
|
||||
git rev-parse --git-dir 2>/dev/null
|
||||
fi
|
||||
elif [ -d "$1/.git" ]; then
|
||||
echo "$1/.git"
|
||||
else
|
||||
echo "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# stores the divergence from upstream in $p
|
||||
# used by GIT_PS1_SHOWUPSTREAM
|
||||
__git_ps1_show_upstream ()
|
||||
{
|
||||
local key value
|
||||
local svn_remote svn_url_pattern count n
|
||||
local upstream=git legacy="" verbose=""
|
||||
|
||||
svn_remote=()
|
||||
# get some config options from git-config
|
||||
local output="$(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')"
|
||||
while read -r key value; do
|
||||
case "$key" in
|
||||
bash.showupstream)
|
||||
GIT_PS1_SHOWUPSTREAM="$value"
|
||||
if [[ -z "${GIT_PS1_SHOWUPSTREAM}" ]]; then
|
||||
p=""
|
||||
return
|
||||
fi
|
||||
;;
|
||||
svn-remote.*.url)
|
||||
svn_remote[ $((${#svn_remote[@]} + 1)) ]="$value"
|
||||
svn_url_pattern+="\\|$value"
|
||||
upstream=svn+git # default upstream is SVN if available, else git
|
||||
;;
|
||||
esac
|
||||
done <<< "$output"
|
||||
|
||||
# parse configuration values
|
||||
for option in ${GIT_PS1_SHOWUPSTREAM}; do
|
||||
case "$option" in
|
||||
git|svn) upstream="$option" ;;
|
||||
verbose) verbose=1 ;;
|
||||
legacy) legacy=1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Find our upstream
|
||||
case "$upstream" in
|
||||
git) upstream="@{upstream}" ;;
|
||||
svn*)
|
||||
# get the upstream from the "git-svn-id: ..." in a commit message
|
||||
# (git-svn uses essentially the same procedure internally)
|
||||
local svn_upstream=($(git log --first-parent -1 \
|
||||
--grep="^git-svn-id: \(${svn_url_pattern#??}\)" 2>/dev/null))
|
||||
if [[ 0 -ne ${#svn_upstream[@]} ]]; then
|
||||
svn_upstream=${svn_upstream[ ${#svn_upstream[@]} - 2 ]}
|
||||
svn_upstream=${svn_upstream%@*}
|
||||
local n_stop="${#svn_remote[@]}"
|
||||
for ((n=1; n <= n_stop; n++)); do
|
||||
svn_upstream=${svn_upstream#${svn_remote[$n]}}
|
||||
done
|
||||
|
||||
if [[ -z "$svn_upstream" ]]; then
|
||||
# default branch name for checkouts with no layout:
|
||||
upstream=${GIT_SVN_ID:-git-svn}
|
||||
else
|
||||
upstream=${svn_upstream#/}
|
||||
fi
|
||||
elif [[ "svn+git" = "$upstream" ]]; then
|
||||
upstream="@{upstream}"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# Find how many commits we are ahead/behind our upstream
|
||||
if [[ -z "$legacy" ]]; then
|
||||
count="$(git rev-list --count --left-right \
|
||||
"$upstream"...HEAD 2>/dev/null)"
|
||||
else
|
||||
# produce equivalent output to --count for older versions of git
|
||||
local commits
|
||||
if commits="$(git rev-list --left-right "$upstream"...HEAD 2>/dev/null)"
|
||||
then
|
||||
local commit behind=0 ahead=0
|
||||
for commit in $commits
|
||||
do
|
||||
case "$commit" in
|
||||
"<"*) ((behind++)) ;;
|
||||
*) ((ahead++)) ;;
|
||||
esac
|
||||
done
|
||||
count="$behind $ahead"
|
||||
else
|
||||
count=""
|
||||
fi
|
||||
fi
|
||||
|
||||
# calculate the result
|
||||
if [[ -z "$verbose" ]]; then
|
||||
case "$count" in
|
||||
"") # no upstream
|
||||
p="" ;;
|
||||
"0 0") # equal to upstream
|
||||
p="=" ;;
|
||||
"0 "*) # ahead of upstream
|
||||
p=">" ;;
|
||||
*" 0") # behind upstream
|
||||
p="<" ;;
|
||||
*) # diverged from upstream
|
||||
p="<>" ;;
|
||||
esac
|
||||
else
|
||||
case "$count" in
|
||||
"") # no upstream
|
||||
p="" ;;
|
||||
"0 0") # equal to upstream
|
||||
p=" u=" ;;
|
||||
"0 "*) # ahead of upstream
|
||||
p=" u+${count#0 }" ;;
|
||||
*" 0") # behind upstream
|
||||
p=" u-${count% 0}" ;;
|
||||
*) # diverged from upstream
|
||||
p=" u+${count#* }-${count% *}" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
# __git_ps1 accepts 0 or 1 arguments (i.e., format string)
|
||||
# returns text to add to bash PS1 prompt (includes branch name)
|
||||
__git_ps1 ()
|
||||
{
|
||||
local g="$(__gitdir)"
|
||||
if [ -n "$g" ]; then
|
||||
local r=""
|
||||
local b=""
|
||||
if [ -f "$g/rebase-merge/interactive" ]; then
|
||||
r="|REBASE-i"
|
||||
b="$(cat "$g/rebase-merge/head-name")"
|
||||
elif [ -d "$g/rebase-merge" ]; then
|
||||
r="|REBASE-m"
|
||||
b="$(cat "$g/rebase-merge/head-name")"
|
||||
else
|
||||
if [ -d "$g/rebase-apply" ]; then
|
||||
if [ -f "$g/rebase-apply/rebasing" ]; then
|
||||
r="|REBASE"
|
||||
elif [ -f "$g/rebase-apply/applying" ]; then
|
||||
r="|AM"
|
||||
else
|
||||
r="|AM/REBASE"
|
||||
fi
|
||||
elif [ -f "$g/MERGE_HEAD" ]; then
|
||||
r="|MERGING"
|
||||
elif [ -f "$g/CHERRY_PICK_HEAD" ]; then
|
||||
r="|CHERRY-PICKING"
|
||||
elif [ -f "$g/BISECT_LOG" ]; then
|
||||
r="|BISECTING"
|
||||
fi
|
||||
|
||||
b="$(git symbolic-ref HEAD 2>/dev/null)" || {
|
||||
|
||||
b="$(
|
||||
case "${GIT_PS1_DESCRIBE_STYLE-}" in
|
||||
(contains)
|
||||
git describe --contains HEAD ;;
|
||||
(branch)
|
||||
git describe --contains --all HEAD ;;
|
||||
(describe)
|
||||
git describe HEAD ;;
|
||||
(* | default)
|
||||
git describe --tags --exact-match HEAD ;;
|
||||
esac 2>/dev/null)" ||
|
||||
|
||||
b="$(cut -c1-7 "$g/HEAD" 2>/dev/null)..." ||
|
||||
b="unknown"
|
||||
b="($b)"
|
||||
}
|
||||
fi
|
||||
|
||||
local w=""
|
||||
local i=""
|
||||
local s=""
|
||||
local u=""
|
||||
local c=""
|
||||
local p=""
|
||||
|
||||
if [ "true" = "$(git rev-parse --is-inside-git-dir 2>/dev/null)" ]; then
|
||||
if [ "true" = "$(git rev-parse --is-bare-repository 2>/dev/null)" ]; then
|
||||
c="BARE:"
|
||||
else
|
||||
b="GIT_DIR!"
|
||||
fi
|
||||
elif [ "true" = "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]; then
|
||||
if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ]; then
|
||||
if [ "$(git config --bool bash.showDirtyState)" != "false" ]; then
|
||||
git diff --no-ext-diff --quiet --exit-code || w="*"
|
||||
if git rev-parse --quiet --verify HEAD >/dev/null; then
|
||||
git diff-index --cached --quiet HEAD -- || i="+"
|
||||
else
|
||||
i="#"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ]; then
|
||||
git rev-parse --verify refs/stash >/dev/null 2>&1 && s="$"
|
||||
fi
|
||||
|
||||
if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ]; then
|
||||
if [ -n "$(git ls-files --others --exclude-standard)" ]; then
|
||||
u="%"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${GIT_PS1_SHOWUPSTREAM-}" ]; then
|
||||
__git_ps1_show_upstream
|
||||
fi
|
||||
fi
|
||||
|
||||
local f="$w$i$s$u"
|
||||
printf -- "${1:- (%s)}" "$c${b##refs/heads/}${f:+ $f}$r$p"
|
||||
fi
|
||||
}
|
||||
7
plugins/gitfast/gitfast.plugin.zsh
Normal file
7
plugins/gitfast/gitfast.plugin.zsh
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
dir=$(dirname $0)
|
||||
source $dir/../git/git.plugin.zsh
|
||||
source $dir/git-prompt.sh
|
||||
|
||||
function git_prompt_info() {
|
||||
__git_ps1 "${ZSH_THEME_GIT_PROMPT_PREFIX//\%/%%}%s${ZSH_THEME_GIT_PROMPT_SUFFIX//\%/%%}"
|
||||
}
|
||||
22
plugins/jira/jira.plugin.zsh
Normal file
22
plugins/jira/jira.plugin.zsh
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# To use: add a .jira-url file in the base of your project
|
||||
# Setup: cd to/my/project
|
||||
# echo "https://name.jira.com" >> .jira-url
|
||||
# Usage: jira # opens a new issue
|
||||
# jira ABC-123 # Opens an existing issue
|
||||
open_jira_issue () {
|
||||
if [ ! -f .jira-url ]; then
|
||||
echo "There is no .jira-url file in the current directory..."
|
||||
return 0;
|
||||
else
|
||||
jira_url=$(cat .jira-url);
|
||||
if [ -z "$1" ]; then
|
||||
echo "Opening new issue";
|
||||
`open $jira_url/secure/CreateIssue!default.jspa`;
|
||||
else
|
||||
echo "Opening issue #$1";
|
||||
`open $jira_url/issues/$1`;
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
alias jira='open_jira_issue'
|
||||
|
|
@ -1,6 +1,59 @@
|
|||
# mvn-color based on https://gist.github.com/1027800
|
||||
export BOLD=`tput bold`
|
||||
export UNDERLINE_ON=`tput smul`
|
||||
export UNDERLINE_OFF=`tput rmul`
|
||||
export TEXT_BLACK=`tput setaf 0`
|
||||
export TEXT_RED=`tput setaf 1`
|
||||
export TEXT_GREEN=`tput setaf 2`
|
||||
export TEXT_YELLOW=`tput setaf 3`
|
||||
export TEXT_BLUE=`tput setaf 4`
|
||||
export TEXT_MAGENTA=`tput setaf 5`
|
||||
export TEXT_CYAN=`tput setaf 6`
|
||||
export TEXT_WHITE=`tput setaf 7`
|
||||
export BACKGROUND_BLACK=`tput setab 0`
|
||||
export BACKGROUND_RED=`tput setab 1`
|
||||
export BACKGROUND_GREEN=`tput setab 2`
|
||||
export BACKGROUND_YELLOW=`tput setab 3`
|
||||
export BACKGROUND_BLUE=`tput setab 4`
|
||||
export BACKGROUND_MAGENTA=`tput setab 5`
|
||||
export BACKGROUND_CYAN=`tput setab 6`
|
||||
export BACKGROUND_WHITE=`tput setab 7`
|
||||
export RESET_FORMATTING=`tput sgr0`
|
||||
|
||||
|
||||
# Wrapper function for Maven's mvn command.
|
||||
mvn-color()
|
||||
{
|
||||
# Filter mvn output using sed
|
||||
mvn $@ | sed -e "s/\(\[INFO\]\ \-.*\)/${TEXT_BLUE}${BOLD}\1/g" \
|
||||
-e "s/\(\[INFO\]\ \[.*\)/${RESET_FORMATTING}${BOLD}\1${RESET_FORMATTING}/g" \
|
||||
-e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \
|
||||
-e "s/\(\[WARNING\].*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}/g" \
|
||||
-e "s/\(\[ERROR\].*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}/g" \
|
||||
-e "s/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/${BOLD}${TEXT_GREEN}Tests run: \1${RESET_FORMATTING}, Failures: ${BOLD}${TEXT_RED}\2${RESET_FORMATTING}, Errors: ${BOLD}${TEXT_RED}\3${RESET_FORMATTING}, Skipped: ${BOLD}${TEXT_YELLOW}\4${RESET_FORMATTING}/g"
|
||||
|
||||
# Make sure formatting is reset
|
||||
echo -ne ${RESET_FORMATTING}
|
||||
}
|
||||
|
||||
# Override the mvn command with the colorized one.
|
||||
#alias mvn="mvn-color"
|
||||
|
||||
# aliases
|
||||
alias mvncie='mvn clean install eclipse:eclipse'
|
||||
alias mvnci='mvn clean install'
|
||||
alias mvne='mvn eclipse:eclipse'
|
||||
alias mvnce='mvn clean eclipse:clean eclipse:eclipse'
|
||||
alias mvnd='mvn deploy'
|
||||
alias mvnp='mvn package'
|
||||
alias mvnc='mvn clean'
|
||||
alias mvncom='mvn compile'
|
||||
alias mvnt='mvn test'
|
||||
alias mvnag='mvn archetype:generate'
|
||||
|
||||
function listMavenCompletions {
|
||||
reply=(
|
||||
cli:execute cli:execute-phase archetype:generate generate-sources compile clean install test test-compile deploy package cobertura:cobertura jetty:run gwt:run gwt:debug -DskipTests -Dmaven.test.skip=true -DarchetypeCatalog=http://tapestry.formos.com/maven-snapshot-repository -Dtest= `if [ -d ./src ] ; then find ./src -type f | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi`);
|
||||
}
|
||||
|
||||
compctl -K listMavenCompletions mvn
|
||||
compctl -K listMavenCompletions mvn
|
||||
|
|
|
|||
44
plugins/nanoc/_nanoc
Normal file
44
plugins/nanoc/_nanoc
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#compdef nanoc
|
||||
#autoload
|
||||
|
||||
# nanoc zsh completion - based on the homebrew zsh completion
|
||||
# requires the 'nanoc' gem to be installed
|
||||
|
||||
local -a _1st_arguments
|
||||
_1st_arguments=(
|
||||
'autocompile:start the autocompiler'
|
||||
'compile:compile items of this site'
|
||||
'create-item:create an item'
|
||||
'create-layout:create a layout'
|
||||
'create-site:create a site'
|
||||
'deploy:deploy the compiled site'
|
||||
'help:show help'
|
||||
'prune:remove files not managed by nanoc from the output directory'
|
||||
'show-data:show data in this site'
|
||||
'show-plugins:show all available plugins'
|
||||
'show-rules:describe the rules for each item'
|
||||
'update:update the data stored by the data source to a newer version'
|
||||
'validate-css:validate the site’s CSS'
|
||||
'validate-html:validate the site’s HTML'
|
||||
'validate-links:validate links in site'
|
||||
'view:start the web server that serves static files'
|
||||
'watch:start the watcher'
|
||||
)
|
||||
|
||||
local expl
|
||||
local -a pkgs installed_pkgs
|
||||
|
||||
_arguments \
|
||||
'(--color)--color[enable color]' \
|
||||
'(--debug)--debug[enable debugging]' \
|
||||
'(--help)--help[show the help message and quit]' \
|
||||
'(--no-color)--no-color[disable color]' \
|
||||
'(--verbose)--verbose[make nanoc output more detailed]' \
|
||||
'(--version)--version[show version information and quit]' \
|
||||
'(--warn)--warn[enable warnings]' \
|
||||
'*:: :->subcmds' && return 0
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "nanoc subcommand" _1st_arguments
|
||||
return
|
||||
fi
|
||||
9
plugins/nanoc/nanoc.plugin.zsh
Normal file
9
plugins/nanoc/nanoc.plugin.zsh
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
alias n='nanoc'
|
||||
alias na='nanoc autocompile'
|
||||
alias nco='nanoc compile'
|
||||
alias nci='nanoc create_item'
|
||||
alias ncl='nanoc create_layout'
|
||||
alias ncs='nanoc create_site'
|
||||
alias nd='nanoc deploy'
|
||||
alias nv='nanoc view'
|
||||
alias nw='nanoc watch'
|
||||
|
|
@ -2,7 +2,11 @@
|
|||
#unamestr = 'uname'
|
||||
|
||||
if [[ $('uname') == 'Linux' ]]; then
|
||||
alias st='/usr/bin/sublime_text&'
|
||||
if [ -f '/usr/bin/sublime_text' ]; then
|
||||
alias st='/usr/bin/sublime_text&'
|
||||
else
|
||||
alias st='/usr/bin/sublime-text&'
|
||||
fi
|
||||
elif [[ $('uname') == 'Darwin' ]]; then
|
||||
alias st='/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl'
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ function svn_get_rev_nr {
|
|||
|
||||
function svn_dirty_choose {
|
||||
if [ $(in_svn) ]; then
|
||||
s=$(svn status|grep -E '^\s*[ACDIM!?L]' 2>/dev/null)
|
||||
if [ $s ]; then
|
||||
svn status 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]'
|
||||
if [ $pipestatus[-1] -ne 0 ]; then
|
||||
echo $1
|
||||
else
|
||||
echo $2
|
||||
|
|
|
|||
|
|
@ -10,4 +10,8 @@ _symfony2 () {
|
|||
fi
|
||||
}
|
||||
|
||||
compdef _symfony2 app/console
|
||||
compdef _symfony2 app/console
|
||||
|
||||
#Alias
|
||||
alias sf2='php app/console'
|
||||
alias sf2clear='php app/console cache:clear'
|
||||
9
plugins/urltools/urltools.plugin.zsh
Normal file
9
plugins/urltools/urltools.plugin.zsh
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# URL Tools
|
||||
# Adds handy command line aliases useful for dealing with URLs
|
||||
#
|
||||
# Taken from:
|
||||
# http://ruslanspivak.com/2010/06/02/urlencode-and-urldecode-from-a-command-line/
|
||||
|
||||
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"'
|
||||
|
||||
alias urldecode='python -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"'
|
||||
41
plugins/zeus/README.md
Normal file
41
plugins/zeus/README.md
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
## zeus
|
||||
**Maintainer:** [b4mboo](https://github.com/b4mboo)
|
||||
|
||||
* `zi` aliases `zeus init`
|
||||
* `zinit` aliases `zeus init`
|
||||
|
||||
* `zs` aliases `zeus start`
|
||||
* `ztart` aliases `zeus start`
|
||||
|
||||
* `zc` aliases `zeus console`
|
||||
* `zonsole` aliases `zeus console`
|
||||
|
||||
* `zsr` aliases `zeus server`
|
||||
* `zerver` aliases `zeus server`
|
||||
|
||||
* `zr` aliases `zeus rake`
|
||||
* `zake` aliases `zeus rake`
|
||||
|
||||
* `zg` aliases `zeus generate`
|
||||
* `zenerate` aliases `zeus generate`
|
||||
|
||||
* `zrn` aliases `zeus runner`
|
||||
* `zunner` aliases `zeus runner`
|
||||
|
||||
* `zcu` aliases `zeus cucumber`
|
||||
* `zucumber` aliases `zeus cucumber`
|
||||
|
||||
* `zt` aliases `zeus test`
|
||||
* `zest` aliases `zeus test`
|
||||
|
||||
* `zu` aliases `zeus test test/unit/*`
|
||||
* `zunits` aliases `zeus test test/unit/*`
|
||||
|
||||
* `zf` aliases `zeus test test/functional/*`
|
||||
* `zunctional` aliases `zeus test test/functional/*`
|
||||
|
||||
* `za` aliases `zeus test test/unit/*; zeus test test/functional/; zeus cucumber`
|
||||
* `zall` aliases `zeus test test/unit/*; zeus test test/functional/; zeus cucumber`
|
||||
|
||||
* `zsw` aliases `rm .zeus.sock`
|
||||
* `zweep` aliases `rm .zeus.sock`
|
||||
58
plugins/zeus/zeus.plugin.zsh
Normal file
58
plugins/zeus/zeus.plugin.zsh
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
# Some aliases for zeus. (See: https://github.com/burke/zeus)
|
||||
# Zeus preloads your Rails environment and forks that process whenever
|
||||
# needed. This effectively speeds up Rails' boot process to under 1 sec.
|
||||
|
||||
# Always use bundler.
|
||||
# Rails depends on bundler, so we can be pretty sure, that there are no
|
||||
# problems with this command. For all the other aliases I provided an
|
||||
# alternative, in case people have conflicts with other plugins (e.g. suse).
|
||||
alias zeus='bundle exec zeus'
|
||||
|
||||
# Init
|
||||
alias zi='zeus init'
|
||||
alias zinit='zeus init'
|
||||
|
||||
# Start
|
||||
alias zs='zeus start'
|
||||
alias ztart='zeus start'
|
||||
|
||||
# Console
|
||||
alias zc='zeus console'
|
||||
alias zonsole='zeus console'
|
||||
|
||||
# Server
|
||||
alias zsr='zeus server'
|
||||
alias zerver='zeus server'
|
||||
|
||||
# Rake
|
||||
alias zr='zeus rake'
|
||||
alias zake='zeus rake'
|
||||
|
||||
# Generate
|
||||
alias zg='zeus generate'
|
||||
alias zenerate='zeus generate'
|
||||
|
||||
# Runner
|
||||
alias zrn='zeus runner'
|
||||
alias zunner='zeus runner'
|
||||
|
||||
# Cucumber
|
||||
alias zcu='zeus cucumber'
|
||||
alias zucumber='zeus cucumber'
|
||||
|
||||
# Test
|
||||
alias zt='zeus test'
|
||||
alias zest='zeus test'
|
||||
|
||||
alias zu='zeus test test/unit/*'
|
||||
alias zunits='zeus test test/unit/*'
|
||||
|
||||
alias zf='zeus test test/functional/*'
|
||||
alias zunctional='zeus test test/functional/*'
|
||||
|
||||
alias za='zeus test test/unit/*; zeus test test/functional/; zeus cucumber'
|
||||
alias zall='zeus test test/unit/*; zeus test test/functional/; zeus cucumber'
|
||||
|
||||
# Clean up crashed zeus instances.
|
||||
alias zsw='rm .zeus.sock'
|
||||
alias zweep='rm .zeus.sock'
|
||||
Loading…
Add table
Add a link
Reference in a new issue