mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-30 02:44:42 +01:00
Merged official branch changes.
This commit is contained in:
commit
ee3267f30d
163 changed files with 8009 additions and 553 deletions
21
MIT-LICENSE.txt
Normal file
21
MIT-LICENSE.txt
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License
|
||||
|
||||
Copyright (c) 2009-2013 Robby Russell and contributors (see https://github.com/robbyrussell/oh-my-zsh/contributors)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
A handful of functions, auto-complete helpers, and stuff that makes you shout...
|
||||
|
||||
oh-my-zsh is an open source, community-driven framework for managing your ZSH configuration. It comes bundled with a ton of helpful functions, helpers, plugins, themes, and few things that make you shout...
|
||||
|
||||
bq. "OH MY ZSHELL!"
|
||||
|
||||
|
|
@ -26,17 +25,20 @@ h3. The manual way
|
|||
|
||||
@git clone git://github.com/cadusk/oh-my-zsh.git ~/.oh-my-zsh@
|
||||
|
||||
2. Create a new zsh config by copying the zsh template we've provided.
|
||||
2. *OPTIONAL* Backup your existing ~/.zshrc file
|
||||
|
||||
*NOTE*: If you already have a ~/.zshrc file, you should back it up. @cp ~/.zshrc ~/.zshrc.orig@ in case you want to go back to your original settings.
|
||||
@cp ~/.zshrc ~/.zshrc.orig@
|
||||
|
||||
3. Create a new zsh config by copying the zsh template we've provided.
|
||||
|
||||
@cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc@
|
||||
|
||||
3. Set zsh as your default shell:
|
||||
|
||||
4. Set zsh as your default shell:
|
||||
|
||||
@chsh -s /bin/zsh@
|
||||
|
||||
4. Start / restart zsh (open a new terminal is easy enough...)
|
||||
5. Start / restart zsh (open a new terminal is easy enough...)
|
||||
|
||||
h3. Problems?
|
||||
|
||||
|
|
@ -60,6 +62,15 @@ If you want to override any of the default behavior, just add a new file (ending
|
|||
If you have many functions which go well together you can put them as a *.plugin.zsh file in the @custom/plugins/@ directory and then enable this plugin.
|
||||
If you would like to override the functionality of a plugin distributed with oh-my-zsh, create a plugin of the same name in the @custom/plugins/@ directory and it will be loaded instead of the one in @plugins/@.
|
||||
|
||||
h3. Updates
|
||||
|
||||
By default you will be prompted to check for updates. If you would like oh-my-zsh to automatically update itself without prompting you, set the following in your ~/.zshrc
|
||||
|
||||
@DISABLE_UPDATE_PROMPT=true@
|
||||
|
||||
To disable updates entirely, put this in your ~/.zshrc
|
||||
|
||||
@DISABLE_AUTO_UPDATE=true@
|
||||
|
||||
h3. Uninstalling
|
||||
|
||||
|
|
@ -73,9 +84,7 @@ h3. (Don't) Send us your theme! (for now)
|
|||
|
||||
-I'm hoping to collect a bunch of themes for our command prompts. You can see existing ones in the @themes/@ directory.-
|
||||
|
||||
We have enough themes for the time being. Please fork the project and add on in there, you can let people know how to grab it from there.
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ alias -- -='cd -'
|
|||
|
||||
# Super user
|
||||
alias _='sudo'
|
||||
alias please='sudo'
|
||||
|
||||
#alias g='grep -in'
|
||||
|
||||
|
|
@ -24,8 +25,10 @@ fi
|
|||
|
||||
# List direcory contents
|
||||
alias lsa='ls -lah'
|
||||
alias l='ls -la'
|
||||
#alias l='ls -la'
|
||||
alias ll='ls -l'
|
||||
alias la='ls -lA'
|
||||
alias l=la
|
||||
alias sl=ls # often screw this up
|
||||
|
||||
alias afind='ack-grep -il'
|
||||
|
|
|
|||
|
|
@ -32,10 +32,12 @@ zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-dir
|
|||
cdpath=(.)
|
||||
|
||||
# use /etc/hosts and known_hosts for hostname completion
|
||||
[ -r /etc/ssh/ssh_known_hosts ] && _global_ssh_hosts=(${${${${(f)"$(</etc/ssh/ssh_known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
|
||||
[ -r /etc/ssh/ssh_known_hosts ] && _global_ssh_hosts=(${${${${(f)"$(</etc/ssh/ssh_known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _global_ssh_hosts=()
|
||||
[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
|
||||
[ -r ~/.ssh/config ] && _ssh_config=($(cat ~/.ssh/config | sed -ne 's/Host[=\t ]//p')) || _ssh_config=()
|
||||
[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
|
||||
hosts=(
|
||||
"$_ssh_config[@]"
|
||||
"$_global_ssh_hosts[@]"
|
||||
"$_ssh_hosts[@]"
|
||||
"$_etc_hosts[@]"
|
||||
|
|
@ -43,6 +45,7 @@ hosts=(
|
|||
localhost
|
||||
)
|
||||
zstyle ':completion:*:hosts' hosts $hosts
|
||||
zstyle ':completion:*' users off
|
||||
|
||||
# Use caching so that commands like apt and dpkg complete are useable
|
||||
zstyle ':completion::complete:*' use-cache 1
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
setopt correct_all
|
||||
|
||||
alias man='nocorrect man'
|
||||
alias mv='nocorrect mv'
|
||||
alias mysql='nocorrect mysql'
|
||||
alias mkdir='nocorrect mkdir'
|
||||
alias gist='nocorrect gist'
|
||||
alias heroku='nocorrect heroku'
|
||||
alias ebuild='nocorrect ebuild'
|
||||
alias hpodder='nocorrect hpodder'
|
||||
if [[ "$DISABLE_CORRECTION" == "true" ]]; then
|
||||
return
|
||||
else
|
||||
setopt correct_all
|
||||
alias man='nocorrect man'
|
||||
alias mv='nocorrect mv'
|
||||
alias mysql='nocorrect mysql'
|
||||
alias mkdir='nocorrect mkdir'
|
||||
alias gist='nocorrect gist'
|
||||
alias heroku='nocorrect heroku'
|
||||
alias ebuild='nocorrect ebuild'
|
||||
alias hpodder='nocorrect hpodder'
|
||||
alias sudo='nocorrect sudo'
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
setopt auto_name_dirs
|
||||
setopt auto_pushd
|
||||
setopt pushd_ignore_dups
|
||||
setopt pushdminus
|
||||
|
||||
alias ..='cd ..'
|
||||
alias cd..='cd ..'
|
||||
|
|
@ -11,14 +12,14 @@ 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'
|
||||
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
|
||||
|
|
@ -26,9 +27,12 @@ cd () {
|
|||
elif [[ "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
|
||||
|
|
@ -37,8 +41,3 @@ cd () {
|
|||
alias md='mkdir -p'
|
||||
alias rd=rmdir
|
||||
alias d='dirs -v | head -10'
|
||||
|
||||
# mkdir & cd to it
|
||||
function mcd() {
|
||||
mkdir -p "$1" && cd "$1";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
65
lib/git.zsh
65
lib/git.zsh
|
|
@ -1,6 +1,7 @@
|
|||
# get the name of the branch we are on
|
||||
function git_prompt_info() {
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
|
||||
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
|
||||
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
}
|
||||
|
||||
|
|
@ -8,16 +9,46 @@ function git_prompt_info() {
|
|||
# Checks if working tree is dirty
|
||||
parse_git_dirty() {
|
||||
local SUBMODULE_SYNTAX=''
|
||||
if [[ $POST_1_7_2_GIT -gt 0 ]]; then
|
||||
SUBMODULE_SYNTAX="--ignore-submodules=dirty"
|
||||
fi
|
||||
if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
|
||||
local GIT_STATUS=''
|
||||
local CLEAN_MESSAGE='nothing to commit (working directory clean)'
|
||||
if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then
|
||||
if [[ $POST_1_7_2_GIT -gt 0 ]]; then
|
||||
SUBMODULE_SYNTAX="--ignore-submodules=dirty"
|
||||
fi
|
||||
if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
|
||||
GIT_STATUS=$(git status -s ${SUBMODULE_SYNTAX} -uno 2> /dev/null | tail -n1)
|
||||
else
|
||||
GIT_STATUS=$(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null | tail -n1)
|
||||
fi
|
||||
if [[ -n $GIT_STATUS ]]; then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
|
||||
else
|
||||
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||
fi
|
||||
else
|
||||
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||
fi
|
||||
}
|
||||
|
||||
# get the difference between the local and remote branches
|
||||
git_remote_status() {
|
||||
remote=${$(git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/}
|
||||
if [[ -n ${remote} ]] ; then
|
||||
ahead=$(git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
|
||||
behind=$(git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
|
||||
|
||||
if [ $ahead -eq 0 ] && [ $behind -gt 0 ]
|
||||
then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE"
|
||||
elif [ $ahead -gt 0 ] && [ $behind -eq 0 ]
|
||||
then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE"
|
||||
elif [ $ahead -gt 0 ] && [ $behind -gt 0 ]
|
||||
then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if there are commits ahead from remote
|
||||
function git_prompt_ahead() {
|
||||
|
|
@ -38,9 +69,9 @@ function git_prompt_long_sha() {
|
|||
|
||||
# Get the status of the working tree
|
||||
git_prompt_status() {
|
||||
INDEX=$(git status --porcelain 2> /dev/null)
|
||||
INDEX=$(git status --porcelain -b 2> /dev/null)
|
||||
STATUS=""
|
||||
if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then
|
||||
if $(echo "$INDEX" | grep -E '^\?\? ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^A ' &> /dev/null); then
|
||||
|
|
@ -60,23 +91,37 @@ git_prompt_status() {
|
|||
fi
|
||||
if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
|
||||
elif $(echo "$INDEX" | grep '^D ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
|
||||
elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
|
||||
fi
|
||||
if $(git rev-parse --verify refs/stash >/dev/null 2>&1); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_STASHED$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^## .*ahead' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_AHEAD$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^## .*behind' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_BEHIND$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^## .*diverged' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_DIVERGED$STATUS"
|
||||
fi
|
||||
echo $STATUS
|
||||
}
|
||||
|
||||
#compare the provided version of git to the version installed and on path
|
||||
#prints 1 if input version <= installed version
|
||||
#prints -1 otherwise
|
||||
#prints -1 otherwise
|
||||
function git_compare_version() {
|
||||
local INPUT_GIT_VERSION=$1;
|
||||
local INSTALLED_GIT_VERSION
|
||||
INPUT_GIT_VERSION=(${(s/./)INPUT_GIT_VERSION});
|
||||
INSTALLED_GIT_VERSION=($(git --version));
|
||||
INSTALLED_GIT_VERSION=($(git --version 2>/dev/null));
|
||||
INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]});
|
||||
|
||||
for i in {1..3}; do
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
## Command history configuration
|
||||
HISTFILE=$HOME/.zsh_history
|
||||
if [ -z $HISTFILE ]; then
|
||||
HISTFILE=$HOME/.zsh_history
|
||||
fi
|
||||
HISTSIZE=10000
|
||||
SAVEHIST=10000
|
||||
|
||||
|
|
|
|||
|
|
@ -9,5 +9,7 @@ bindkey "^[m" copy-prev-shell-word
|
|||
setopt long_list_jobs
|
||||
|
||||
## pager
|
||||
export PAGER="less -R"
|
||||
export PAGER="less"
|
||||
export LESS="-R"
|
||||
|
||||
export LC_CTYPE=$LANG
|
||||
|
|
|
|||
2
lib/rbenv.zsh
Normal file
2
lib/rbenv.zsh
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# using the rbenv plugin will override this with a real implementation
|
||||
function rbenv_prompt_info() {}
|
||||
|
|
@ -1,5 +1,8 @@
|
|||
# get the name of the branch we are on
|
||||
# get the name of the ruby version
|
||||
function rvm_prompt_info() {
|
||||
ruby_version=$(~/.rvm/bin/rvm-prompt 2> /dev/null) || return
|
||||
[[ ! -z $ruby_version ]] && echo "($ruby_version)"
|
||||
[ -f $HOME/.rvm/bin/rvm-prompt ] || return
|
||||
local rvm_prompt
|
||||
rvm_prompt=$($HOME/.rvm/bin/rvm-prompt ${ZSH_THEME_RVM_PROMPT_OPTIONS} 2>/dev/null)
|
||||
[[ "${rvm_prompt}x" == "x" ]] && return
|
||||
echo "${ZSH_THEME_RVM_PROMPT_PREFIX:=(}${rvm_prompt}${ZSH_THEME_RVM_PROMPT_SUFFIX:=)}"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ function title {
|
|||
fi
|
||||
if [[ "$TERM" == screen* ]]; then
|
||||
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
|
||||
elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
||||
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 (will override window name on broken terminal)
|
||||
fi
|
||||
|
|
@ -26,8 +26,8 @@ function omz_termsupport_precmd {
|
|||
function omz_termsupport_preexec {
|
||||
emulate -L zsh
|
||||
setopt extended_glob
|
||||
local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
|
||||
title "$CMD" "%100>...>$2%<<"
|
||||
local CMD=${1[(wr)^(*=*|sudo|ssh|rake|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
|
||||
title "$CMD" "%100>...>${2:gs/%/%%}%<<"
|
||||
}
|
||||
|
||||
autoload -U add-zsh-hook
|
||||
|
|
|
|||
|
|
@ -3,6 +3,19 @@ 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'
|
||||
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
|
||||
|
|
|
|||
14
oh-my-zsh.sh
14
oh-my-zsh.sh
|
|
@ -1,7 +1,7 @@
|
|||
# Check for updates on initial load...
|
||||
if [ "$DISABLE_AUTO_UPDATE" != "true" ]
|
||||
then
|
||||
/usr/bin/env ZSH=$ZSH zsh $ZSH/tools/check_for_upgrade.sh
|
||||
/usr/bin/env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh $ZSH/tools/check_for_upgrade.sh
|
||||
fi
|
||||
|
||||
# Initializes Oh My Zsh
|
||||
|
|
@ -11,7 +11,9 @@ fpath=($ZSH/functions $ZSH/completions $fpath)
|
|||
|
||||
# Load all of the config files in ~/oh-my-zsh that end in .zsh
|
||||
# TIP: Add files you don't want in git to .gitignore
|
||||
for config_file ($ZSH/lib/*.zsh) source $config_file
|
||||
for config_file ($ZSH/lib/*.zsh); do
|
||||
source $config_file
|
||||
done
|
||||
|
||||
# Set ZSH_CUSTOM to the path where your custom config files
|
||||
# and plugins exists, or else we will use the default custom/
|
||||
|
|
@ -51,7 +53,10 @@ for plugin ($plugins); do
|
|||
done
|
||||
|
||||
# Load all of your custom configurations from custom/
|
||||
for config_file ($ZSH_CUSTOM/*.zsh(N)) source $config_file
|
||||
for config_file ($ZSH_CUSTOM/*.zsh(N)); do
|
||||
source $config_file
|
||||
done
|
||||
unset config_file
|
||||
|
||||
# Load the theme
|
||||
if [ "$ZSH_THEME" = "random" ]
|
||||
|
|
@ -68,6 +73,9 @@ else
|
|||
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
|
||||
|
|
|
|||
|
|
@ -1,17 +1,7 @@
|
|||
stat -f%m . > /dev/null 2>&1
|
||||
if [ "$?" = 0 ]; then
|
||||
stat_cmd=(stat -f%m)
|
||||
else
|
||||
stat_cmd=(stat -L --format=%Y)
|
||||
fi
|
||||
|
||||
_ant_does_target_list_need_generating () {
|
||||
if [ ! -f .ant_targets ]; then return 0;
|
||||
else
|
||||
accurate=$($stat_cmd .ant_targets)
|
||||
changed=$($stat_cmd build.xml)
|
||||
return $(expr $accurate '>=' $changed)
|
||||
fi
|
||||
[ ! -f .ant_targets ] && return 0;
|
||||
[ .ant_targets -nt build.xml ] && return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
_ant () {
|
||||
|
|
|
|||
|
|
@ -8,16 +8,18 @@ if [[ -x `which yaourt` ]]; then
|
|||
}
|
||||
alias yaconf='yaourt -C' # Fix all configuration files with vimdiff
|
||||
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
|
||||
alias yaupg='yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
|
||||
alias 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 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` ]]; then
|
||||
alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
|
||||
|
|
@ -35,7 +37,7 @@ 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 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
|
||||
|
|
@ -75,3 +77,19 @@ pacdisowned() {
|
|||
|
||||
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
|
||||
}
|
||||
|
|
|
|||
18
plugins/autoenv/autoenv.plugin.zsh
Normal file
18
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
|
||||
}
|
||||
|
|
@ -3,9 +3,13 @@ if [ $commands[autojump] ]; then # check if autojump is installed
|
|||
. /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 $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation
|
||||
. $HOME/.autojump/etc/profile.d/autojump.zsh
|
||||
elif [ -f /opt/local/etc/profile.d/autojump.zsh ]; then # mac os x with ports
|
||||
. /opt/local/etc/profile.d/autojump.zsh
|
||||
elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump ]; 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,20 +1,82 @@
|
|||
if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
|
||||
function battery_pct_remaining() { echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')" }
|
||||
function battery_time_remaining() { echo $(acpi | cut -f3 -d ',') }
|
||||
function battery_pct_prompt() {
|
||||
b=$(battery_pct_remaining)
|
||||
if [ $b -gt 50 ] ; then
|
||||
color='green'
|
||||
elif [ $b -gt 20 ] ; then
|
||||
color='yellow'
|
||||
else
|
||||
color='red'
|
||||
fi
|
||||
echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
|
||||
###########################################
|
||||
# Battery plugin for oh-my-zsh #
|
||||
# Original Author: Peter hoeg (peterhoeg) #
|
||||
# Email: peter@speartail.com #
|
||||
###########################################
|
||||
# Author: Sean Jones (neuralsandwich) #
|
||||
# Email: neuralsandwich@gmail.com #
|
||||
# Modified to add support for Apple Mac #
|
||||
###########################################
|
||||
|
||||
if [[ $(uname) == "Darwin" ]] ; then
|
||||
|
||||
function battery_pct() {
|
||||
typeset -F maxcapacity=$(ioreg -rc "AppleSmartBattery"| grep '^.*"MaxCapacity"\ =\ ' | sed -e 's/^.*"MaxCapacity"\ =\ //')
|
||||
typeset -F currentcapacity=$(ioreg -rc "AppleSmartBattery"| grep '^.*"CurrentCapacity"\ =\ ' | sed -e 's/^.*CurrentCapacity"\ =\ //')
|
||||
integer i=$(((currentcapacity/maxcapacity) * 100))
|
||||
echo $i
|
||||
}
|
||||
|
||||
function battery_pct_remaining() {
|
||||
if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
|
||||
battery_pct
|
||||
else
|
||||
echo "External Power"
|
||||
fi
|
||||
}
|
||||
|
||||
function battery_time_remaining() {
|
||||
if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
|
||||
timeremaining=$(ioreg -rc "AppleSmartBattery"| grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //')
|
||||
echo "~$((timeremaining / 60)):$((timeremaining % 60))"
|
||||
else
|
||||
echo "∞"
|
||||
fi
|
||||
}
|
||||
|
||||
function battery_pct_prompt () {
|
||||
if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
|
||||
b=$(battery_pct_remaining)
|
||||
if [ $b -gt 50 ] ; then
|
||||
color='green'
|
||||
elif [ $b -gt 20 ] ; then
|
||||
color='yellow'
|
||||
else
|
||||
color='red'
|
||||
fi
|
||||
echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
|
||||
else
|
||||
echo "∞"
|
||||
fi
|
||||
}
|
||||
|
||||
elif [[ $(uname) == "Linux" ]] ; then
|
||||
|
||||
function battery_pct_remaining() {
|
||||
if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
|
||||
echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')"
|
||||
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
|
||||
error_msg='no battery'
|
||||
function battery_pct_remaining() { echo $error_msg }
|
||||
function battery_time_remaining() { echo $error_msg }
|
||||
function battery_pct_prompt() { echo '' }
|
||||
fi
|
||||
|
|
|
|||
58
plugins/bower/_bower
Executable file
58
plugins/bower/_bower
Executable 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-###
|
||||
|
||||
38
plugins/bower/bower.plugin.zsh
Normal file
38
plugins/bower/bower.plugin.zsh
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
alias bi="bower install"
|
||||
alias bl="bower list"
|
||||
alias bs="bower search"
|
||||
|
||||
bower_package_list=''
|
||||
|
||||
_bower ()
|
||||
{
|
||||
local curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
':command:->command' \
|
||||
'*::options:->options'
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
|
||||
local -a subcommands
|
||||
subcommands=(${=$(bower help | grep help | sed -e 's/,//g')})
|
||||
_describe -t commands 'bower' subcommands
|
||||
;;
|
||||
|
||||
(options)
|
||||
case $line[1] in
|
||||
|
||||
(install)
|
||||
if [ -z "$bower_package_list" ];then
|
||||
bower_package_list=$(bower search | awk 'NR > 2' | cut -d '-' -f 2 | cut -d ' ' -f 2 | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g")
|
||||
fi
|
||||
compadd "$@" $(echo $bower_package_list)
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
compdef _bower bower
|
||||
|
|
@ -35,6 +35,7 @@ _1st_arguments=(
|
|||
'update:freshen up links'
|
||||
'upgrade:upgrade outdated formulae'
|
||||
'uses:show formulas which depend on a formula'
|
||||
'versions:show all available formula versions'
|
||||
)
|
||||
|
||||
local expl
|
||||
|
|
@ -71,7 +72,7 @@ case "$words[1]" in
|
|||
_brew_installed_formulae
|
||||
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae
|
||||
fi ;;
|
||||
install|home|homepage|log|info|abv|uses|cat|deps|edit|options)
|
||||
install|home|homepage|log|info|abv|uses|cat|deps|edit|options|versions)
|
||||
_brew_all_formulae
|
||||
_wanted formulae expl 'all formulae' compadd -a formulae ;;
|
||||
remove|rm|uninstall|unlink|cleanup|link|ln)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ case $state in
|
|||
"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]" \
|
||||
"clean[Cleans up unused gems in your bundler directory]" \
|
||||
"help[Describe available tasks or one specific task]"
|
||||
ret=0
|
||||
;;
|
||||
|
|
@ -62,6 +63,14 @@ case $state in
|
|||
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
|
||||
;;
|
||||
(open|show)
|
||||
_gems=( $(bundle show 2> /dev/null | sed -e '/^ \*/!d; s/^ \* \([^ ]*\) .*/\1/') )
|
||||
if [[ $_gems != "" ]]; then
|
||||
|
|
|
|||
|
|
@ -2,11 +2,12 @@ alias be="bundle exec"
|
|||
alias bi="bundle install"
|
||||
alias bl="bundle list"
|
||||
alias bp="bundle package"
|
||||
alias bo="bundle open"
|
||||
alias bu="bundle update"
|
||||
|
||||
# The following is based on https://github.com/gma/bundler-exec
|
||||
|
||||
bundled_commands=(annotate cap capify cucumber foreman guard middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails puma)
|
||||
bundled_commands=(annotate cap capify cucumber foreman guard jekyll middleman nanoc rackup rainbows rake rspec ruby shotgun spec spin spork thin thor unicorn unicorn_rails puma)
|
||||
|
||||
## Functions
|
||||
|
||||
|
|
@ -33,6 +34,7 @@ _run-with-bundler() {
|
|||
|
||||
## 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
|
||||
|
||||
|
|
|
|||
13
plugins/bwana/bwana.plugin.zsh
Normal file
13
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
|
||||
|
|
@ -14,12 +14,9 @@ _cake_does_target_list_need_generating () {
|
|||
return 1;
|
||||
fi
|
||||
|
||||
if [ ! -f ${_cake_task_cache_file} ]; then return 0;
|
||||
else
|
||||
accurate=$(stat -f%m $_cake_task_cache_file)
|
||||
changed=$(stat -f%m Cakefile)
|
||||
return $(expr $accurate '>=' $changed)
|
||||
fi
|
||||
[ ! -f ${_cake_task_cache_file} ] && return 0;
|
||||
[ ${_cake_task_cache_file} -nt Cakefile ] && return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
_cake () {
|
||||
|
|
@ -33,4 +30,4 @@ _cake () {
|
|||
fi
|
||||
}
|
||||
|
||||
compdef _cake cake
|
||||
compdef _cake cake
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
stat -f%m . > /dev/null 2>&1
|
||||
if [ "$?" = 0 ]; then
|
||||
stat_cmd=(stat -f%m)
|
||||
else
|
||||
stat_cmd=(stat -L --format=%y)
|
||||
fi
|
||||
|
||||
# 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
|
||||
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
|
||||
}
|
||||
|
||||
function _cap () {
|
||||
if [ -f config/deploy.rb ]; then
|
||||
if _cap_does_task_list_need_generating; then
|
||||
_cap_get_task_list > ${_cap_task_cache_file}
|
||||
fi
|
||||
compadd `cat ${_cap_task_cache_file}`
|
||||
fi
|
||||
}
|
||||
|
||||
compdef _cap cap
|
||||
10
plugins/capistrano/_capistrano
Normal file
10
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 --tasks | grep '#' | cut -d " " -f 2 > .cap_tasks~
|
||||
fi
|
||||
compadd `cat .cap_tasks~`
|
||||
fi
|
||||
71
plugins/coffee/_coffee
Normal file
71
plugins/coffee/_coffee
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
#compdef coffee
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the zsh-users nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for Coffee.js v0.6.11 (http://coffeejs.org)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Mario Fernandez (https://github.com/sirech)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
local curcontext="$curcontext" state line ret=1
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
'(- *)'{-h,--help}'[display this help message]' \
|
||||
'(- *)'{-v,--version}'[display the version number]' \
|
||||
'(-b --bare)'{-b,--bare}'[compile without a top-level function wrapper]' \
|
||||
'(-e --eval)'{-e,--eval}'[pass a string from the command line as input]:Inline Script' \
|
||||
'(-i --interactive)'{-i,--interactive}'[run an interactive CoffeeScript REPL]' \
|
||||
'(-j --join)'{-j,--join}'[concatenate the source CoffeeScript before compiling]:Destination JS file:_files -g "*.js"' \
|
||||
'(-l --lint)'{-l,--lint}'[pipe the compiled JavaScript through JavaScript Lint]' \
|
||||
'(--nodejs)--nodejs[pass options directly to the "node" binary]' \
|
||||
'(-c --compile)'{-c,--compile}'[compile to JavaScript and save as .js files]' \
|
||||
'(-o --output)'{-o,--output}'[set the output directory for compiled JavaScript]:Output Directory:_files -/' \
|
||||
'(-n -t -p)'{-n,--nodes}'[print out the parse tree that the parser produces]' \
|
||||
'(-n -t -p)'{-p,--print}'[print out the compiled JavaScript]' \
|
||||
'(-n -t -p)'{-t,--tokens}'[print out the tokens that the lexer/rewriter produce]' \
|
||||
'(-r --require)'{-r,--require}'[require a library before executing your script]:library' \
|
||||
'(-s --stdio)'{-s,--stdio}'[listen for and compile scripts over stdio]' \
|
||||
'(-w --watch)'{-w,--watch}'[watch scripts for changes and rerun commands]' \
|
||||
'*:script or directory:_files' && ret=0
|
||||
|
||||
return ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: Shell-Script
|
||||
# sh-indentation: 2
|
||||
# indent-tabs-mode: nil
|
||||
# sh-basic-offset: 2
|
||||
# End:
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
11
plugins/colored-man/colored-man.plugin.zsh
Normal file
11
plugins/colored-man/colored-man.plugin.zsh
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
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") \
|
||||
man "$@"
|
||||
}
|
||||
28
plugins/colorize/colorize.plugin.zsh
Normal file
28
plugins/colorize/colorize.plugin.zsh
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# Plugin for highligthing 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!
|
||||
exit -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
|
||||
}
|
||||
|
|
@ -2,4 +2,8 @@
|
|||
# as seen in http://www.porcheron.info/command-not-found-for-zsh/
|
||||
# this is installed in Ubuntu
|
||||
|
||||
source /etc/zsh_command_not_found
|
||||
[[ -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
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ _composer_get_command_list () {
|
|||
_composer () {
|
||||
if [ -f composer.json ]; then
|
||||
compadd `_composer_get_command_list`
|
||||
else
|
||||
compadd create-project init search selfupdate show
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -24,6 +26,7 @@ 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'
|
||||
alias cget='curl -s https://getcomposer.org/installer | php'
|
||||
|
|
|
|||
3
plugins/copydir/copydir.plugin.zsh
Normal file
3
plugins/copydir/copydir.plugin.zsh
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
function copydir {
|
||||
pwd | tr -d "\r\n" | pbcopy
|
||||
}
|
||||
5
plugins/copyfile/copyfile.plugin.zsh
Normal file
5
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
plugins/cp/cp.plugin.zsh
Normal file
14
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 --"
|
||||
|
|
@ -6,14 +6,14 @@
|
|||
|
||||
# Use aptitude if installed, or apt-get if not.
|
||||
# You can just set apt_pref='apt-get' to override it.
|
||||
if [[ -e $( which aptitude ) ]]; then
|
||||
if [[ -e $( which aptitude 2>&1 ) ]]; then
|
||||
apt_pref='aptitude'
|
||||
else
|
||||
apt_pref='apt-get'
|
||||
fi
|
||||
|
||||
# Use sudo by default if it's installed
|
||||
if [[ -e $( which sudo ) ]]; then
|
||||
if [[ -e $( which sudo 2>&1 ) ]]; then
|
||||
use_sudo=1
|
||||
fi
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ fi
|
|||
# These are for more obscure uses of apt-get and aptitude that aren't covered
|
||||
# below.
|
||||
alias ag='apt-get'
|
||||
alias at='aptitude'
|
||||
alias ap='aptitude'
|
||||
|
||||
# Some self-explanatory aliases
|
||||
alias acs="apt-cache search"
|
||||
|
|
@ -35,7 +35,7 @@ alias afs='apt-file search --regexp'
|
|||
|
||||
# These are apt-get only
|
||||
alias asrc='apt-get source'
|
||||
alias ap='apt-cache policy'
|
||||
alias app='apt-cache policy'
|
||||
|
||||
# superuser operations ######################################################
|
||||
if [[ $use_sudo -eq 1 ]]; then
|
||||
|
|
@ -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) \
|
||||
|
|
|
|||
|
|
@ -20,6 +20,19 @@ _managepy-createcachetable(){
|
|||
$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
|
||||
|
|
@ -163,6 +176,7 @@ _managepy-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.'
|
||||
|
|
@ -220,4 +234,5 @@ _managepy() {
|
|||
|
||||
compdef _managepy manage.py
|
||||
compdef _managepy django
|
||||
compdef _managepy django-admin.py
|
||||
compdef _managepy django-manage
|
||||
|
|
|
|||
29
plugins/emoji-clock/emoji-clock.plugin.zsh
Normal file
29
plugins/emoji-clock/emoji-clock.plugin.zsh
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# ------------------------------------------------------------------------------
|
||||
# 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() {
|
||||
hour=$(date '+%I')
|
||||
minutes=$(date '+%M')
|
||||
case $hour in
|
||||
01) clock="🕐"; [ $minutes -ge 30 ] && clock="🕜";;
|
||||
02) clock="🕑"; [ $minutes -ge 30 ] && clock="🕝";;
|
||||
03) clock="🕒"; [ $minutes -ge 30 ] && clock="🕞";;
|
||||
04) clock="🕓"; [ $minutes -ge 30 ] && clock="🕟";;
|
||||
05) clock="🕔"; [ $minutes -ge 30 ] && clock="🕠";;
|
||||
06) clock="🕕"; [ $minutes -ge 30 ] && clock="🕡";;
|
||||
07) clock="🕖"; [ $minutes -ge 30 ] && clock="🕢";;
|
||||
08) clock="🕗"; [ $minutes -ge 30 ] && clock="🕣";;
|
||||
09) clock="🕘"; [ $minutes -ge 30 ] && clock="🕤";;
|
||||
10) clock="🕙"; [ $minutes -ge 30 ] && clock="🕥";;
|
||||
11) clock="🕚"; [ $minutes -ge 30 ] && clock="🕦";;
|
||||
12) clock="🕛"; [ $minutes -ge 30 ] && clock="🕧";;
|
||||
*) clock="⌛";;
|
||||
esac
|
||||
echo $clock
|
||||
}
|
||||
|
|
@ -1,2 +1,4 @@
|
|||
encode64(){ echo -n $1 | base64 }
|
||||
decode64(){ echo -n $1 | base64 -D }
|
||||
decode64(){ echo -n $1 | base64 --decode }
|
||||
alias e64=encode64
|
||||
alias d64=decode64
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ function extract() {
|
|||
(*.lzma) unlzma "$1" ;;
|
||||
(*.Z) uncompress "$1" ;;
|
||||
(*.zip) unzip "$1" -d $extract_dir ;;
|
||||
(*.rar) unrar e -ad "$1" ;;
|
||||
(*.rar) unrar x -ad "$1" ;;
|
||||
(*.7z) 7za x "$1" ;;
|
||||
(*.deb)
|
||||
mkdir -p "$extract_dir/control"
|
||||
|
|
|
|||
60
plugins/fabric/_fab
Normal file
60
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
plugins/fabric/fabric.plugin.zsh
Normal file
1
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.
|
||||
|
|
@ -1,5 +1,10 @@
|
|||
if [ $commands[fasd] ]; then # check if fasd is installed
|
||||
eval "$(fasd --init auto)"
|
||||
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
|
||||
|
|
|
|||
6
plugins/fbterm/fbterm.plugin.zsh
Normal file
6
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
|
||||
44
plugins/forklift/forklift.plugin.zsh
Normal file
44
plugins/forklift/forklift.plugin.zsh
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
# Open folder in ForkLift.app from console
|
||||
# Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
|
||||
#
|
||||
# Usage:
|
||||
# fl [<folder>]
|
||||
#
|
||||
# Opens specified directory or current working directory in ForkLift.app
|
||||
#
|
||||
# Notes:
|
||||
# It assumes Shift+Cmd+G launches go to folder panel and Cmd+N opens new
|
||||
# app window.
|
||||
#
|
||||
# https://gist.github.com/3313481
|
||||
function fl {
|
||||
if [ ! -z "$1" ]; then
|
||||
DIR=$1
|
||||
if [ ! -d "$DIR" ]; then
|
||||
DIR=$(dirname $DIR)
|
||||
fi
|
||||
if [ "$DIR" != "." ]; then
|
||||
PWD=`cd "$DIR";pwd`
|
||||
fi
|
||||
fi
|
||||
osascript 2>&1 1>/dev/null <<END
|
||||
tell application "ForkLift"
|
||||
activate
|
||||
end tell
|
||||
tell application "System Events"
|
||||
tell application process "ForkLift"
|
||||
try
|
||||
set topWindow to window 1
|
||||
on error
|
||||
keystroke "n" using command down
|
||||
set topWindow to window 1
|
||||
end try
|
||||
keystroke "g" using {command down, shift down}
|
||||
tell sheet 1 of topWindow
|
||||
set value of text field 1 to "$PWD"
|
||||
keystroke return
|
||||
end tell
|
||||
end tell
|
||||
end tell
|
||||
END
|
||||
}
|
||||
285
plugins/git-extras/git-extras.plugin.zsh
Normal file
285
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' \
|
||||
416
plugins/git-flow-avh/git-flow-avh.plugin.zsh
Normal file
416
plugins/git-flow-avh/git-flow-avh.plugin.zsh
Normal file
|
|
@ -0,0 +1,416 @@
|
|||
#!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.'
|
||||
)
|
||||
_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.'
|
||||
'delet: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'
|
||||
|
|
@ -88,6 +88,8 @@ __git-flow-release ()
|
|||
'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 \
|
||||
|
|
@ -115,6 +117,16 @@ __git-flow-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]'
|
||||
|
|
@ -195,7 +207,7 @@ __git-flow-feature ()
|
|||
'start:Start a new feature branch.'
|
||||
'finish:Finish a feature branch.'
|
||||
'list:List all your feature branches. (Alias to `git flow feature`)'
|
||||
'publish: public'
|
||||
'publish: publish'
|
||||
'track: track'
|
||||
'diff: diff'
|
||||
'rebase: rebase'
|
||||
|
|
@ -221,6 +233,7 @@ __git-flow-feature ()
|
|||
_arguments \
|
||||
-F'[Fetch from origin before performing finish]' \
|
||||
-r'[Rebase instead of merge]'\
|
||||
-k'[Keep branch after performing finish]'\
|
||||
':feature:__git_flow_feature_list'
|
||||
;;
|
||||
|
||||
|
|
@ -236,13 +249,13 @@ __git-flow-feature ()
|
|||
|
||||
(diff)
|
||||
_arguments \
|
||||
':branch:__git_branch_names'\
|
||||
':branch:__git_flow_feature_list'\
|
||||
;;
|
||||
|
||||
(rebase)
|
||||
_arguments \
|
||||
-i'[Do an interactive rebase]' \
|
||||
':branch:__git_branch_names'
|
||||
':branch:__git_flow_feature_list'
|
||||
;;
|
||||
|
||||
(checkout)
|
||||
|
|
@ -253,7 +266,7 @@ __git-flow-feature ()
|
|||
(pull)
|
||||
_arguments \
|
||||
':remote:__git_remotes'\
|
||||
':branch:__git_branch_names'
|
||||
':branch:__git_flow_feature_list'
|
||||
;;
|
||||
|
||||
*)
|
||||
|
|
@ -333,4 +346,4 @@ __git_command_successful () {
|
|||
return 0
|
||||
}
|
||||
|
||||
zstyle ':completion:*:*:git:*' user-commands flow:'description for foo'
|
||||
zstyle ':completion:*:*:git:*' user-commands flow:'description for foo'
|
||||
|
|
|
|||
348
plugins/git-hubflow/git-hubflow.plugin.zsh
Normal file
348
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'
|
||||
19
plugins/git-remote-branch/git-remote-branch.plugin.zsh
Normal file
19
plugins/git-remote-branch/git-remote-branch.plugin.zsh
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
_git_remote_branch() {
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null)
|
||||
if [[ -n $ref ]]; then
|
||||
if (( CURRENT == 2 )); then
|
||||
# first arg: operation
|
||||
compadd create publish rename delete track
|
||||
elif (( CURRENT == 3 )); then
|
||||
# second arg: remote branch name
|
||||
remotes=`git remote | tr '\n' '|' | sed "s/\|$//g"`
|
||||
compadd `git branch -r | grep -v HEAD | sed "s/$remotes\///" | sed "s/ //g"`
|
||||
elif (( CURRENT == 4 )); then
|
||||
# third arg: remote name
|
||||
compadd `git remote`
|
||||
fi
|
||||
else;
|
||||
_files
|
||||
fi
|
||||
}
|
||||
compdef _git_remote_branch grb
|
||||
|
|
@ -3,33 +3,57 @@ alias g='git'
|
|||
compdef g=git
|
||||
alias gst='git status'
|
||||
compdef _git gst=git-status
|
||||
alias gd='git diff'
|
||||
compdef _git gd=git-diff
|
||||
alias gl='git pull'
|
||||
compdef _git gl=git-pull
|
||||
alias gup='git fetch && git rebase'
|
||||
alias gup='git pull --rebase'
|
||||
compdef _git gup=git-fetch
|
||||
alias gp='git push'
|
||||
compdef _git gp=git-push
|
||||
alias gd='git diff'
|
||||
gdv() { git diff -w "$@" | view - }
|
||||
compdef _git gdv=git-diff
|
||||
alias gc='git commit -v'
|
||||
compdef _git gc=git-commit
|
||||
alias gc!='git commit -v --amend'
|
||||
compdef _git gc!=git-commit
|
||||
alias gca='git commit -v -a'
|
||||
compdef _git gca=git-commit
|
||||
compdef _git gc=git-commit
|
||||
alias gca!='git commit -v -a --amend'
|
||||
compdef _git gca!=git-commit
|
||||
alias gco='git checkout'
|
||||
compdef _git gco=git-checkout
|
||||
alias gcm='git checkout master'
|
||||
alias gr='git remote'
|
||||
compdef _git gr=git-remote
|
||||
alias grv='git remote -v'
|
||||
compdef _git grv=git-remote
|
||||
alias grmv='git remote rename'
|
||||
compdef _git grmv=git-remote
|
||||
alias grrm='git remote remove'
|
||||
compdef _git grrm=git-remote
|
||||
alias grset='git remote set-url'
|
||||
compdef _git grset=git-remote
|
||||
alias grup='git remote update'
|
||||
compdef _git grset=git-remote
|
||||
alias gb='git branch'
|
||||
compdef _git gb=git-branch
|
||||
alias gba='git branch -a'
|
||||
compdef _git gba=git-branch
|
||||
alias gcount='git shortlog -sn'
|
||||
compdef gcount=git
|
||||
alias gcl='git config --list'
|
||||
alias gcp='git cherry-pick'
|
||||
compdef _git gcp=git-cherry-pick
|
||||
alias glg='git log --stat --max-count=5'
|
||||
compdef _git glg=git-log
|
||||
alias glgg='git log --graph --max-count=5'
|
||||
compdef _git glgg=git-log
|
||||
alias glgga='git log --graph --decorate --all'
|
||||
compdef _git glgga=git-log
|
||||
alias glo='git log --oneline'
|
||||
compdef _git glo=git-log
|
||||
alias gss='git status -s'
|
||||
compdef _git gss=git-status
|
||||
alias ga='git add'
|
||||
|
|
@ -38,6 +62,13 @@ alias gm='git merge'
|
|||
compdef _git gm=git-merge
|
||||
alias grh='git reset HEAD'
|
||||
alias grhh='git reset HEAD --hard'
|
||||
alias gwc='git whatchanged -p --abbrev-commit --pretty=medium'
|
||||
alias gf='git ls-files | grep'
|
||||
alias gpoat='git push origin --all && git push origin --tags'
|
||||
|
||||
# Will cd into the top of the current repository
|
||||
# or submodule.
|
||||
alias grt='cd $(git rev-parse --show-toplevel || echo ".")'
|
||||
|
||||
# Git and svn mix
|
||||
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
|
||||
|
|
@ -50,13 +81,14 @@ alias gsd='git svn dcommit'
|
|||
# Usage example: git pull origin $(current_branch)
|
||||
#
|
||||
function current_branch() {
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
|
||||
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
|
||||
echo ${ref#refs/heads/}
|
||||
}
|
||||
|
||||
function current_repository() {
|
||||
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
|
||||
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
|
||||
echo $(git remote -v | cut -d':' -f 2)
|
||||
}
|
||||
|
||||
|
|
@ -67,3 +99,12 @@ alias ggpush='git push origin $(current_branch)'
|
|||
compdef ggpush=git
|
||||
alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)'
|
||||
compdef ggpnp=git
|
||||
|
||||
# Pretty log messages
|
||||
function _git_log_prettily(){
|
||||
if ! [ -z $1 ]; then
|
||||
git log --pretty=$1
|
||||
fi
|
||||
}
|
||||
alias glp="_git_log_prettily"
|
||||
compdef _git glp=git-log
|
||||
|
|
|
|||
87
plugins/gitfast/_git
Normal file
87
plugins/gitfast/_git
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
#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
|
||||
}
|
||||
|
||||
__gitcomp_file ()
|
||||
{
|
||||
emulate -L zsh
|
||||
|
||||
local IFS=$'\n'
|
||||
compset -P '*[=:]'
|
||||
compadd -Q -p "${2-}" -f -- ${=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
|
||||
2766
plugins/gitfast/git-completion.bash
Normal file
2766
plugins/gitfast/git-completion.bash
Normal file
File diff suppressed because it is too large
Load diff
399
plugins/gitfast/git-prompt.sh
Normal file
399
plugins/gitfast/git-prompt.sh
Normal file
|
|
@ -0,0 +1,399 @@
|
|||
# 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
|
||||
# 3a) Change your PS1 to call __git_ps1 as
|
||||
# command-substitution:
|
||||
# Bash: PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
|
||||
# ZSH: PS1='[%n@%m %c$(__git_ps1 " (%s)")]\$ '
|
||||
# the optional argument will be used as format string.
|
||||
# 3b) Alternatively, if you are using bash, __git_ps1 can be
|
||||
# used for PROMPT_COMMAND with two parameters, <pre> and
|
||||
# <post>, which are strings you would put in $PS1 before
|
||||
# and after the status string generated by the git-prompt
|
||||
# machinery. e.g.
|
||||
# PROMPT_COMMAND='__git_ps1 "\u@\h:\w" "\\\$ "'
|
||||
# will show username, at-sign, host, colon, cwd, then
|
||||
# various status string, followed by dollar and SP, as
|
||||
# your prompt.
|
||||
# Optionally, you can supply a third argument with a printf
|
||||
# format string to finetune the output of the branch status
|
||||
#
|
||||
# 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. You can
|
||||
# configure this per-repository with the bash.showUntrackedFiles
|
||||
# variable, which defaults to true once GIT_PS1_SHOWUNTRACKEDFILES is
|
||||
# enabled.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# If you would like to see more information about the identity of
|
||||
# commits checked out as a detached HEAD, set GIT_PS1_DESCRIBE_STYLE
|
||||
# to one of these values:
|
||||
#
|
||||
# contains relative to newer annotated tag (v1.6.3.2~35)
|
||||
# branch relative to newer tag or branch (master~4)
|
||||
# describe relative to older annotated tag (v1.6.3.1-13-gdd42c2f)
|
||||
# default exactly matching tag
|
||||
#
|
||||
# If you would like a colored hint about the current dirty state, set
|
||||
# GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on
|
||||
# the colored output of "git status -sb".
|
||||
|
||||
# __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)
|
||||
# when called from PS1 using command substitution
|
||||
# in this mode it prints text to add to bash PS1 prompt (includes branch name)
|
||||
#
|
||||
# __git_ps1 requires 2 or 3 arguments when called from PROMPT_COMMAND (pc)
|
||||
# in that case it _sets_ PS1. The arguments are parts of a PS1 string.
|
||||
# when two arguments are given, the first is prepended and the second appended
|
||||
# to the state string when assigned to PS1.
|
||||
# The optional third parameter will be used as printf format string to further
|
||||
# customize the output of the git-status string.
|
||||
# In this mode you can request colored hints using GIT_PS1_SHOWCOLORHINTS=true
|
||||
__git_ps1 ()
|
||||
{
|
||||
local pcmode=no
|
||||
local detached=no
|
||||
local ps1pc_start='\u@\h:\w '
|
||||
local ps1pc_end='\$ '
|
||||
local printf_format=' (%s)'
|
||||
|
||||
case "$#" in
|
||||
2|3) pcmode=yes
|
||||
ps1pc_start="$1"
|
||||
ps1pc_end="$2"
|
||||
printf_format="${3:-$printf_format}"
|
||||
;;
|
||||
0|1) printf_format="${1:-$printf_format}"
|
||||
;;
|
||||
*) return
|
||||
;;
|
||||
esac
|
||||
|
||||
local g="$(__gitdir)"
|
||||
if [ -z "$g" ]; then
|
||||
if [ $pcmode = yes ]; then
|
||||
#In PC mode PS1 always needs to be set
|
||||
PS1="$ps1pc_start$ps1pc_end"
|
||||
fi
|
||||
else
|
||||
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)" || {
|
||||
detached=yes
|
||||
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-}" ] &&
|
||||
[ "$(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
|
||||
if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ]; then
|
||||
git rev-parse --verify refs/stash >/dev/null 2>&1 && s="$"
|
||||
fi
|
||||
|
||||
if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] &&
|
||||
[ "$(git config --bool bash.showUntrackedFiles)" != "false" ] &&
|
||||
[ -n "$(git ls-files --others --exclude-standard)" ]
|
||||
then
|
||||
u="%%"
|
||||
fi
|
||||
|
||||
if [ -n "${GIT_PS1_SHOWUPSTREAM-}" ]; then
|
||||
__git_ps1_show_upstream
|
||||
fi
|
||||
fi
|
||||
|
||||
local f="$w$i$s$u"
|
||||
if [ $pcmode = yes ]; then
|
||||
local gitstring=
|
||||
if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
|
||||
local c_red='\e[31m'
|
||||
local c_green='\e[32m'
|
||||
local c_lblue='\e[1;34m'
|
||||
local c_clear='\e[0m'
|
||||
local bad_color=$c_red
|
||||
local ok_color=$c_green
|
||||
local branch_color="$c_clear"
|
||||
local flags_color="$c_lblue"
|
||||
local branchstring="$c${b##refs/heads/}"
|
||||
|
||||
if [ $detached = no ]; then
|
||||
branch_color="$ok_color"
|
||||
else
|
||||
branch_color="$bad_color"
|
||||
fi
|
||||
|
||||
# Setting gitstring directly with \[ and \] around colors
|
||||
# is necessary to prevent wrapping issues!
|
||||
gitstring="\[$branch_color\]$branchstring\[$c_clear\]"
|
||||
|
||||
if [ -n "$w$i$s$u$r$p" ]; then
|
||||
gitstring="$gitstring "
|
||||
fi
|
||||
if [ "$w" = "*" ]; then
|
||||
gitstring="$gitstring\[$bad_color\]$w"
|
||||
fi
|
||||
if [ -n "$i" ]; then
|
||||
gitstring="$gitstring\[$ok_color\]$i"
|
||||
fi
|
||||
if [ -n "$s" ]; then
|
||||
gitstring="$gitstring\[$flags_color\]$s"
|
||||
fi
|
||||
if [ -n "$u" ]; then
|
||||
gitstring="$gitstring\[$bad_color\]$u"
|
||||
fi
|
||||
gitstring="$gitstring\[$c_clear\]$r$p"
|
||||
else
|
||||
gitstring="$c${b##refs/heads/}${f:+ $f}$r$p"
|
||||
fi
|
||||
gitstring=$(printf -- "$printf_format" "$gitstring")
|
||||
PS1="$ps1pc_start$gitstring$ps1pc_end"
|
||||
else
|
||||
# NO color option unless in PROMPT_COMMAND mode
|
||||
printf -- "$printf_format" "$c${b##refs/heads/}${f:+ $f}$r$p"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
8
plugins/gitfast/gitfast.plugin.zsh
Normal file
8
plugins/gitfast/gitfast.plugin.zsh
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
dir=$(dirname $0)
|
||||
source $dir/../git/git.plugin.zsh
|
||||
source $dir/git-prompt.sh
|
||||
|
||||
function git_prompt_info() {
|
||||
dirty="$(parse_git_dirty)"
|
||||
__git_ps1 "${ZSH_THEME_GIT_PROMPT_PREFIX//\%/%%}%s${dirty//\%/%%}${ZSH_THEME_GIT_PROMPT_SUFFIX//\%/%%}"
|
||||
}
|
||||
|
|
@ -1,5 +1,22 @@
|
|||
# Setup hub function for git, if it is available; http://github.com/defunkt/hub
|
||||
if [ "$commands[(I)hub]" ] && [ "$commands[(I)ruby]" ]; then
|
||||
# Autoload _git completion functions
|
||||
if declare -f _git > /dev/null; then
|
||||
_git
|
||||
fi
|
||||
|
||||
if declare -f _git_commands > /dev/null; then
|
||||
_hub_commands=(
|
||||
'alias:show shell instructions for wrapping git'
|
||||
'pull-request:open a pull request on GitHub'
|
||||
'fork:fork origin repo on GitHub'
|
||||
'create:create new repo on GitHub for the current project'
|
||||
'browse:browse the project on GitHub'
|
||||
'compare:open GitHub compare view'
|
||||
)
|
||||
# Extend the '_git_commands' function with hub commands
|
||||
eval "$(declare -f _git_commands | sed -e 's/base_commands=(/base_commands=(${_hub_commands} /')"
|
||||
fi
|
||||
# eval `hub alias -s zsh`
|
||||
function git(){
|
||||
if ! (( $+_has_working_hub )); then
|
||||
|
|
@ -61,6 +78,7 @@ exist_gh() { # [DIRECTORY]
|
|||
cd "$1"
|
||||
name=$( git config user.name )
|
||||
ghuser=$( git config github.user )
|
||||
repo=$1
|
||||
|
||||
git remote add origin git@github.com:${ghuser}/${repo}.git
|
||||
git push -u origin master
|
||||
|
|
|
|||
151
plugins/go/go.plugin.zsh
Normal file
151
plugins/go/go.plugin.zsh
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
# install in /etc/zsh/zshrc or your personal .zshrc
|
||||
|
||||
# gc
|
||||
prefixes=(5 6 8)
|
||||
for p in $prefixes; do
|
||||
compctl -g "*.${p}" ${p}l
|
||||
compctl -g "*.go" ${p}g
|
||||
done
|
||||
|
||||
# standard go tools
|
||||
compctl -g "*.go" gofmt
|
||||
|
||||
# gccgo
|
||||
compctl -g "*.go" gccgo
|
||||
|
||||
# go tool
|
||||
__go_tool_complete() {
|
||||
typeset -a commands build_flags
|
||||
commands+=(
|
||||
'build[compile packages and dependencies]'
|
||||
'clean[remove object files]'
|
||||
'doc[run godoc on package sources]'
|
||||
'fix[run go tool fix on packages]'
|
||||
'fmt[run gofmt on package sources]'
|
||||
'get[download and install packages and dependencies]'
|
||||
'help[display help]'
|
||||
'install[compile and install packages and dependencies]'
|
||||
'list[list packages]'
|
||||
'run[compile and run Go program]'
|
||||
'test[test packages]'
|
||||
'tool[run specified go tool]'
|
||||
'version[print Go version]'
|
||||
'vet[run go tool vet on packages]'
|
||||
)
|
||||
if (( CURRENT == 2 )); then
|
||||
# explain go commands
|
||||
_values 'go tool commands' ${commands[@]}
|
||||
return
|
||||
fi
|
||||
build_flags=(
|
||||
'-a[force reinstallation of packages that are already up-to-date]'
|
||||
'-n[print the commands but do not run them]'
|
||||
"-p[number of parallel builds]:number"
|
||||
'-x[print the commands]'
|
||||
"-work[print temporary directory name and keep it]"
|
||||
"-gcflags[flags for 5g/6g/8g]:flags"
|
||||
"-ldflags[flags for 5l/6l/8l]:flags"
|
||||
"-gccgoflags[flags for gccgo]:flags"
|
||||
)
|
||||
__go_list() {
|
||||
local expl importpaths
|
||||
declare -a importpaths
|
||||
importpaths=($(go list ${words[$CURRENT]}... 2>/dev/null))
|
||||
_wanted importpaths expl 'import paths' compadd "$@" - "${importpaths[@]}"
|
||||
}
|
||||
case ${words[2]} in
|
||||
clean|doc)
|
||||
_arguments -s -w : '*:importpaths:__go_list'
|
||||
;;
|
||||
fix|fmt|list|vet)
|
||||
_alternative ':importpaths:__go_list' ':files:_path_files -g "*.go"'
|
||||
;;
|
||||
install)
|
||||
_arguments -s -w : ${build_flags[@]} \
|
||||
"-v[show package names]" \
|
||||
'*:importpaths:__go_list'
|
||||
;;
|
||||
get)
|
||||
_arguments -s -w : \
|
||||
${build_flags[@]}
|
||||
;;
|
||||
build)
|
||||
_arguments -s -w : \
|
||||
${build_flags[@]} \
|
||||
"-v[show package names]" \
|
||||
"-o[output file]:file:_files" \
|
||||
"*:args:{ _alternative ':importpaths:__go_list' ':files:_path_files -g \"*.go\"' }"
|
||||
;;
|
||||
test)
|
||||
_arguments -s -w : \
|
||||
${build_flags[@]} \
|
||||
"-c[do not run, compile the test binary]" \
|
||||
"-i[do not run, install dependencies]" \
|
||||
"-v[print test output]" \
|
||||
"-x[print the commands]" \
|
||||
"-short[use short mode]" \
|
||||
"-parallel[number of parallel tests]:number" \
|
||||
"-cpu[values of GOMAXPROCS to use]:number list" \
|
||||
"-run[run tests and examples matching regexp]:regexp" \
|
||||
"-bench[run benchmarks matching regexp]:regexp" \
|
||||
"-benchtime[run each benchmark during n seconds]:duration" \
|
||||
"-timeout[kill test after that duration]:duration" \
|
||||
"-cpuprofile[write CPU profile to file]:file:_files" \
|
||||
"-memprofile[write heap profile to file]:file:_files" \
|
||||
"-memprofilerate[set heap profiling rate]:number" \
|
||||
"*:args:{ _alternative ':importpaths:__go_list' ':files:_path_files -g \"*.go\"' }"
|
||||
;;
|
||||
help)
|
||||
_values "${commands[@]}" \
|
||||
'gopath[GOPATH environment variable]' \
|
||||
'importpath[description of import paths]' \
|
||||
'remote[remote import path syntax]' \
|
||||
'testflag[description of testing flags]' \
|
||||
'testfunc[description of testing functions]'
|
||||
;;
|
||||
run)
|
||||
_arguments -s -w : \
|
||||
${build_flags[@]} \
|
||||
'*:file:_path_files -g "*.go"'
|
||||
;;
|
||||
tool)
|
||||
if (( CURRENT == 3 )); then
|
||||
_values "go tool" $(go tool)
|
||||
return
|
||||
fi
|
||||
case ${words[3]} in
|
||||
[568]g)
|
||||
_arguments -s -w : \
|
||||
'-I[search for packages in DIR]:includes:_path_files -/' \
|
||||
'-L[show full path in file:line prints]' \
|
||||
'-S[print the assembly language]' \
|
||||
'-V[print the compiler version]' \
|
||||
'-e[no limit on number of errors printed]' \
|
||||
'-h[panic on an error]' \
|
||||
'-l[disable inlining]' \
|
||||
'-m[print optimization decisions]' \
|
||||
'-o[file specify output file]:file' \
|
||||
'-p[assumed import path for this code]:importpath' \
|
||||
'-u[disable package unsafe]' \
|
||||
"*:file:_files -g '*.go'"
|
||||
;;
|
||||
[568]l)
|
||||
local O=${words[3]%l}
|
||||
_arguments -s -w : \
|
||||
'-o[file specify output file]:file' \
|
||||
'-L[search for packages in DIR]:includes:_path_files -/' \
|
||||
"*:file:_files -g '*.[ao$O]'"
|
||||
;;
|
||||
dist)
|
||||
_values "dist tool" banner bootstrap clean env install version
|
||||
;;
|
||||
*)
|
||||
# use files by default
|
||||
_files
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
compdef __go_tool_complete go
|
||||
150
plugins/golang/golang.plugin.zsh
Normal file
150
plugins/golang/golang.plugin.zsh
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
# From : http://golang.org/misc/zsh/go?m=text
|
||||
# gc
|
||||
prefixes=(5 6 8)
|
||||
for p in $prefixes; do
|
||||
compctl -g "*.${p}" ${p}l
|
||||
compctl -g "*.go" ${p}g
|
||||
done
|
||||
|
||||
# standard go tools
|
||||
compctl -g "*.go" gofmt
|
||||
|
||||
# gccgo
|
||||
compctl -g "*.go" gccgo
|
||||
|
||||
# go tool
|
||||
__go_tool_complete() {
|
||||
typeset -a commands build_flags
|
||||
commands+=(
|
||||
'build[compile packages and dependencies]'
|
||||
'clean[remove object files]'
|
||||
'doc[run godoc on package sources]'
|
||||
'fix[run go tool fix on packages]'
|
||||
'fmt[run gofmt on package sources]'
|
||||
'get[download and install packages and dependencies]'
|
||||
'help[display help]'
|
||||
'install[compile and install packages and dependencies]'
|
||||
'list[list packages]'
|
||||
'run[compile and run Go program]'
|
||||
'test[test packages]'
|
||||
'tool[run specified go tool]'
|
||||
'version[print Go version]'
|
||||
'vet[run go tool vet on packages]'
|
||||
)
|
||||
if (( CURRENT == 2 )); then
|
||||
# explain go commands
|
||||
_values 'go tool commands' ${commands[@]}
|
||||
return
|
||||
fi
|
||||
build_flags=(
|
||||
'-a[force reinstallation of packages that are already up-to-date]'
|
||||
'-n[print the commands but do not run them]'
|
||||
"-p[number of parallel builds]:number"
|
||||
'-x[print the commands]'
|
||||
"-work[print temporary directory name and keep it]"
|
||||
"-gcflags[flags for 5g/6g/8g]:flags"
|
||||
"-ldflags[flags for 5l/6l/8l]:flags"
|
||||
"-gccgoflags[flags for gccgo]:flags"
|
||||
)
|
||||
__go_list() {
|
||||
local expl importpaths
|
||||
declare -a importpaths
|
||||
importpaths=($(go list ${words[$CURRENT]}... 2>/dev/null))
|
||||
_wanted importpaths expl 'import paths' compadd "$@" - "${importpaths[@]}"
|
||||
}
|
||||
case ${words[2]} in
|
||||
clean|doc)
|
||||
_arguments -s -w : '*:importpaths:__go_list'
|
||||
;;
|
||||
fix|fmt|list|vet)
|
||||
_alternative ':importpaths:__go_list' ':files:_path_files -g "*.go"'
|
||||
;;
|
||||
install)
|
||||
_arguments -s -w : ${build_flags[@]} \
|
||||
"-v[show package names]" \
|
||||
'*:importpaths:__go_list'
|
||||
;;
|
||||
get)
|
||||
_arguments -s -w : \
|
||||
${build_flags[@]}
|
||||
;;
|
||||
build)
|
||||
_arguments -s -w : \
|
||||
${build_flags[@]} \
|
||||
"-v[show package names]" \
|
||||
"-o[output file]:file:_files" \
|
||||
"*:args:{ _alternative ':importpaths:__go_list' ':files:_path_files -g \"*.go\"' }"
|
||||
;;
|
||||
test)
|
||||
_arguments -s -w : \
|
||||
${build_flags[@]} \
|
||||
"-c[do not run, compile the test binary]" \
|
||||
"-i[do not run, install dependencies]" \
|
||||
"-v[print test output]" \
|
||||
"-x[print the commands]" \
|
||||
"-short[use short mode]" \
|
||||
"-parallel[number of parallel tests]:number" \
|
||||
"-cpu[values of GOMAXPROCS to use]:number list" \
|
||||
"-run[run tests and examples matching regexp]:regexp" \
|
||||
"-bench[run benchmarks matching regexp]:regexp" \
|
||||
"-benchtime[run each benchmark during n seconds]:duration" \
|
||||
"-timeout[kill test after that duration]:duration" \
|
||||
"-cpuprofile[write CPU profile to file]:file:_files" \
|
||||
"-memprofile[write heap profile to file]:file:_files" \
|
||||
"-memprofilerate[set heap profiling rate]:number" \
|
||||
"*:args:{ _alternative ':importpaths:__go_list' ':files:_path_files -g \"*.go\"' }"
|
||||
;;
|
||||
help)
|
||||
_values "${commands[@]}" \
|
||||
'gopath[GOPATH environment variable]' \
|
||||
'importpath[description of import paths]' \
|
||||
'remote[remote import path syntax]' \
|
||||
'testflag[description of testing flags]' \
|
||||
'testfunc[description of testing functions]'
|
||||
;;
|
||||
run)
|
||||
_arguments -s -w : \
|
||||
${build_flags[@]} \
|
||||
'*:file:_path_files -g "*.go"'
|
||||
;;
|
||||
tool)
|
||||
if (( CURRENT == 3 )); then
|
||||
_values "go tool" $(go tool)
|
||||
return
|
||||
fi
|
||||
case ${words[3]} in
|
||||
[568]g)
|
||||
_arguments -s -w : \
|
||||
'-I[search for packages in DIR]:includes:_path_files -/' \
|
||||
'-L[show full path in file:line prints]' \
|
||||
'-S[print the assembly language]' \
|
||||
'-V[print the compiler version]' \
|
||||
'-e[no limit on number of errors printed]' \
|
||||
'-h[panic on an error]' \
|
||||
'-l[disable inlining]' \
|
||||
'-m[print optimization decisions]' \
|
||||
'-o[file specify output file]:file' \
|
||||
'-p[assumed import path for this code]:importpath' \
|
||||
'-u[disable package unsafe]' \
|
||||
"*:file:_files -g '*.go'"
|
||||
;;
|
||||
[568]l)
|
||||
local O=${words[3]%l}
|
||||
_arguments -s -w : \
|
||||
'-o[file specify output file]:file' \
|
||||
'-L[search for packages in DIR]:includes:_path_files -/' \
|
||||
"*:file:_files -g '*.[ao$O]'"
|
||||
;;
|
||||
dist)
|
||||
_values "dist tool" banner bootstrap clean env install version
|
||||
;;
|
||||
*)
|
||||
# use files by default
|
||||
_files
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
compdef __go_tool_complete go
|
||||
|
|
@ -1,26 +1,30 @@
|
|||
# Based on ssh-agent code
|
||||
|
||||
local GPG_ENV=$HOME/.gnupg/gpg-agent.env
|
||||
|
||||
function start_agent {
|
||||
/usr/bin/env gpg-agent --daemon --enable-ssh-support --write-env-file ${GPG_ENV} > /dev/null
|
||||
chmod 600 ${GPG_ENV}
|
||||
. ${GPG_ENV} > /dev/null
|
||||
function start_agent_nossh {
|
||||
eval $(/usr/bin/env gpg-agent --quiet --daemon --write-env-file ${GPG_ENV} 2> /dev/null)
|
||||
chmod 600 ${GPG_ENV}
|
||||
export GPG_AGENT_INFO
|
||||
}
|
||||
|
||||
# Source GPG agent settings, if applicable
|
||||
function start_agent_withssh {
|
||||
eval $(/usr/bin/env gpg-agent --quiet --daemon --enable-ssh-support --write-env-file ${GPG_ENV} 2> /dev/null)
|
||||
chmod 600 ${GPG_ENV}
|
||||
export GPG_AGENT_INFO
|
||||
export SSH_AUTH_SOCK
|
||||
export SSH_AGENT_PID
|
||||
}
|
||||
|
||||
# source settings of old agent, if applicable
|
||||
if [ -f "${GPG_ENV}" ]; then
|
||||
. ${GPG_ENV} > /dev/null
|
||||
ps -ef | grep ${SSH_AGENT_PID} | grep gpg-agent > /dev/null || {
|
||||
start_agent;
|
||||
}
|
||||
else
|
||||
start_agent;
|
||||
fi
|
||||
|
||||
export GPG_AGENT_INFO
|
||||
export SSH_AUTH_SOCK
|
||||
export SSH_AGENT_PID
|
||||
# check for existing ssh-agent
|
||||
if ssh-add -l > /dev/null 2> /dev/null; then
|
||||
start_agent_nossh;
|
||||
else
|
||||
start_agent_withssh;
|
||||
fi
|
||||
|
||||
GPG_TTY=$(tty)
|
||||
export GPG_TTY
|
||||
|
|
|
|||
|
|
@ -54,27 +54,14 @@ function in_gradle() {
|
|||
fi
|
||||
}
|
||||
|
||||
############################################################################
|
||||
# Define the stat_cmd command based on platform behavior
|
||||
##########################################################################
|
||||
stat -f%m . > /dev/null 2>&1
|
||||
if [ "$?" = 0 ]; then
|
||||
stat_cmd=(stat -f%m)
|
||||
else
|
||||
stat_cmd=(stat -L --format=%Y)
|
||||
fi
|
||||
|
||||
############################################################################## Examine the build.gradle file to see if its
|
||||
# timestamp has changed, and if so, regen
|
||||
# the .gradle_tasks cache file
|
||||
############################################################################
|
||||
_gradle_does_task_list_need_generating () {
|
||||
if [ ! -f .gradletasknamecache ]; then return 0;
|
||||
else
|
||||
accurate=$($stat_cmd .gradletasknamecache)
|
||||
changed=$($stat_cmd build.gradle)
|
||||
return $(expr $accurate '>=' $changed)
|
||||
fi
|
||||
[ ! -f .gradletasknamecache ] && return 0;
|
||||
[ .gradletasknamecache -nt build.gradle ] && return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,17 +24,23 @@ _enumerateGrailsScripts() {
|
|||
return
|
||||
fi
|
||||
|
||||
# - Strip the path
|
||||
# - Remove all scripts with a leading '_'
|
||||
# - PackagePlugin_.groovy -> PackagePlugin
|
||||
# - PackagePlugin -> Package-Plugin
|
||||
# - Package-Plugin -> package-plugin
|
||||
basename $files \
|
||||
| sed -E -e 's/^_?([^_]+)_?.groovy/\1/'\
|
||||
-e 's/([a-z])([A-Z])/\1-\2/g' \
|
||||
| tr "[:upper:]" "[:lower:]" \
|
||||
| sort \
|
||||
| uniq
|
||||
scripts=()
|
||||
for file in $files
|
||||
do
|
||||
# - Strip the path
|
||||
# - Remove all scripts with a leading '_'
|
||||
# - PackagePlugin_.groovy -> PackagePlugin
|
||||
# - PackagePlugin -> Package-Plugin
|
||||
# - Package-Plugin -> package-plugin
|
||||
command=$(basename $file \
|
||||
| sed -E -e 's/^_?([^_]+)_?.groovy/\1/'\
|
||||
-e 's/([a-z])([A-Z])/\1-\2/g' \
|
||||
| tr "[:upper:]" "[:lower:]" \
|
||||
| sort \
|
||||
| uniq)
|
||||
scripts+=($command)
|
||||
done
|
||||
echo $scripts
|
||||
}
|
||||
|
||||
_grails() {
|
||||
|
|
|
|||
|
|
@ -154,5 +154,6 @@ case "$words[1]" in
|
|||
_arguments \
|
||||
$_command_args \
|
||||
'(--app)--app[the app name]' \
|
||||
'(--remote)--remote[the remote name]' \
|
||||
&& return 0
|
||||
|
||||
|
|
|
|||
8
plugins/history/history.plugin.zsh
Normal file
8
plugins/history/history.plugin.zsh
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
alias h='history'
|
||||
|
||||
function hs
|
||||
{
|
||||
history | grep $*
|
||||
}
|
||||
|
||||
alias hsi='hs -i'
|
||||
|
|
@ -1,20 +1,43 @@
|
|||
# To use: add a .jira-url file in the base of your project
|
||||
# You can also set JIRA_URL in your .zshrc or put .jira-url in your home directory
|
||||
# .jira-url in the current directory takes precedence
|
||||
#
|
||||
# If you use Rapid Board, set:
|
||||
#JIRA_RAPID_BOARD="yes"
|
||||
# in you .zshrc
|
||||
#
|
||||
# Setup: cd to/my/project
|
||||
# echo "https://name.jira.com" >> .jira-url
|
||||
# Usage: jira # opens a new issue
|
||||
# jira ABC-123 # Opens an existing issue
|
||||
open_jira_issue () {
|
||||
if [ ! -f .jira-url ]; then
|
||||
echo "There is no .jira-url file in the current directory..."
|
||||
return 0;
|
||||
local open_cmd
|
||||
if [[ $(uname -s) == 'Darwin' ]]; then
|
||||
open_cmd='open'
|
||||
else
|
||||
jira_url=$(cat .jira-url);
|
||||
if [ -z "$1" ]; then
|
||||
echo "Opening new issue";
|
||||
`open $jira_url/secure/CreateIssue!default.jspa`;
|
||||
open_cmd='xdg-open'
|
||||
fi
|
||||
|
||||
if [ -f .jira-url ]; then
|
||||
jira_url=$(cat .jira-url)
|
||||
elif [ -f ~/.jira-url ]; then
|
||||
jira_url=$(cat ~/.jira-url)
|
||||
elif [[ "x$JIRA_URL" != "x" ]]; then
|
||||
jira_url=$JIRA_URL
|
||||
else
|
||||
echo "JIRA url is not specified anywhere."
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Opening new issue"
|
||||
`open $jira_url/secure/CreateIssue!default.jspa`
|
||||
else
|
||||
echo "Opening issue #$1"
|
||||
if [[ "x$JIRA_RAPID_BOARD" = "yes" ]]; then
|
||||
$open_cmd "$jira_url/issues/$1"
|
||||
else
|
||||
echo "Opening issue #$1";
|
||||
`open $jira_url/issues/$1`;
|
||||
$open_cmd "$jira_url/browse/$1"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
#compdef knife
|
||||
|
||||
# You can override the path to knife.rb and your cookbooks by setting
|
||||
# KNIFE_CONF_PATH=/path/to/my/.chef/knife.rb
|
||||
# KNIFE_COOKBOOK_PATH=/path/to/my/chef/cookbooks
|
||||
# Read around where these are used for more detail.
|
||||
|
||||
# These flags should be available everywhere according to man knife
|
||||
knife_general_flags=( --help --server-url --key --config --editor --format --log_level --logfile --no-editor --user --print-after --version --yes )
|
||||
|
||||
|
|
@ -26,7 +31,7 @@ _knife() {
|
|||
|
||||
case $state in
|
||||
knifecmd)
|
||||
compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec environment index node recipe role search ssh status windows $cloudproviders
|
||||
compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" diff exec environment index node recipe role search ssh status upload windows $cloudproviders
|
||||
;;
|
||||
knifesubcmd)
|
||||
case $words[2] in
|
||||
|
|
@ -42,9 +47,12 @@ _knife() {
|
|||
cookbook)
|
||||
compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload
|
||||
;;
|
||||
environment)
|
||||
diff)
|
||||
_arguments '*:file or directory:_files -g "*"'
|
||||
;;
|
||||
environment)
|
||||
compadd -Q "$@" list create delete edit show "from file"
|
||||
;;
|
||||
;;
|
||||
node)
|
||||
compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete"
|
||||
;;
|
||||
|
|
@ -54,6 +62,9 @@ _knife() {
|
|||
role)
|
||||
compadd -Q "$@" "bulk delete" create delete edit "from file" list show
|
||||
;;
|
||||
upload)
|
||||
_arguments '*:file or directory:_files -g "*"'
|
||||
;;
|
||||
windows)
|
||||
compadd "$@" bootstrap
|
||||
;;
|
||||
|
|
@ -170,7 +181,13 @@ _chef_environments_remote() {
|
|||
|
||||
# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server
|
||||
_chef_cookbooks_local() {
|
||||
(for i in $( grep cookbook_path $HOME/.chef/knife.rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' ); do ls $i; done)
|
||||
|
||||
local knife_rb=${KNIFE_CONF_PATH:-${HOME}/.chef/knife.rb}
|
||||
if [ -f ./.chef/knife.rb ]; then
|
||||
knife_rb="./.chef/knife.rb"
|
||||
fi
|
||||
local cookbook_path=${KNIFE_COOKBOOK_PATH:-$(grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' )}
|
||||
(for i in $cookbook_path; do ls $i; done)
|
||||
}
|
||||
|
||||
# This function extracts the available cookbook versions on the chef server
|
||||
|
|
|
|||
25
plugins/last-working-dir/last-working-dir.plugin.zsh
Normal file
25
plugins/last-working-dir/last-working-dir.plugin.zsh
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env zsh
|
||||
# Keeps track of the last used working directory and automatically jumps
|
||||
# into it for new shells.
|
||||
|
||||
# Flag indicating if we've previously jumped to last directory.
|
||||
typeset -g ZSH_LAST_WORKING_DIRECTORY
|
||||
mkdir -p "$ZSH/cache"
|
||||
local cache_file="$ZSH/cache/last-working-dir"
|
||||
|
||||
# Updates the last directory once directory is changed.
|
||||
function chpwd() {
|
||||
# Use >| in case noclobber is set to avoid "file exists" error
|
||||
pwd >| "$cache_file"
|
||||
}
|
||||
|
||||
# Changes directory to the last working directory.
|
||||
function lwd() {
|
||||
[[ ! -r "$cache_file" ]] || cd `cat "$cache_file"`
|
||||
}
|
||||
|
||||
# Automatically jump to last working directory unless this isn't the first time
|
||||
# this plugin has been loaded.
|
||||
if [[ -z "$ZSH_LAST_WORKING_DIRECTORY" ]]; then
|
||||
lwd 2>/dev/null && ZSH_LAST_WORKING_DIRECTORY=1 || true
|
||||
fi
|
||||
|
|
@ -5,15 +5,29 @@ function _lein_commands() {
|
|||
case $state in
|
||||
subcommand)
|
||||
subcommands=(
|
||||
"classpath:print the classpath of the current project"
|
||||
"clean:remove compiled files and dependencies from project"
|
||||
"compile:ahead-of-time compile the project"
|
||||
"deploy:build jar and deploy to remote repository"
|
||||
"deps:download and install all dependencies"
|
||||
"help:display a list of tasks or help for a given task"
|
||||
"install:install the project and its dependencies in your local repository"
|
||||
"int:enter an interactive task shell"
|
||||
"interactive:enter an interactive task shell"
|
||||
"jack-in:jack in to a clojure slime session from emacs."
|
||||
"jar:create a jar file containing the compiled .class files"
|
||||
"javac:compile java source files"
|
||||
"new:create a new project skeleton"
|
||||
"plugin:manage user-level plugins"
|
||||
"pom:write a pom.xml file to disk for maven interop"
|
||||
"repl:start a repl session either with the current project or standalone"
|
||||
"retest:run only the test namespaces which failed last time around"
|
||||
"run:run the project's -main function"
|
||||
"search:search remote maven repositories for matching jars"
|
||||
"swank:launch swank server for Emacs to connect"
|
||||
"test:run the project's tests"
|
||||
"test!:run a project's tests after cleaning and fetching dependencies"
|
||||
"trampoline:run a task without nesting the project's JVM inside Leiningen's."
|
||||
"uberjar:Create a jar including the contents of each of deps"
|
||||
"upgrade:upgrade leiningen to the latest stable release"
|
||||
"version:print leiningen's version"
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ alias wtf='dmesg'
|
|||
alias onoz='cat /var/log/errors.log'
|
||||
alias rtfm='man'
|
||||
|
||||
alias :3='echo'
|
||||
alias visible='echo'
|
||||
alias invisible='cat'
|
||||
alias moar='more'
|
||||
|
|
|
|||
|
|
@ -3,12 +3,22 @@
|
|||
alias hgc='hg commit'
|
||||
alias hgb='hg branch'
|
||||
alias hgba='hg branches'
|
||||
alias hgbk='hg bookmarks'
|
||||
alias hgco='hg checkout'
|
||||
alias hgd='hg diff'
|
||||
alias hged='hg diffmerge'
|
||||
# pull and update
|
||||
alias hgi='hg incoming'
|
||||
alias hgl='hg pull -u'
|
||||
alias hglr='hg pull --rebase'
|
||||
alias hgo='hg outgoing'
|
||||
alias hgp='hg push'
|
||||
alias hgs='hg status'
|
||||
# this is the 'git commit --amend' equivalent
|
||||
alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip'
|
||||
|
||||
function hg_current_branch() {
|
||||
if [ -d .hg ]; then
|
||||
echo hg:$(hg branch)
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,170 @@
|
|||
# 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`);
|
||||
reply=(
|
||||
# common lifecycle
|
||||
clean process-resources compile process-test-resources test-compile test package verify install deploy site
|
||||
|
||||
# common plugins
|
||||
deploy failsafe install site surefire checkstyle javadoc jxr pmd ant antrun archetype assembly dependency enforcer gpg help release repository source eclipse idea jetty cargo jboss tomcat tomcat6 tomcat7 exec versions war ear ejb android scm buildnumber nexus repository sonar license hibernate3 liquibase flyway gwt
|
||||
|
||||
# deploy
|
||||
deploy:deploy-file
|
||||
# failsafe
|
||||
failsafe:integration-test failsafe:verify
|
||||
# install
|
||||
install:install-file
|
||||
# site
|
||||
site:site site:deploy site:run site:stage site:stage-deploy
|
||||
# surefire
|
||||
surefire:test
|
||||
|
||||
# checkstyle
|
||||
checkstyle:checkstyle checkstyle:check
|
||||
# javadoc
|
||||
javadoc:javadoc javadoc:jar javadoc:aggregate
|
||||
# jxr
|
||||
jxr:jxr
|
||||
# pmd
|
||||
pmd:pmd pmd:cpd pmd:check pmd:cpd-check
|
||||
|
||||
# ant
|
||||
ant:ant ant:clean
|
||||
# antrun
|
||||
antrun:run
|
||||
# archetype
|
||||
archetype:generate archetype:create-from-project archetype:crawl
|
||||
# assembly
|
||||
assembly:single assembly:assembly
|
||||
# dependency
|
||||
dependency:analyze dependency:analyze-dep-mgt dependency:analyze-only dependency:analyze-report dependency:build-classpath dependency:copy dependency:copy-dependencies dependency:get dependency:go-offline dependency:list dependency:purge-local-repository dependency:resolve dependency:resolve-plugins dependency:sources dependency:tree dependency:unpack dependency:unpack-dependencies
|
||||
# enforcer
|
||||
enforcer:enforce
|
||||
# gpg
|
||||
gpg:sign gpg:sign-and-deploy-file
|
||||
# help
|
||||
help:active-profiles help:all-profiles help:describe help:effective-pom help:effective-settings help:evaluate help:expressions help:system
|
||||
# release
|
||||
release:clean release:prepare release:rollback release:perform release:stage release:branch release:update-versions
|
||||
# repository
|
||||
repository:bundle-create repository:bundle-pack
|
||||
# source
|
||||
source:aggregate source:jar source:jar-no-fork
|
||||
|
||||
# eclipse
|
||||
eclipse:clean eclipse:eclipse
|
||||
# idea
|
||||
idea:clean idea:idea
|
||||
|
||||
# jetty
|
||||
jetty:run jetty:run-exploded
|
||||
# cargo
|
||||
cargo:start cargo:run cargo:stop cargo:deploy cargo:undeploy cargo:help
|
||||
# jboss
|
||||
jboss:start jboss:stop jboss:deploy jboss:undeploy jboss:redeploy
|
||||
# tomcat
|
||||
tomcat:start tomcat:stop tomcat:deploy tomcat:undeploy tomcat:redeploy
|
||||
# tomcat6
|
||||
tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy
|
||||
# tomcat7
|
||||
tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy
|
||||
# exec
|
||||
exec:exec exec:java
|
||||
# versions
|
||||
versions:display-dependency-updates versions:display-plugin-updates versions:display-property-updates versions:update-parent versions:update-properties versions:update-child-modules versions:lock-snapshots versions:unlock-snapshots versions:resolve-ranges versions:set versions:use-releases versions:use-next-releases versions:use-latest-releases versions:use-next-snapshots versions:use-latest-snapshots versions:use-next-versions versions:use-latest-versions versions:commit versions:revert
|
||||
# scm
|
||||
scm:add scm:checkin scm:checkout scm:update scm:status
|
||||
# buildnumber
|
||||
buildnumber:create buildnumber:create-timestamp buildnumber:help buildnumber:hgchangeset
|
||||
|
||||
# war
|
||||
war:war war:exploded war:inplace war:manifest
|
||||
# ear
|
||||
ear:ear ear:generate-application-xml
|
||||
# ejb
|
||||
ejb:ejb
|
||||
# android
|
||||
android:apk android:apklib android:deploy android:deploy-dependencies android:dex android:emulator-start android:emulator-stop android:emulator-stop-all android:generate-sources android:help android:instrument android:manifest-update android:pull android:push android:redeploy android:run android:undeploy android:unpack android:version-update android:zipalign android:devices
|
||||
# nexus
|
||||
nexus:staging-list nexus:staging-close nexus:staging-drop nexus:staging-release nexus:staging-build-promotion nexus:staging-profiles-list nexus:settings-download
|
||||
# repository
|
||||
repository:bundle-create repository:bundle-pack repository:help
|
||||
|
||||
# sonar
|
||||
sonar:sonar
|
||||
# license
|
||||
license:format license:check
|
||||
# hibernate3
|
||||
hibernate3:hbm2ddl hibernate3:help
|
||||
# liquibase
|
||||
liquibase:changelogSync liquibase:changelogSyncSQL liquibase:clearCheckSums liquibase:dbDoc liquibase:diff liquibase:dropAll liquibase:help liquibase:migrate liquibase:listLocks liquibase:migrateSQL liquibase:releaseLocks liquibase:rollback liquibase:rollbackSQL liquibase:status liquibase:tag liquibase:update liquibase:updateSQL liquibase:updateTestingRollback
|
||||
# flyway
|
||||
flyway:clean flyway:history flyway:init flyway:migrate flyway:status flyway:validate
|
||||
# gwt
|
||||
gwt:browser gwt:clean gwt:compile gwt:compile-report gwt:css gwt:debug gwt:eclipse gwt:eclipseTest gwt:generateAsync gwt:help gwt:i18n gwt:mergewebxml gwt:resources gwt:run gwt:sdkInstall gwt:source-jar gwt:soyc gwt:test
|
||||
|
||||
# options
|
||||
-Dmaven.test.skip=true -DskipTests -Dmaven.surefire.debug -DenableCiProfile -Dpmd.skip=true -Dcheckstyle.skip=true -Dtycho.mode=maven
|
||||
|
||||
# arguments
|
||||
-am -amd -B -C -c -cpu -D -e -emp -ep -f -fae -ff -fn -gs -h -l -N -npr -npu -nsu -o -P -pl -q -rf -s -T -t -U -up -V -v -X
|
||||
|
||||
cli:execute cli:execute-phase
|
||||
archetype:generate generate-sources
|
||||
cobertura:cobertura
|
||||
-Dtest= `if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi`
|
||||
);
|
||||
}
|
||||
|
||||
compctl -K listMavenCompletions mvn
|
||||
compctl -K listMavenCompletions mvn
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# Open the node api for your current version to the optional section.
|
||||
# TODO: Make the section part easier to use.
|
||||
function node-docs {
|
||||
open "http://nodejs.org/docs/$(node --version)/api/all.html#$1"
|
||||
open "http://nodejs.org/docs/$(node --version)/api/all.html#all_$1"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,9 @@
|
|||
# FILE: osx.plugin.zsh
|
||||
# DESCRIPTION: oh-my-zsh plugin file.
|
||||
# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com)
|
||||
# VERSION: 1.0.1
|
||||
# VERSION: 1.1.0
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
function tab() {
|
||||
local command="cd \\\"$PWD\\\""
|
||||
(( $# > 0 )) && command="${command}; $*"
|
||||
|
|
@ -35,7 +34,7 @@ EOF
|
|||
launch session "Default Session"
|
||||
set current_session to current session
|
||||
tell current_session
|
||||
write text "${command}"
|
||||
write text "${command}; clear;"
|
||||
end tell
|
||||
end tell
|
||||
end tell
|
||||
|
|
@ -43,6 +42,64 @@ EOF
|
|||
}
|
||||
}
|
||||
|
||||
function vsplit_tab() {
|
||||
local command="cd \\\"$PWD\\\""
|
||||
(( $# > 0 )) && command="${command}; $*"
|
||||
|
||||
the_app=$(
|
||||
osascript 2>/dev/null <<EOF
|
||||
tell application "System Events"
|
||||
name of first item of (every process whose frontmost is true)
|
||||
end tell
|
||||
EOF
|
||||
)
|
||||
|
||||
[[ "$the_app" == 'iTerm' ]] && {
|
||||
osascript 2>/dev/null <<EOF
|
||||
tell application "iTerm" to activate
|
||||
|
||||
tell application "System Events"
|
||||
tell process "iTerm"
|
||||
tell menu item "Split Vertically With Current Profile" of menu "Shell" of menu bar item "Shell" of menu bar 1
|
||||
click
|
||||
end tell
|
||||
end tell
|
||||
keystroke "${command}; clear;"
|
||||
keystroke return
|
||||
end tell
|
||||
EOF
|
||||
}
|
||||
}
|
||||
|
||||
function split_tab() {
|
||||
local command="cd \\\"$PWD\\\""
|
||||
(( $# > 0 )) && command="${command}; $*"
|
||||
|
||||
the_app=$(
|
||||
osascript 2>/dev/null <<EOF
|
||||
tell application "System Events"
|
||||
name of first item of (every process whose frontmost is true)
|
||||
end tell
|
||||
EOF
|
||||
)
|
||||
|
||||
[[ "$the_app" == 'iTerm' ]] && {
|
||||
osascript 2>/dev/null <<EOF
|
||||
tell application "iTerm" to activate
|
||||
|
||||
tell application "System Events"
|
||||
tell process "iTerm"
|
||||
tell menu item "Split Horizontally With Current Profile" of menu "Shell" of menu bar item "Shell" of menu bar 1
|
||||
click
|
||||
end tell
|
||||
end tell
|
||||
keystroke "${command}; clear;"
|
||||
keystroke return
|
||||
end tell
|
||||
EOF
|
||||
}
|
||||
}
|
||||
|
||||
function pfd() {
|
||||
osascript 2>/dev/null <<EOF
|
||||
tell application "Finder"
|
||||
|
|
@ -97,3 +154,6 @@ function trash() {
|
|||
IFS=$temp_ifs
|
||||
}
|
||||
|
||||
function vncviewer() {
|
||||
open vnc://$@
|
||||
}
|
||||
|
|
|
|||
119
plugins/pass/_pass
Normal file
119
plugins/pass/_pass
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
#compdef pass
|
||||
#autoload
|
||||
|
||||
# Copyright (C) 2012:
|
||||
# Johan Venant <jvenant@invicem.pro>
|
||||
# Brian Mattern <rephorm@rephorm.com>
|
||||
# Jason A. Donenfeld <Jason@zx2c4.com>.
|
||||
# Santiago Borrazás <sanbor@gmail.com>
|
||||
# All Rights Reserved.
|
||||
# This file is licensed under the GPLv2+. Please see COPYING for more information.
|
||||
|
||||
|
||||
_pass () {
|
||||
local cmd
|
||||
if (( CURRENT > 2)); then
|
||||
cmd=${words[2]}
|
||||
# Set the context for the subcommand.
|
||||
curcontext="${curcontext%:*:*}:pass-$cmd"
|
||||
# Narrow the range of words we are looking at to exclude `pass'
|
||||
(( CURRENT-- ))
|
||||
shift words
|
||||
# Run the completion for the subcommand
|
||||
case "${cmd}" in
|
||||
init)
|
||||
_arguments : \
|
||||
"-r[re-encrypt existing passwords]" \
|
||||
"--reencrypt[re-encrypt existing passwords]"
|
||||
_pass_complete_keys
|
||||
;;
|
||||
ls|list|edit)
|
||||
_pass_complete_entries_with_subdirs
|
||||
;;
|
||||
insert)
|
||||
_arguments : \
|
||||
"-e[echo password to console]" \
|
||||
"--echo[echo password to console]" \
|
||||
"-m[multiline]" \
|
||||
"--multiline[multiline]"
|
||||
_pass_complete_entries_with_subdirs
|
||||
;;
|
||||
generate)
|
||||
_arguments : \
|
||||
"-n[don't include symbols in password]" \
|
||||
"--no-symbols[don't include symbols in password]" \
|
||||
"-c[copy password to the clipboard]" \
|
||||
"--clip[copy password to the clipboard]"
|
||||
_pass_complete_entries_with_subdirs
|
||||
;;
|
||||
rm)
|
||||
_arguments : \
|
||||
"-f[force deletion]" \
|
||||
"--force[force deletion]" \
|
||||
"-r[recursively delete]" \
|
||||
"--recursive[recursively delete]"
|
||||
_pass_complete_entries_with_subdirs
|
||||
;;
|
||||
git)
|
||||
local -a subcommands
|
||||
subcommands=(
|
||||
"init:Initialize git repository"
|
||||
"push:Push to remote repository"
|
||||
"pull:Pull from remote repository"
|
||||
"config:Show git config"
|
||||
"log:Show git log"
|
||||
"reflog:Show git reflog"
|
||||
)
|
||||
_describe -t commands 'pass git' subcommands
|
||||
;;
|
||||
show|*)
|
||||
_pass_cmd_show
|
||||
;;
|
||||
esac
|
||||
else
|
||||
local -a subcommands
|
||||
subcommands=(
|
||||
"init:Initialize new password storage"
|
||||
"ls:List passwords"
|
||||
"show:Decrypt and print a password"
|
||||
"insert:Insert a new password"
|
||||
"generate:Generate a new password using pwgen"
|
||||
"edit:Edit a password with \$EDITOR"
|
||||
"rm:Remove the password"
|
||||
"git:Call git on the password store"
|
||||
"version:Output version information"
|
||||
"help:Output help message"
|
||||
)
|
||||
_describe -t commands 'pass' subcommands
|
||||
_arguments : \
|
||||
"--version[Output version information]" \
|
||||
"--help[Output help message]"
|
||||
_pass_cmd_show
|
||||
fi
|
||||
}
|
||||
|
||||
_pass_cmd_show () {
|
||||
_arguments : \
|
||||
"-c[put it on the clipboard]" \
|
||||
"--clip[put it on the clipboard]"
|
||||
_pass_complete_entries
|
||||
}
|
||||
_pass_complete_entries_helper () {
|
||||
local IFS=$'\n'
|
||||
local prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
|
||||
_values -C 'passwords' $(find "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print | sed -e "s#${prefix}.##" -e 's#\.gpg##' | sort)
|
||||
}
|
||||
|
||||
_pass_complete_entries_with_subdirs () {
|
||||
_pass_complete_entries_helper
|
||||
}
|
||||
|
||||
_pass_complete_entries () {
|
||||
_pass_complete_entries_helper -type f
|
||||
}
|
||||
|
||||
_pass_complete_keys () {
|
||||
local IFS=$'\n'
|
||||
# Extract names and email addresses from gpg --list-keys
|
||||
_values 'gpg keys' $(gpg2 --list-secret-keys --with-colons | cut -d : -f 10 | sort -u | sed '/^$/d')
|
||||
}
|
||||
|
|
@ -65,12 +65,13 @@
|
|||
function per-directory-history-toggle-history() {
|
||||
if [[ $_per_directory_history_is_global == true ]]; then
|
||||
_per-directory-history-set-directory-history
|
||||
echo "using local history\n"
|
||||
print "\nusing local history\n"
|
||||
else
|
||||
_per-directory-history-set-global-history
|
||||
echo "using global history\n"
|
||||
print "\nusing global history\n"
|
||||
fi
|
||||
zle reset-prompt
|
||||
zle .push-line
|
||||
zle .accept-line
|
||||
}
|
||||
|
||||
autoload per-directory-history-toggle-history
|
||||
|
|
|
|||
|
|
@ -1,16 +1,13 @@
|
|||
_phing_does_target_list_need_generating () {
|
||||
if [ ! -f .phing_targets ]; then return 0;
|
||||
else
|
||||
accurate=$(stat -f%m .phing_targets)
|
||||
changed=$(stat -f%m build.xml)
|
||||
return $(expr $accurate '>=' $changed)
|
||||
fi
|
||||
[ ! -f .phing_targets ] && return 0;
|
||||
[ .phing_targets -nt build.xml ] && return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
_phing () {
|
||||
if [ -f build.xml ]; then
|
||||
if _phing_does_target_list_need_generating; then
|
||||
phing -l |grep -v ":" |grep -v "^$"|grep -v "\-" > .phing_targets
|
||||
phing -l |grep -v ":$" |grep -v "^-*$" > .phing_targets
|
||||
fi
|
||||
compadd `cat .phing_targets`
|
||||
fi
|
||||
|
|
|
|||
42
plugins/pj/pj.plugin.zsh
Normal file
42
plugins/pj/pj.plugin.zsh
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#!/bin/zsh
|
||||
|
||||
#
|
||||
# Original idea by DefV (Jan De Poorter)
|
||||
# Source: https://gist.github.com/pjaspers/368394#comment-1016
|
||||
#
|
||||
# Usage:
|
||||
# - Set `$PROJECT_PATHS` in your ~/.zshrc
|
||||
# e.g.: PROJECT_PATHS=(~/src ~/work)
|
||||
# - In ZSH you now can open a project directory with the command: `pj my-project`
|
||||
# the plugin will locate the `my-project` directory in one of the $PROJECT_PATHS
|
||||
# Also tab completion is supported.
|
||||
# - `pjo my-project` will open the directory in $EDITOR
|
||||
#
|
||||
|
||||
function pj() {
|
||||
cmd="cd"
|
||||
file=$1
|
||||
|
||||
if [[ "open" == "$file" ]] then
|
||||
file=$2
|
||||
cmd=(${(s: :)EDITOR})
|
||||
fi
|
||||
|
||||
for project in $PROJECT_PATHS; do
|
||||
if [[ -d $project/$file ]] then
|
||||
$cmd "$project/$file"
|
||||
unset project # Unset project var
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
echo "No such project $1"
|
||||
}
|
||||
|
||||
alias pjo="pj open"
|
||||
|
||||
function _pj () {
|
||||
compadd `/bin/ls -l $PROJECT_PATHS 2>/dev/null | awk '{ print $9 }'`
|
||||
}
|
||||
|
||||
compdef _pj pj
|
||||
55
plugins/powify/_powify
Normal file
55
plugins/powify/_powify
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#compdef powify
|
||||
|
||||
_powify_all_servers() {
|
||||
all_servers=(`ls $HOME/.pow/`)
|
||||
}
|
||||
|
||||
local -a all_servers
|
||||
|
||||
local -a _1st_arguments
|
||||
_1st_arguments=(
|
||||
'server:server specific commands'
|
||||
'utils:manage powify'
|
||||
'create:creates a pow app from the current directory (to change the name append name as an argument)'
|
||||
'destroy:destroys the pow app linked to the current directory'
|
||||
'restart:restarts the pow app linked to the current directory'
|
||||
'always_restart:reload the pow app after each request'
|
||||
'always_restart_off:do not reload the pow app after each request'
|
||||
'rename:rename the current pow app to [NAME] or renmae [OLD] to [NEW]'
|
||||
'environment:run the this pow app in a different environment (aliased `env`)'
|
||||
'browse:opens and navigates the default browser to this app'
|
||||
'logs:tail the application logs'
|
||||
)
|
||||
|
||||
_arguments '*:: :->command'
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "powify command" _1st_arguments
|
||||
return
|
||||
fi
|
||||
|
||||
case "$words[1]" in
|
||||
server)
|
||||
_values \
|
||||
'install[install pow server]' \
|
||||
'reinstall[reinstall pow server]' \
|
||||
'update[update pow server]' \
|
||||
'uninstall[uninstall pow server]' \
|
||||
'list[list all pow apps]' \
|
||||
'start[start the pow server]' \
|
||||
'stop[stop the pow server]' \
|
||||
'restart[restart the pow server]' \
|
||||
'host[adds all pow apps to /etc/hosts file]' \
|
||||
'unhost[removes all pow apps from /etc/hosts file]' \
|
||||
'status[print the current server status]' \
|
||||
'config[print the current server configuration]' \
|
||||
'logs[tails the pow server logs]' ;;
|
||||
utils)
|
||||
_values \
|
||||
'install[install powify.dev server management tool]' \
|
||||
'reinstall[reinstall powify.dev server management tool]' \
|
||||
'uninstall[uninstall powify.dev server management tool]' ;;
|
||||
destroy|restart|always_restart|always_restart_off|rename|browse|logs)
|
||||
_powify_all_servers
|
||||
_wanted all_servers expl 'all pow servers' compadd -a all_servers ;;
|
||||
esac
|
||||
12
plugins/profiles/profiles.plugin.zsh
Normal file
12
plugins/profiles/profiles.plugin.zsh
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# You will probably want to list this plugin as the first in your .zshrc.
|
||||
|
||||
# This will look for a custom profile for the local machine and each domain or
|
||||
# subdomain it belongs to. (e.g. com, example.com and foo.example.com)
|
||||
parts=(${(s:.:)$(hostname)})
|
||||
for i in {${#parts}..1}; do
|
||||
profile=${(j:.:)${parts[$i,${#parts}]}}
|
||||
file=$ZSH_CUSTOM/profiles/$profile
|
||||
if [ -f $file ]; then
|
||||
source $file
|
||||
fi
|
||||
done
|
||||
|
|
@ -1,8 +1,12 @@
|
|||
# Find python file
|
||||
alias pyfind='find . -name "*.py"'
|
||||
|
||||
# Remove python compiled byte-code
|
||||
alias pyclean='find . -type f -name "*.py[co]" -delete'
|
||||
# Remove python compiled byte-code in either current directory or in a
|
||||
# list of specified directories
|
||||
function pyclean() {
|
||||
ZSH_PYCLEAN_PLACES=${*:-'.'}
|
||||
find ${ZSH_PYCLEAN_PLACES} -type f -name "*.py[co]" -delete
|
||||
}
|
||||
|
||||
# Grep among .py files
|
||||
alias pygrep='grep --include="*.py"'
|
||||
|
|
|
|||
|
|
@ -5,9 +5,14 @@ alias sp='ruby script/plugin'
|
|||
alias sr='ruby script/runner'
|
||||
alias ssp='ruby script/spec'
|
||||
alias rdbm='rake db:migrate'
|
||||
alias rdbtp='rake db:test:prepare'
|
||||
alias migrate='rake db:migrate && rake db:test:prepare'
|
||||
alias sc='ruby script/console'
|
||||
alias sd='ruby script/server --debugger'
|
||||
alias devlog='tail -f log/development.log'
|
||||
alias -g RET='RAILS_ENV=test'
|
||||
alias -g REP='RAILS_ENV=production'
|
||||
alias -g RED='RAILS_ENV=development'
|
||||
|
||||
function remote_console() {
|
||||
/usr/bin/env ssh $1 "( cd $2 && ruby script/console production )"
|
||||
|
|
|
|||
|
|
@ -21,3 +21,6 @@ alias rsd='_rails_command server --debugger'
|
|||
alias devlog='tail -f log/development.log'
|
||||
alias rdm='rake db:migrate'
|
||||
alias rdr='rake db:rollback'
|
||||
alias -g RET='RAILS_ENV=test'
|
||||
alias -g REP='RAILS_ENV=production'
|
||||
alias -g RED='RAILS_ENV=development'
|
||||
|
|
|
|||
30
plugins/rails4/rails4.plugin.zsh
Normal file
30
plugins/rails4/rails4.plugin.zsh
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# Rails 4 aliases
|
||||
|
||||
function _rails_command () {
|
||||
if [ -e "script/server" ]; then
|
||||
ruby script/$@
|
||||
elif [ -e "script/rails" ]; then
|
||||
ruby script/rails $@
|
||||
else
|
||||
ruby bin/rails $@
|
||||
fi
|
||||
}
|
||||
|
||||
alias rc='_rails_command console'
|
||||
alias rd='_rails_command destroy'
|
||||
alias rdb='_rails_command dbconsole'
|
||||
alias rdbm='rake db:migrate db:test:clone'
|
||||
alias rg='_rails_command generate'
|
||||
alias rgm='_rails_command generate migration'
|
||||
alias rp='_rails_command plugin'
|
||||
alias ru='_rails_command runner'
|
||||
alias rs='_rails_command server'
|
||||
alias rsd='_rails_command server --debugger'
|
||||
alias devlog='tail -f log/development.log'
|
||||
alias rdm='rake db:migrate'
|
||||
alias rdc='rake db:create'
|
||||
alias rdr='rake db:rollback'
|
||||
alias rds='rake db:seed'
|
||||
alias rlc='rake log:clear'
|
||||
alias rn='rake notes'
|
||||
alias rr='rake routes'
|
||||
|
|
@ -17,7 +17,7 @@ for rbenvdir in "${rbenvdirs[@]}" ; do
|
|||
FOUND_RBENV=1
|
||||
export RBENV_ROOT=$rbenvdir
|
||||
export PATH=${rbenvdir}/bin:$PATH
|
||||
eval "$(rbenv init - zsh)"
|
||||
eval "$(rbenv init --no-rehash - zsh)"
|
||||
|
||||
alias rubies="rbenv versions"
|
||||
alias gemsets="rbenv gemset list"
|
||||
|
|
@ -32,11 +32,11 @@ for rbenvdir in "${rbenvdirs[@]}" ; do
|
|||
|
||||
function gems {
|
||||
local rbenv_path=$(rbenv prefix)
|
||||
gem list $@ | sed \
|
||||
-Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
|
||||
-Ee "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \
|
||||
-Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
|
||||
-Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
|
||||
gem list $@ | sed -E \
|
||||
-e "s/\([0-9a-z, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \
|
||||
-e "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \
|
||||
-e "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
|
||||
-e "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
|
||||
}
|
||||
|
||||
function rbenv_prompt_info() {
|
||||
|
|
|
|||
79
plugins/rebar/_rebar
Normal file
79
plugins/rebar/_rebar
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
#compdef rebar
|
||||
|
||||
local curcontext=$curcontext state ret=1
|
||||
typeset -ga _rebar_global_opts
|
||||
|
||||
_rebar_global_opts=(
|
||||
'(--help -h)'{--help,-h}'[Show the program options]'
|
||||
'(--commands -c)'{--commands,-c}'[Show available commands]'
|
||||
'(--version -V)'{--version,-V}'[Show version information]'
|
||||
'(-vvv -vv -v)'--verbose+'[Verbosity level. Default: 0]:verbosity level:(0 1 2 3)'
|
||||
'(-vvv)-v[Slightly more verbose output]'
|
||||
'(-vvv)-vv[More verbose output]'
|
||||
'(-v -vv)-vvv[Most verbose output]'
|
||||
'(--force -f)'{--force,-f}'[Force]'
|
||||
'-D+[Define compiler macro]'
|
||||
'(--jobs -j)'{--jobs+,-j+}'[Number of concurrent workers a command may use. Default: 3]:workers:(1 2 3 4 5 6 7 8 9)'
|
||||
'(--config -C)'{--config,-C}'[Rebar config file to use]:files:_files'
|
||||
'(--profile -p)'{--profile,-p}'[Profile this run of rebar]'
|
||||
'(--keep-going -k)'{--keep-going,-k}'[Keep running after a command fails]'
|
||||
)
|
||||
|
||||
_rebar () {
|
||||
_arguments -C $_rebar_global_opts \
|
||||
'*::command and variable:->cmd_and_var' \
|
||||
&& return
|
||||
|
||||
case $state in
|
||||
cmd_and_var)
|
||||
_values -S = 'variables' \
|
||||
'clean[Clean]' \
|
||||
'compile[Compile sources]' \
|
||||
'create[Create skel based on template and vars]' \
|
||||
'create-app[Create simple app skel]' \
|
||||
'create-node[Create simple node skel]' \
|
||||
'list-template[List avaiavle templates]' \
|
||||
'doc[Generate Erlang program documentation]' \
|
||||
'check-deps[Display to be fetched dependencies]' \
|
||||
'get-deps[Fetch dependencies]' \
|
||||
'update-deps[Update fetched dependencies]' \
|
||||
'delete-deps[Delete fetched dependencies]' \
|
||||
'list-deps[List dependencies]' \
|
||||
'generate[Build release with reltool]' \
|
||||
'overlay[Run reltool overlays only]' \
|
||||
'generate-appups[Generate appup files]' \
|
||||
'generate-upgrade[Build an upgrade package]' \
|
||||
'eunit[Run eunit tests]' \
|
||||
'ct[Run common_test suites]' \
|
||||
'qc[Test QuickCheck properties]' \
|
||||
'xref[Run cross reference analysis]' \
|
||||
'help[Show the program options]' \
|
||||
'version[Show version information]' \
|
||||
'apps[Application names to process]:' \
|
||||
'case[Common Test case]:' \
|
||||
'dump_spec[Dump reltool spec]:' \
|
||||
'jobs[Number of workers]::workers:(0 1 2 3 4 5 6 7 8 9)' \
|
||||
'suites[Common Test suites]::suite name:_path_files -W "(src test)" -g "*.erl(:r)"' \
|
||||
'verbose[Verbosity level]::verbosity level:(0 1 2 3)' \
|
||||
'appid[Application id]:' \
|
||||
'previous_release[Previous release path]:' \
|
||||
'nodeid[Node id]:' \
|
||||
'root_dir[Reltool config root directory]::directory:_files -/' \
|
||||
'skip_deps[Skip deps]::flag:(true false)' \
|
||||
'skip_apps[Application names to not process]::flag:(true false)' \
|
||||
'template[Template name]:' \
|
||||
'template_dir[Template directory]::directory:_files -/' \
|
||||
&& ret=0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_rebar
|
||||
|
||||
# Local variables:
|
||||
# mode: shell-script
|
||||
# sh-basic-offset: 2
|
||||
# sh-indent-comment: t
|
||||
# indent-tabs-mode: nil
|
||||
# End:
|
||||
# ex: sw=2 ts=2 et filetype=sh
|
||||
4
plugins/rsync/rsync.plugin.zsh
Normal file
4
plugins/rsync/rsync.plugin.zsh
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
alias rsync-copy="rsync -av --progress -h"
|
||||
alias rsync-move="rsync -av --progress -h --remove-source-files"
|
||||
alias rsync-update="rsync -avu --progress -h"
|
||||
alias rsync-synchronize="rsync -avu --delete --progress -h"
|
||||
147
plugins/rvm/_rvm
147
plugins/rvm/_rvm
|
|
@ -1,147 +0,0 @@
|
|||
#compdef rvm
|
||||
|
||||
local curcontext="$curcontext" state line cmds ret=1
|
||||
|
||||
_arguments -C \
|
||||
'(- 1 *)'{-v,--version}'[display version information]' \
|
||||
'(-l|--level)'{-l,--level}'+[patch level to use with rvm use / install]:number' \
|
||||
'(--prefix)--prefix[path for all rvm files (~/.rvm/), with trailing slash!]:path:_files' \
|
||||
'(--bin)--bin[path for binaries to be placed (~/.rvm/bin/)]:path:_files' \
|
||||
'(--source)--source[src directory to use (~/.rvm/src/)]:path:_files' \
|
||||
'(--archives)--archives[directory for downladed files (~/.rvm/archives/)]:path:_files' \
|
||||
'-S[Specify a script file to attempt to load and run (rubydo)]:file:_files' \
|
||||
'-e[Execute code from the command line]:code' \
|
||||
'(-G)-G[root gem path to use]:path:_files' \
|
||||
'(--gems)--gems[Used to set the gems_flag, use with remove to remove gems]' \
|
||||
'(--archive)--archive[Used to set the archive_flag, use with remove to remove archive]' \
|
||||
'(--patch)--patch[With MRI Rubies you may specify one or more full paths to patches]' \
|
||||
'(-C|--configure)'{-C,--configure}'=[custom configure options]' \
|
||||
'(--nice)--nice[process niceness (for slow computers, default 0)]:number' \
|
||||
'(--ree)--ree-options[Options passed directly to ree ./installer on the command line]:options' \
|
||||
'(--head)--head[with update, updates rvm to git head version]' \
|
||||
'(--rubygems)--rubygems[with update, updates rubygems for selected ruby]' \
|
||||
'(--default)--default[with ruby select, sets a default ruby for new shells]' \
|
||||
'(--debug)--debug[Toggle debug mode on for very verbose output]' \
|
||||
'(--trace)--trace[Toggle trace mode on to see EVERYTHING rvm is doing]' \
|
||||
'(--force)--force[Force install, removes old install & source before install]' \
|
||||
'(--summary)--summary[Used with rubydo to print out a summary of the commands run]' \
|
||||
'(--latest)--latest[with gemset --dump skips version strings for latest gem]' \
|
||||
'(--gems)--gems[with uninstall/remove removes gems with the interpreter]' \
|
||||
'(--docs)--docs[with install, attempt to generate ri after installation]' \
|
||||
'(--reconfigure)--reconfigure[Force ./configure on install even if Makefile already exists]' \
|
||||
'1: :->cmds' \
|
||||
'*: :->args' && ret=0
|
||||
|
||||
case $state in
|
||||
cmds)
|
||||
cmds=(
|
||||
"version:show the rvm version installed in rvm_path"
|
||||
"use:setup current shell to use a specific ruby version"
|
||||
"reload:reload rvm source itself (useful after changing rvm source)"
|
||||
"implode:(seppuku) removes the rvm installation completely. This means everything in $rvm_path (~/.rvm)."
|
||||
"update:upgrades rvm to the latest version."
|
||||
"reset:remove current and stored default & system settings."
|
||||
"info :show the *current* environment information for current ruby"
|
||||
"current:print the *current* ruby version and the name of any gemset being used."
|
||||
"debug:show info plus additional information for common issues"
|
||||
"install:install one or many ruby versions"
|
||||
"uninstall:uninstall one or many ruby versions, leaves their sources"
|
||||
"remove:uninstall one or many ruby versions and remove their sources"
|
||||
"migrate:Lets you migrate all gemsets from one ruby to another."
|
||||
"upgrade:Lets you upgrade from one version of a ruby to another, including migrating your gemsets semi-automatically."
|
||||
"wrapper:generates a set of wrapper executables for a given ruby with the specified ruby and gemset combination. Used under the hood for passenger support and the like."
|
||||
"cleanup:Lets you remove stale source folders / archives and other miscellaneous data associated with rvm."
|
||||
"repair:Lets you repair parts of your environment e.g. wrappers, env files and and similar files (e.g. general maintenance)."
|
||||
"snapshot:Lets your backup / restore an rvm installation in a lightweight manner."
|
||||
"disk-usage:Tells you how much disk space rvm install is using."
|
||||
"tools:Provides general information about the ruby environment, primarily useful when scripting rvm."
|
||||
"docs:Tools to make installing ri and rdoc documentation easier."
|
||||
"rvmrc:Tools related to managing rvmrc trust and loading."
|
||||
"exec:runs an arbitrary command as a set operation."
|
||||
"ruby:runs a named ruby file against specified and/or all rubies"
|
||||
"gem:runs a gem command using selected ruby's 'gem'"
|
||||
"rake:runs a rake task against specified and/or all rubies"
|
||||
"tests:runs 'rake test' across selected ruby versions"
|
||||
"specs:runs 'rake spec' across selected ruby versions"
|
||||
"monitor:Monitor cwd for testing, run rake {spec,test} on changes."
|
||||
"gemset:gemsets: http://rvm.beginrescueend.com/gemsets/"
|
||||
"rubygems:Switches the installed version of rubygems for the current ruby."
|
||||
"gemdir:display the path to the current gem directory (GEM_HOME)."
|
||||
"srcdir:display the path to rvm source directory (may be yanked)"
|
||||
"fetch:Performs an archive / src fetch only of the selected ruby."
|
||||
"list:show currently installed rubies, interactive output."
|
||||
"package:Install a dependency package {readline,iconv,zlib,openssl}"
|
||||
"notes:Display notes, with operating system specifics."
|
||||
"export:Temporarily set an environment variable in the current shell."
|
||||
"unexport:Undo changes made to the environment by 'rvm export'."
|
||||
)
|
||||
_describe -t commands 'rvm command' cmds && ret=0
|
||||
;;
|
||||
args)
|
||||
case $line[1] in
|
||||
(use|uninstall|remove|list)
|
||||
_values -S , 'rubies' $(rvm list strings | sed -e 's/ruby-\([^) ]*\)-\([^) ]*\)/ruby-\1-\2 \1-\2 \1/g') default system && ret=0
|
||||
;;
|
||||
(install|fetch)
|
||||
_values -S , 'rubies' $(rvm list known_strings) && ret=0
|
||||
;;
|
||||
gemset)
|
||||
if (( CURRENT == 3 )); then
|
||||
_values 'gemset_commands' \
|
||||
'import' \
|
||||
'export' \
|
||||
'create' \
|
||||
'copy' \
|
||||
'rename' \
|
||||
'empty' \
|
||||
'delete' \
|
||||
'name' \
|
||||
'dir' \
|
||||
'list' \
|
||||
'list_all' \
|
||||
'gemdir' \
|
||||
'install' \
|
||||
'pristine' \
|
||||
'clear' \
|
||||
'use' \
|
||||
'update' \
|
||||
'unpack' \
|
||||
'globalcache'
|
||||
else
|
||||
_values -S , 'gemsets' $(rvm gemset list | grep -v gemset 2>/dev/null)
|
||||
fi
|
||||
ret=0
|
||||
;;
|
||||
package)
|
||||
if (( CURRENT == 3 )); then
|
||||
_values 'package_commands' \
|
||||
'install' \
|
||||
'uninstall'
|
||||
else
|
||||
_values 'packages' \
|
||||
'readline' \
|
||||
'iconv' \
|
||||
'curl' \
|
||||
'openssl' \
|
||||
'zlib' \
|
||||
'autoconf' \
|
||||
'ncurses' \
|
||||
'pkgconfig' \
|
||||
'gettext' \
|
||||
'glib' \
|
||||
'mono' \
|
||||
'llvm' \
|
||||
'libxml2' \
|
||||
'libxslt' \
|
||||
'libyaml'
|
||||
fi
|
||||
ret=0
|
||||
;;
|
||||
*)
|
||||
(( ret )) && _message 'no more arguments'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
|
|
@ -1,8 +1,11 @@
|
|||
fpath=($rvm_path/scripts/zsh/Completion $fpath)
|
||||
|
||||
alias rubies='rvm list rubies'
|
||||
alias gemsets='rvm gemset list'
|
||||
|
||||
local ruby18='ruby-1.8.7-p334'
|
||||
local ruby19='ruby-1.9.2-p180'
|
||||
local ruby18='ruby-1.8.7-p371'
|
||||
local ruby19='ruby-1.9.3-p392'
|
||||
local ruby20='ruby-2.0.0-p0'
|
||||
|
||||
function rb18 {
|
||||
if [ -z "$1" ]; then
|
||||
|
|
@ -26,6 +29,17 @@ function rb19 {
|
|||
_rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`}
|
||||
compdef _rb19 rb19
|
||||
|
||||
function rb20 {
|
||||
if [ -z "$1" ]; then
|
||||
rvm use "$ruby"
|
||||
else
|
||||
rvm use "$ruby20@$1"
|
||||
fi
|
||||
}
|
||||
|
||||
_rb20() {compadd `ls -1 $rvm_path/gems | grep "^$ruby20@" | sed -e "s/^$ruby20@//" | awk '{print $1}'`}
|
||||
compdef _rb20 rb20
|
||||
|
||||
function rvm-update {
|
||||
rvm get head
|
||||
rvm reload # TODO: Reload rvm completion?
|
||||
|
|
@ -42,3 +56,8 @@ function gems {
|
|||
-Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
|
||||
-Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
|
||||
}
|
||||
|
||||
function _rvm_completion {
|
||||
source $rvm_path"/scripts/zsh/Completion/_rvm"
|
||||
}
|
||||
compdef _rvm_completion rvm
|
||||
|
|
|
|||
54
plugins/safe-paste/safe-paste.plugin.zsh
Normal file
54
plugins/safe-paste/safe-paste.plugin.zsh
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
# Code from Mikael Magnusson: http://www.zsh.org/mla/users/2011/msg00367.html
|
||||
#
|
||||
# Requires xterm, urxvt, iTerm2 or any other terminal that supports bracketed
|
||||
# paste mode as documented: http://www.xfree86.org/current/ctlseqs.html
|
||||
|
||||
# create a new keymap to use while pasting
|
||||
bindkey -N paste
|
||||
# make everything in this keymap call our custom widget
|
||||
bindkey -R -M paste "^@"-"\M-^?" paste-insert
|
||||
# these are the codes sent around the pasted text in bracketed
|
||||
# paste mode.
|
||||
# do the first one with both -M viins and -M vicmd in vi mode
|
||||
bindkey '^[[200~' _start_paste
|
||||
bindkey -M paste '^[[201~' _end_paste
|
||||
# insert newlines rather than carriage returns when pasting newlines
|
||||
bindkey -M paste -s '^M' '^J'
|
||||
|
||||
zle -N _start_paste
|
||||
zle -N _end_paste
|
||||
zle -N zle-line-init _zle_line_init
|
||||
zle -N zle-line-finish _zle_line_finish
|
||||
zle -N paste-insert _paste_insert
|
||||
|
||||
# switch the active keymap to paste mode
|
||||
function _start_paste() {
|
||||
bindkey -A paste main
|
||||
}
|
||||
|
||||
# go back to our normal keymap, and insert all the pasted text in the
|
||||
# command line. this has the nice effect of making the whole paste be
|
||||
# a single undo/redo event.
|
||||
function _end_paste() {
|
||||
#use bindkey -v here with vi mode probably. maybe you want to track
|
||||
#if you were in ins or cmd mode and restore the right one.
|
||||
bindkey -e
|
||||
LBUFFER+=$_paste_content
|
||||
unset _paste_content
|
||||
}
|
||||
|
||||
function _paste_insert() {
|
||||
_paste_content+=$KEYS
|
||||
}
|
||||
|
||||
function _zle_line_init() {
|
||||
# Tell terminal to send escape codes around pastes.
|
||||
[[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color || $TERM = screen || $TERM = screen-256color ]] && printf '\e[?2004h'
|
||||
}
|
||||
|
||||
function _zle_line_finish() {
|
||||
# Tell it to stop when we leave zle, so pasting in other programs
|
||||
# doesn't get the ^[[200~ codes around the pasted text.
|
||||
[[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color || $TERM = screen || $TERM = screen-256color ]] && printf '\e[?2004l'
|
||||
}
|
||||
|
||||
55
plugins/sbt/_sbt
Normal file
55
plugins/sbt/_sbt
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#compdef sbt
|
||||
#autoload
|
||||
|
||||
local -a _sbt_commands
|
||||
_sbt_commands=(
|
||||
'clean:delete files produced by the build'
|
||||
'compile:compile sources'
|
||||
'console:start the Scala REPL with project classes on the classpath'
|
||||
'console-quick:start the Scala REPL with project deps on the classpath'
|
||||
'console-project:start the Scala REPL w/sbt+build-def on the classpath'
|
||||
'dist:generate distribution artifacts'
|
||||
'dist\:clean:clean distribution artifacts'
|
||||
'doc:generate API documentation'
|
||||
'gen-idea:generate Intellij Idea project files'
|
||||
'package:produce the main artifact, such as a binary jar'
|
||||
'package-doc:produce a doc artifact, such as a jar containing API docs'
|
||||
'package-src:produce a source artifact, such as a jar containing sources'
|
||||
'publish:publish artifacts to a repository'
|
||||
'publish-local:publish artifacts to the local repository'
|
||||
'run:run a main class'
|
||||
'run-main:run the main class selected by the first argument'
|
||||
'test:execute all tests'
|
||||
'test-only:execute the tests provided as arguments'
|
||||
'test-quick:execute previously failed tests'
|
||||
'update:resolve and optionally retrieve dependencies'
|
||||
)
|
||||
|
||||
local expl
|
||||
|
||||
_arguments \
|
||||
'(-help)-h[prints an help message]' \
|
||||
'(-h)-help[prints an help message]' \
|
||||
'(-verbose)-v[this runner is chattier]' \
|
||||
'(-v)-verbose[this runner is chattier]' \
|
||||
'(-debug)-d[set sbt log level to debug]' \
|
||||
'(-d)-debug[set sbt log level to debug]' \
|
||||
'-no-colors[disable ANSI color codes]' \
|
||||
'-sbt-create[start even if current dir contains no sbt project]' \
|
||||
'-sbt-dir[path to global settings/plugins dir (default: ~/.sbt)]' \
|
||||
'-sbt-boot[path to shared boot dir (default: ~/.sbt/boot)]' \
|
||||
'-ivy[path to local Ivy repository (default: ~/.ivy2)]' \
|
||||
'-mem[set memory options]' \
|
||||
'-no-share[use all local caches; no sharing]' \
|
||||
'-no-global[use global caches, but do not use global ~/.sbt dir]' \
|
||||
'-jvm-debug[turn on JVM debugging, open at the given port]' \
|
||||
'-batch[disable interactive mode]' \
|
||||
'-sbt-version[use the specified version of sbt]' \
|
||||
'-sbt-jar[use the specified jar as the sbt launcher]' \
|
||||
'(-sbt-snapshot)-sbt-rc[use an RC version of sbt]' \
|
||||
'(-sbt-rc)-sbt-snapshot[use a snapshot version of sbt]' \
|
||||
'-java-home[alternate JAVA_HOME]' \
|
||||
'*:: :->subcmds' && return 0
|
||||
|
||||
_describe -t commands "sbt subcommand" _sbt_commands
|
||||
return
|
||||
23
plugins/sbt/sbt.plugin.zsh
Normal file
23
plugins/sbt/sbt.plugin.zsh
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# ------------------------------------------------------------------------------
|
||||
# FILE: sbt.plugin.zsh
|
||||
# DESCRIPTION: oh-my-zsh plugin file.
|
||||
# AUTHOR: Mirko Caserta (mirko.caserta@gmail.com)
|
||||
# VERSION: 1.0.2
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# aliases - mnemonic: prefix is 'sb'
|
||||
alias sbc='sbt compile'
|
||||
alias sbco='sbt console'
|
||||
alias sbcq='sbt console-quick'
|
||||
alias sbcl='sbt clean'
|
||||
alias sbcp='sbt console-project'
|
||||
alias sbd='sbt doc'
|
||||
alias sbdc='sbt dist:clean'
|
||||
alias sbdi='sbt dist'
|
||||
alias sbgi='sbt gen-idea'
|
||||
alias sbp='sbt publish'
|
||||
alias sbpl='sbt publish-local'
|
||||
alias sbr='sbt run'
|
||||
alias sbrm='sbt run-main'
|
||||
alias sbu='sbt update'
|
||||
alias sbx='sbt test'
|
||||
249
plugins/scala/_scala
Normal file
249
plugins/scala/_scala
Normal file
|
|
@ -0,0 +1,249 @@
|
|||
#compdef scala scalac
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright (c) 2012 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 scala and scalac (http://www.scala-lang.org/).
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Tony Sloane <inkytonik@gmail.com>
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
typeset -A opt_args
|
||||
local context state line
|
||||
|
||||
_scala_features () {
|
||||
compadd "postfixOps" "reflectiveCalls" "implicitConversions" "higherKinds" \
|
||||
"existentials" "experimental.macros" "_"
|
||||
}
|
||||
|
||||
_scala_phases () {
|
||||
compadd "parser" "namer" "packageobjects" "typer" "patmat" "superaccessors" \
|
||||
"extmethods" "pickler" "refchecks" "selectiveanf" "selectivecps" "uncurry" \
|
||||
"tailcalls" "specialize" "explicitouter" "erasure" "posterasure" "lazyvals" \
|
||||
"lambdalift" "constructors" "flatten" "mixin" "cleanup" "icode" "inliner" \
|
||||
"inlineExceptionHandlers" "closelim" "dce" "jvm" "terminal"
|
||||
}
|
||||
|
||||
local -a shared_opts
|
||||
shared_opts=(
|
||||
"-bootclasspath+[Override location of bootstrap class files]:bootstrap class directory:_files -/"
|
||||
"-classpath+[Specify where to find user class files]:directory:_files -/"
|
||||
"-D-[Pass -Dproperty=value directly to the runtime system]"
|
||||
"-d+[Destination for generated classfiles]: directory or jar file:_files"
|
||||
"-dependencyfile+[Set dependency tracking file]:dependency tracking file:_files"
|
||||
"-deprecation[Emit warning and location for usages of deprecated APIs]"
|
||||
"-encoding+[Specify character encoding used by source files]:encoding:"
|
||||
"-explaintypes[Explain type errors in more detail]"
|
||||
"-extdirs+[Override location of installed extensions]:extensions directory:_files -/"
|
||||
"-g\:-[Set level of generated debugging info (default\: vars)]:debugging info level:(none source line vars notailcalls)"
|
||||
"-help[Print a synopsis of standard options]"
|
||||
"-J-[pass argument directly to Java runtime system]:JVM argument:"
|
||||
"-javabootclasspath+[Override java boot classpath]:Java boot class path directory]:_files -/"
|
||||
"-javaextdirs+[Override java extdirs classpath]:Java extdirs directory:_files -/"
|
||||
"-language\:-[Enable one or more language features]:feature:_scala_features"
|
||||
"-no-specialization[Ignore @specialize annotations]"
|
||||
"-nobootcp[Do not use the boot classpath for the scala jars]"
|
||||
"-nowarn[Generate no warnings]"
|
||||
"-optimise[Generate faster bytecode by applying optimisations to the program]"
|
||||
"-P\:-[Pass an option to a plugin (written plugin\:opt)]:plugin option:"
|
||||
"-print[Print program with Scala-specific features removed]"
|
||||
"-sourcepath+[Specify location(s) of source files]:source file directory:_files -/"
|
||||
"-target\:-[Target platform for object files (default\: jvm-1.5)]:platform name:(jvm-1.5 msil)"
|
||||
"-toolcp+[Add to the runner classpath]:directory:_files -/"
|
||||
"-unchecked[Enable detailed unchecked (erasure) warnings]"
|
||||
"-uniqid[Uniquely tag all identifiers in debugging output]"
|
||||
"-usejavacp[Utilize the java.class.path in classpath resolution]"
|
||||
"-verbose[Output messages about what the compiler is doing]"
|
||||
"-version[Print product version and exit]"
|
||||
"-X[Print a synopsis of advanced options]"
|
||||
"-Y[Print a synopsis of private options]"
|
||||
)
|
||||
|
||||
local -a X_opts
|
||||
X_opts=(
|
||||
"-Xcheck-null[Warn upon selection of nullable reference]"
|
||||
"-Xcheckinit[Wrap field accessors to throw an exception on uninitialized access]"
|
||||
"-Xdisable-assertions[Generate no assertions or assumptions]"
|
||||
"-Xelide-below+[Calls to @elidable methods are omitted if method priority is lower than integer argument]"
|
||||
"-Xexperimental[Enable experimental extensions]"
|
||||
"-Xfatal-warnings[Fail the compilation if there are any warnings]"
|
||||
"-Xfull-lubs[Retains pre 2.10 behavior of less aggressive truncation of least upper bounds]"
|
||||
"-Xfuture[Turn on future language features]"
|
||||
"-Xgenerate-phase-graph+[Generate the phase graphs (outputs .dot files) to fileX.dot]:output file:_files"
|
||||
"-Xlint[Enable recommended additional warnings]"
|
||||
"-Xlog-free-terms[Print a message when reification creates a free term]"
|
||||
"-Xlog-free-types[Print a message when reification resorts to generating a free type]"
|
||||
"-Xlog-implicits[Show more detail on why some implicits are not applicable]"
|
||||
"-Xlog-implicit-conversions[Print a message whenever an implicit conversion is inserted]"
|
||||
"-Xlog-reflective-calls[Print a message when a reflective method call is generated]"
|
||||
"-Xmacro-settings\:-[Custom settings for macros]:option"
|
||||
"-Xmain-class+[Class for manifest's Main-Class entry (only useful with -d jar)]:path:"
|
||||
"-Xmax-classfile-name+[Maximum filename length for generated classes]"
|
||||
"-Xmigration[Warn about constructs whose behavior may have changed]"
|
||||
"-Xno-forwarders[Do not generate static forwarders in mirror classes]"
|
||||
"-Xno-patmat-analysis[Don't perform exhaustivity/unreachability analysis. Also, ignore @switch annotation]"
|
||||
"-Xno-uescape[Disable handling of \u unicode escapes]"
|
||||
"-Xnojline[Do not use JLine for editing]"
|
||||
"-Xoldpatmat[Use the pre-2.10 pattern matcher. Otherwise, the 'virtualizing' pattern matcher is used in 2.10]"
|
||||
"-Xprint\:-[Print out program after <phase>]:phase name:_scala_phases"
|
||||
"-Xprint-icode\:-[Log internal icode to *.icode files after phase (default\: icode)]:phase name:_scala_phases"
|
||||
"-Xprint-pos[Print tree positions, as offsets]"
|
||||
"-Xprint-types[Print tree types (debugging option)]"
|
||||
"-Xprompt[Display a prompt after each error (debugging option)]"
|
||||
"-Xresident[Compiler stays resident: read source filenames from standard input]"
|
||||
"-Xscript+[Treat the source file as a script and wrap it in a main method]:main object name"
|
||||
"-Xshow-class+[Show internal representation of class]:class name"
|
||||
"-Xshow-object+[Show internal representation of object]:object name"
|
||||
"-Xshow-phases[Print a synopsis of compiler phases]"
|
||||
"-Xsource-reader+[Specify a class name for a custom method of reading source files]:class name"
|
||||
"-Xverify[Verify generic signatures in generated bytecode]"
|
||||
|
||||
"-Xassem-extdirs+[List of directories containing assemblies (requires -target:msil) (default\: lib)]:assembly directory:_files -/"
|
||||
"-Xassem-name+[Name of the output assembly (requires -target:msil)]:assembly name:_files"
|
||||
"-Xassem-path+[List of assemblies referenced by the program (requires -target:msil)]:assembly path:_files"
|
||||
"-Xsourcedir+[Mirror source folder structure in output directory (requires -target:msil)]:source directory:_files -/"
|
||||
|
||||
"-Xplugin\:-[Load one or more plugins from file]:plugin file:_files"
|
||||
"-Xpluginsdir+[Path to search compiler plugins]:plugin directory:_files -/"
|
||||
"-Xplugin-list[Print a synopsis of loaded plugins]"
|
||||
"-Xplugin-disable\:-[Disable the given plugin(s)]"
|
||||
"-Xplugin-require\:-[Abort unless the given plugin(s) are available]"
|
||||
)
|
||||
|
||||
local -a Y_opts
|
||||
Y_opts=(
|
||||
"-Y[Print a synopsis of private options]"
|
||||
"-Ybuild-manager-debug[Generate debug information for the Refined Build Manager compiler]"
|
||||
"-Ybuilder-debug\:-[Compile using the specified build manager (default\: none)]:build manager:(none refined simple)"
|
||||
"-Yclosure-elim[Perform closure elimination]"
|
||||
"-Ycompact-trees[Use compact tree printer when displaying trees]"
|
||||
"-Ydead-code[Perform dead code elimination]"
|
||||
"-Ydependent-method-types[Allow dependent method types]"
|
||||
"-Ydump-classes+[Dump the generated bytecode to .class files (useful for reflective compilation that utilizes in-memory classloaders)]:output directory:_files -/"
|
||||
"-Yeta-expand-keeps-star[Eta-expand varargs methods to T* rather than Seq[T]. This is a temporary option to ease transition.]"
|
||||
"-Ygen-javap+[Generate a parallel output directory of .javap files]:output directory:_files -/"
|
||||
"-Yinfer-argument-types[Infer types for arguments of overriden methods]"
|
||||
"-Yinline[Perform inlining when possible]"
|
||||
"-Yinline-handlers[Perform exception handler inlining when possible]"
|
||||
"-Yinline-warnings[Emit inlining warnings (normally surpressed due to high volume)]"
|
||||
"-Yinvalidate+[Invalidate classpath entry before run]:classpath entry"
|
||||
"-Ylinearizer\:-[Linearizer to use (default\: rpo)]:linearizer:(normal dfs rpo dump)"
|
||||
"-Ylog-classpath[Output information about what classpath is being applied]"
|
||||
"-Yno-adapted-args[Do not adapt an argument list (either by inserting unit or creating a tuple) to match the receiver]"
|
||||
"-Ymacro-debug-lite[Trace essential macro-related activities]"
|
||||
"-Ymacro-debug-verbose[Trace all macro-related activities: compilation, generation of synthetics, classloading, expansion, exceptions]"
|
||||
"-Yno-completion[Disable tab-completion in the REPL]"
|
||||
"-Yno-generic-signatures[Suppress generation of generic signatures for Java]"
|
||||
"-Yno-imports[Compile without any implicit imports]"
|
||||
"-Yno-predef[Compile without importing Predef]"
|
||||
"-Yno-self-type-checks[Suppress check for self-type conformance among inherited members]"
|
||||
"-Yno-squeeze[Disable creation of compact code in matching]"
|
||||
"-Ynotnull[Enable (experimental and incomplete) scala.NotNull]"
|
||||
"-Yoverride-objects[Allow member objects to be overridden]"
|
||||
"-Yoverride-vars[Allow vars to be overridden]"
|
||||
"-Ypmat-naive[Desugar matches as naively as possible]"
|
||||
"-Ypresentation-delay+[Wait number of ms after typing before starting typechecking]"
|
||||
"-Ypresentation-log+[Log presentation compiler events into file]:log file:_files"
|
||||
"-Ypresentation-replay+[Replay presentation compiler events from file]:log file:_files"
|
||||
"-Ypresentation-strict[Do not report type errors in sources with syntax errors]"
|
||||
"-Ypresentation-verbose[Print information about presentation compiler tasks]"
|
||||
"-Yprofile-class+[Specify name of profiler class]:profiler class name"
|
||||
"-Yprofile-memory[Heap snapshot after compiler run (requires jgpagent on JVM -agentpath)]"
|
||||
"-Yrangepos[Use range positions for syntax trees]"
|
||||
"-Yrecursion+[Set recursion depth used when locking symbols]"
|
||||
"-Yreify-copypaste[Dump the reified trees in copypasteable representation]"
|
||||
"-Yrepl-sync[Do not use asynchronous code for REPL startup]"
|
||||
"-Yresolve-term-conflict\:-[Resolve term conflicts (default\: error)]:resolution strategy:(package object error)"
|
||||
"-Yself-in-annots[Include a \"self\" identifier inside of annotations]"
|
||||
"-Yshow\:-[Show after <phase> (requires -Xshow-class or -Xshow-object)]:phase name:_scala_phases"
|
||||
"-Yshow-syms[Print the AST symbol hierarchy after each phase]"
|
||||
"-Yshow-symkinds[Print abbreviated symbol kinds next to symbol names]"
|
||||
"-Yshow-trees[Print detailed ASTs (requires -Xprint\:phase)]"
|
||||
"-Yshow-trees-compact[Print detailed ASTs in compact form (requires -Xprint\:)]"
|
||||
"-Yshow-trees-stringified[Print stringifications along with detailed ASTs (requires -Xprint\:)]"
|
||||
"-Ystatistics[Print compiler statistics]"
|
||||
"-Ystruct-dispatch\:-[Structural method dispatch policy (default\: poly-cache)]:policy name:(no-cache mono-cache poly-cache invoke-dynamic)"
|
||||
|
||||
"-Ybrowse\:-[Browse the abstract syntax tree after <phase>]:phase name:_scala_phases"
|
||||
"-Ycheck\:-[Check the tree at the end of <phase>]:phase name:_scala_phases"
|
||||
"-Ylog\:-[Log operations during <phase>]:phase name:_scala_phases"
|
||||
"-Yprofile\:-[Profile CPU usage of given phases (requires jgpagent on JVM -agentpath)]:phase name:_scala_phases"
|
||||
"-Yskip\:-[Skip <phase>]:phase name:_scala_phases"
|
||||
"-Ystop-after\:-[Stop after given phase <phase>]:phase name:_scala_phases"
|
||||
"-Ystop-before\:-[Stop before given phase <phase>]:phase name:_scala_phases"
|
||||
|
||||
"-Ywarn-adapted-args[Warn if an argument list is modified to match the receiver]"
|
||||
"-Ywarn-all[Enable all -Y warnings]"
|
||||
"-Ywarn-dead-code[Warn when dead code is identified]"
|
||||
"-Ywarn-inaccessible[Warn about inaccessible types in method signatures]"
|
||||
"-Ywarn-nullary-override[Warn when non-nullary overrides nullary, e.g. def foo() over def foo]"
|
||||
"-Ywarn-nullary-unit[Warn when nullary methods return Unit]"
|
||||
"-Ywarn-numeric-widen[Warn when numerics are widened]"
|
||||
"-Ywarn-value-discard[Warn when non-Unit expression results are unused]"
|
||||
|
||||
"-Ybuild-manager-debug[Generate debug information for the Refined Build Manager compiler]"
|
||||
"-Ybuilder-debug\:-[Compile using the specified build manager (default\: none)]:manager:(none refined simple)"
|
||||
"-Ycompletion-debug[Trace all tab completion activity]"
|
||||
"-Ydebug[Increase the quantity of debugging output]"
|
||||
"-Ydoc-debug[Trace all scaladoc activity]"
|
||||
"-Yide-debug[Generate, validate and output trees using the interactive compiler]"
|
||||
"-Yinfer-debug[Trace type inference and implicit search]"
|
||||
"-Yissue-debug[Print stack traces when a context issues an error]"
|
||||
"-Ypatmat-debug[Trace pattern matching translation]"
|
||||
"-Ypmat-debug[Trace all pattern matcher activity]"
|
||||
"-Ypos-debug[Trace position validation]"
|
||||
"-Ypresentation-debug[Enable debugging output for the presentation compiler]"
|
||||
"-Yreify-debug[Trace reification]"
|
||||
"-Yrepl-debug[Trace all REPL activity]"
|
||||
"-Ytyper-debug[Trace all type assignments]"
|
||||
)
|
||||
|
||||
local -a scala_opts
|
||||
scala_opts=(
|
||||
"-e+[execute <string> as if entered in the repl]:string" \
|
||||
"-howtorun+[what to run (default\: guess)]:execution mode:(script object jar guess)" \
|
||||
"-i+[preload <file> before starting the repl]:file to preload:_files" \
|
||||
"-nc[no compilation daemon\: do not use the fsc offline compiler]" \
|
||||
"-save[save the compiled script in a jar for future use]"
|
||||
)
|
||||
|
||||
case $words[$CURRENT] in
|
||||
-X*) _arguments $X_opts;;
|
||||
-Y*) _arguments $Y_opts;;
|
||||
*) case $service in
|
||||
scala) _arguments $scala_opts $shared_opts "*::filename:_files";;
|
||||
scalac) _arguments $shared_opts "*::filename:_files";;
|
||||
esac
|
||||
esac
|
||||
|
||||
return 0
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# if using GNU screen, let the zsh tell screen what the title and hardstatus
|
||||
# of the tab window should be.
|
||||
if [[ $TERM == "screen" ]]; then
|
||||
if [[ "$TERM" == screen* ]]; then
|
||||
if [[ $_GET_PATH == '' ]]; then
|
||||
_GET_PATH='echo $PWD | sed "s/^\/Users\//~/;s/^\/home\//~/;s/^~$USER/~/"'
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -57,8 +57,6 @@ sprunge() {
|
|||
fi
|
||||
else
|
||||
echo Using input from a pipe or STDIN redirection... >&2
|
||||
while read -r line ; do
|
||||
echo $line
|
||||
done | curl -F 'sprunge=<-' http://sprunge.us
|
||||
curl -F 'sprunge=<-' http://sprunge.us
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,11 +6,17 @@
|
|||
#
|
||||
# zstyle :omz:plugins:ssh-agent agent-forwarding on
|
||||
#
|
||||
# To load multiple identies use the identities style, For
|
||||
# To load multiple identities use the identities style, For
|
||||
# example:
|
||||
#
|
||||
# zstyle :omz:plugins:ssh-agent id_rsa id_rsa2 id_github
|
||||
#
|
||||
# To set the maximum lifetime of the identities, use the
|
||||
# lifetime style. The lifetime may be specified in seconds
|
||||
# or as described in sshd_config(5) (see TIME FORMATS)
|
||||
# If left unspecified, the default lifetime is forever.
|
||||
#
|
||||
# zstyle :omz:plugins:ssh-agent lifetime 4h
|
||||
#
|
||||
# CREDITS
|
||||
#
|
||||
|
|
@ -27,15 +33,18 @@ local _plugin__forwarding
|
|||
function _plugin__start_agent()
|
||||
{
|
||||
local -a identities
|
||||
local lifetime
|
||||
zstyle -s :omz:plugins:ssh-agent lifetime lifetime
|
||||
|
||||
# start ssh-agent and setup environment
|
||||
/usr/bin/env ssh-agent | sed 's/^echo/#echo/' > ${_plugin__ssh_env}
|
||||
/usr/bin/env ssh-agent ${lifetime:+-t} ${lifetime} | sed 's/^echo/#echo/' > ${_plugin__ssh_env}
|
||||
chmod 600 ${_plugin__ssh_env}
|
||||
. ${_plugin__ssh_env} > /dev/null
|
||||
|
||||
# load identies
|
||||
zstyle -a :omz:plugins:ssh-agent identities identities
|
||||
echo starting...
|
||||
echo starting ssh-agent...
|
||||
|
||||
/usr/bin/ssh-add $HOME/.ssh/${^identities}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,30 @@
|
|||
# Sublime Text 2 Aliases
|
||||
#unamestr = 'uname'
|
||||
|
||||
local _sublime_darwin_paths > /dev/null 2>&1
|
||||
_sublime_darwin_paths=(
|
||||
"/usr/local/bin/subl"
|
||||
"$HOME/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
|
||||
"$HOME/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
|
||||
"/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
|
||||
"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
|
||||
)
|
||||
|
||||
if [[ $('uname') == 'Linux' ]]; then
|
||||
alias st='/usr/bin/sublime_text&'
|
||||
if [ -f '/usr/bin/sublime_text' ]; then
|
||||
st_run() { nohup /usr/bin/sublime_text $@ > /dev/null & }
|
||||
else
|
||||
st_run() { nohup /usr/bin/sublime-text $@ > /dev/null & }
|
||||
fi
|
||||
alias st=st_run
|
||||
|
||||
elif [[ $('uname') == 'Darwin' ]]; then
|
||||
alias st='/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl'
|
||||
|
||||
for _sublime_path in $_sublime_darwin_paths; do
|
||||
if [[ -a $_sublime_path ]]; then
|
||||
alias st="'$_sublime_path'"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
alias stt='st .'
|
||||
|
|
|
|||
|
|
@ -1,42 +1,76 @@
|
|||
function svn_prompt_info {
|
||||
if [ $(in_svn) ]; then
|
||||
echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\
|
||||
$ZSH_THEME_REPO_NAME_COLOR$(svn_get_repo_name)$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$ZSH_PROMPT_BASE_COLOR"
|
||||
# vim:ft=zsh ts=2 sw=2 sts=2
|
||||
#
|
||||
function svn_prompt_info() {
|
||||
if in_svn; then
|
||||
if [ "x$SVN_SHOW_BRANCH" = "xtrue" ]; then
|
||||
unset SVN_SHOW_BRANCH
|
||||
_DISPLAY=$(svn_get_branch_name)
|
||||
else
|
||||
_DISPLAY=$(svn_get_repo_name)
|
||||
fi
|
||||
echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\
|
||||
$ZSH_THEME_REPO_NAME_COLOR$_DISPLAY$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$ZSH_PROMPT_BASE_COLOR"
|
||||
unset _DISPLAY
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function in_svn() {
|
||||
if [[ -d .svn ]]; then
|
||||
echo 1
|
||||
fi
|
||||
if $(svn info >/dev/null 2>&1); then
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
function svn_get_repo_name {
|
||||
if [ $(in_svn) ]; then
|
||||
svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT
|
||||
|
||||
svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p"
|
||||
fi
|
||||
function svn_get_repo_name() {
|
||||
if in_svn; then
|
||||
svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT
|
||||
svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p"
|
||||
fi
|
||||
}
|
||||
|
||||
function svn_get_rev_nr {
|
||||
if [ $(in_svn) ]; then
|
||||
svn info 2> /dev/null | sed -n s/Revision:\ //p
|
||||
fi
|
||||
function svn_get_branch_name() {
|
||||
_DISPLAY=$(
|
||||
svn info 2> /dev/null | \
|
||||
awk -F/ \
|
||||
'/^URL:/ { \
|
||||
for (i=0; i<=NF; i++) { \
|
||||
if ($i == "branches" || $i == "tags" ) { \
|
||||
print $(i+1); \
|
||||
break;\
|
||||
}; \
|
||||
if ($i == "trunk") { print $i; break; } \
|
||||
} \
|
||||
}'
|
||||
)
|
||||
|
||||
if [ "x$_DISPLAY" = "x" ]; then
|
||||
svn_get_repo_name
|
||||
else
|
||||
echo $_DISPLAY
|
||||
fi
|
||||
unset _DISPLAY
|
||||
}
|
||||
|
||||
function svn_dirty_choose {
|
||||
if [ $(in_svn) ]; then
|
||||
s=$(svn status|grep -E '^\s*[ACDIM!?L]' 2>/dev/null)
|
||||
if [ $s ]; then
|
||||
echo $1
|
||||
else
|
||||
echo $2
|
||||
fi
|
||||
fi
|
||||
function svn_get_rev_nr() {
|
||||
if in_svn; then
|
||||
svn info 2> /dev/null | sed -n 's/Revision:\ //p'
|
||||
fi
|
||||
}
|
||||
|
||||
function svn_dirty {
|
||||
svn_dirty_choose $ZSH_THEME_SVN_PROMPT_DIRTY $ZSH_THEME_SVN_PROMPT_CLEAN
|
||||
function svn_dirty_choose() {
|
||||
if in_svn; then
|
||||
root=`svn info 2> /dev/null | sed -n 's/^Working Copy Root Path: //p'`
|
||||
if $(svn status $root 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]'); then
|
||||
# Grep exits with 0 when "One or more lines were selected", return "dirty".
|
||||
echo $1
|
||||
else
|
||||
# Otherwise, no lines were found, or an error occurred. Return clean.
|
||||
echo $2
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function svn_dirty() {
|
||||
svn_dirty_choose $ZSH_THEME_SVN_PROMPT_DIRTY $ZSH_THEME_SVN_PROMPT_CLEAN
|
||||
}
|
||||
|
|
|
|||
13
plugins/symfony/symfony.plugin.zsh
Normal file
13
plugins/symfony/symfony.plugin.zsh
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# symfony basic command completion
|
||||
|
||||
_symfony_get_command_list () {
|
||||
./symfony | sed "1,/Available tasks/d" | awk 'BEGIN { cat=null; } /^[A-Za-z]+$/ { cat = $1; } /^ :[a-z]+/ { print cat $1; }'
|
||||
}
|
||||
|
||||
_symfony () {
|
||||
if [ -f symfony ]; then
|
||||
compadd `_symfony_get_command_list`
|
||||
fi
|
||||
}
|
||||
|
||||
compdef _symfony symfony
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
# Symfony2 basic command completion
|
||||
|
||||
_symfony2_get_command_list () {
|
||||
app/console --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }'
|
||||
php app/console --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }'
|
||||
}
|
||||
|
||||
_symfony2 () {
|
||||
|
|
@ -11,7 +11,11 @@ _symfony2 () {
|
|||
}
|
||||
|
||||
compdef _symfony2 app/console
|
||||
compdef _symfony2 sf
|
||||
|
||||
#Alias
|
||||
alias sf2='php app/console'
|
||||
alias sf2clear='php app/console cache:clear'
|
||||
alias sf='php app/console'
|
||||
alias sfcl='php app/console cache:clear'
|
||||
alias sfroute='php app/console router:debug'
|
||||
alias sfgb='php app/console generate:bundle'
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue