1
0
mirror of https://github.com/zplug/zplug synced 2024-09-28 06:59:42 +02:00
zplug/misc/zshrc
2016-08-07 17:34:29 +09:00

245 lines
3.9 KiB
Bash

#!/usr/bin/env zsh
# Prepare
tests=()
export ZPLUG_HOME="/tmp/zplug-$RANDOM"
export ZPLUG_REPOS="$ZPLUG_HOME/repos"
mkdir -p "$ZPLUG_HOME" "$ZPLUG_REPOS"
# Prepare
source "$ZPLUG_ROOT/init.zsh"
zplugs=()
zplug clear
# as
{
# plugin
zplug "tcnksm/docker-alias", \
use:zshrc
# command
zplug "Jxck/dotfiles", \
as:command, \
use:"bin/{histuniq,color}"
tests+=(
'(( $+aliases[dl] ))'
'[[ -x $ZPLUG_HOME/bin/histuniq ]]'
'[[ -x $ZPLUG_HOME/bin/color ]]'
)
}
# at
{
# branch
zplug "b4b4r07/enhancd", \
at:v1, \
use:"*.sh"
# commit
zplug "mollifier/anyframe", \
at:4c23cb60
tests+=(
'(( $+functions[enhancd_cd] ))'
'(( $+functions[anyframe-init] ))'
)
}
# from
{
# github
zplug "zsh-users/zsh-history-substring-search", \
from:github, \
as:plugin
zplug "mrowa44/emojify", \
from:github, \
as:command
# bitbucket
zplug "b4b4r07/hello_bitbucket", \
from:bitbucket, \
as:command, \
hook-build:"chmod 755 *.sh", \
use:"*.sh"
# oh-my-zsh
zplug "plugins/git", \
from:oh-my-zsh
zplug "plugins/cp", \
from:oh-my-zsh
zplug "plugins/emoji", \
from:oh-my-zsh
# gh-r
zplug "junegunn/fzf-bin", \
as:command, \
from:gh-r, \
rename-to:fzf, \
use:"*darwin*amd64*"
# gist
zplug "b4b4r07/79ee61f7c140c63d2786", \
from:gist, \
as:command, \
use:get_last_pane_path.sh
# local
## skip
tests+=(
'(( $+functions[_zsh_highlight_bind_widgets] ))'
'[[ -x $ZPLUG_HOME/bin/emojify ]]'
'[[ -x $ZPLUG_HOME/bin/hello.sh ]]'
'(( $+aliases[gba] ))'
'(( $+aliases[cpv] ))'
'(( $+functions[random_emoji] ))'
'[[ -x $ZPLUG_HOME/bin/fzf ]]'
'[[ -x $ZPLUG_HOME/bin/get_last_pane_path.sh ]]'
)
}
# depth
{
zplug "willghatch/zsh-cdr", \
depth:1
}
# dir
{
: 'SKIP' 'TODO'
}
# frozen
{
: 'SKIP'
}
# hook-build
{
# Duplicates
zplug "b4b4r07/hello_bitbucket", \
from:bitbucket, \
as:command, \
hook-build:"chmod 755 *.sh", \
use:"*.sh"
tests+=(
'[[ -x $ZPLUG_HOME/bin/hello.sh ]]'
)
}
# hook-load
{
:
}
# if
{
zplug "tj/n", \
as:command, \
use:"bin/n", \
if:'(( $+commands[node] ))'
tests+=(
'[[ -x $ZPLUG_HOME/bin/n ]]'
)
}
# ignore
{
zplug "zsh-users/zaw", \
ignore:"zaw-launcher.zsh"
tests+=(
'(( ! $+functions[zle-line-init] ))'
)
}
# lazy
{
zplug "mollifier/zload", \
lazy:true, \
use:"zload"
tests+=(
'(( $+functions[zload] ))'
)
}
# nice
{
zplug "zsh-users/zsh-syntax-highlighting", \
nice:19
tests+=(
'(( $+functions[_zsh_highlight] ))'
)
}
# on
{
zplug "b4b4r07/zsh-gomi", \
as:command, \
use:"bin/gomi", \
on:"peco/peco"
tests+=(
'[[ ! -x $ZPLUG_HOME/bin/gomi ]]'
)
}
# rename-to
{
zplug "stedolan/jq", \
from:gh-r, \
as:command, \
rename-to:jq
tests+=(
'[[ -x $ZPLUG_HOME/bin/jq ]]'
)
}
# use
{
zplug "b4b4r07/http_code", \
as:command, \
use:"bin"
zplug "monochromegane/the_platinum_searcher", \
as:command, \
from:gh-r, \
rename-to:pt, \
use:"*${(L)$(uname -s)}*amd64*"
}
zplug install || exit 1
zplug load --verbose || exit 1
# on (test case)
{
local -i line=0
local -A tags
tags[dir]="$(
__zplug::core::core::run_interfaces \
'dir' \
'willghatch/zsh-cdr'
)"
line="$(
git \
--git-dir="$tags[dir]/.git" \
--work-tree="$tags[dir]" \
rev-list --count HEAD
)"
tests+=(
"[[ $line -eq 1 ]]"
)
}
ret=0
for test in "$tests[@]"
do
eval "$test"
if (( $status != 0 )); then
printf "$fg[red]FAIL: $test$reset_color\n" >&2
ret=1
fi
done
exit $ret