File: zshrc

package info (click to toggle)
zplug 2.4.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,068 kB
  • sloc: sh: 1,504; awk: 235; makefile: 26
file content (267 lines) | stat: -rw-r--r-- 4,826 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
#!/usr/bin/env zsh
# vim: ft=zplug

# 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}"
    # theme
    zplug "S1cK94/minimal", \
        as:theme

    tests+=(
    '(( $+aliases[dl] ))'
    '[[ -x $ZPLUG_HOME/bin/histuniq ]]'
    '[[ -x $ZPLUG_HOME/bin/color ]]'
    '[[ -n $RPROMPT ]]'
    )
}

# 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/emoji", from:oh-my-zsh
    zplug "plugins/git", from:oh-my-zsh
    zplug "plugins/cp", from:oh-my-zsh
    # prezto
    zplug "modules/git", from:prezto
    zplug "modules/directory", from:prezto
    # gh-r
    zplug "junegunn/fzf-bin", \
        as:command, \
        from:gh-r, \
        rename-to:f
    # 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] ))'
    '(( $+functions[cpv] ))'
    '(( $+functions[random_emoji] ))'
    '(( $+aliases[gbS] ))'        # "prezto" modules/git
    '(( $+functions[git-dir] ))'  # "prezto" modules/git
    '[[ -o autocd ]]'             # "prezto" modules/directory
    '[[ -x $ZPLUG_HOME/bin/f ]]'
    '[[ ! -x $ZPLUG_HOME/bin/peco ]]' # for b4b4r07/zsh-gomi (on tag)
    '[[ -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"

    # SKIP
    # tests+=(
    # '(( ! $+functions[zle-line-init] ))'
    # )
}

# lazy
{
    zplug "mollifier/zload", \
        lazy:true, \
        use:"zload"

    tests+=(
    '(( $+functions[zload] ))'
    )
}

# defer
{
    zplug "zsh-users/zsh-syntax-highlighting", \
        defer:2

    tests+=(
    '(( $+functions[_zsh_highlight] ))'
    )
}

# on
{
    zplug "b4b4r07/zsh-gomi", \
        as:command, \
        use:"bin/gomi", \
        on:"peco/peco"

    # It should not be installed without 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/http_code"
    zplug "monochromegane/the_platinum_searcher", \
        as:command, \
        from:gh-r, \
        rename-to:pt, \
        use:"*${(L)$(uname -s)}*amd64*"
    zplug 'junegunn/fzf', \
        as:command, \
        use:'bin/{fzf,fzf-tmux}'

    tests+=(
    '[[ -x $ZPLUG_HOME/bin/http_code ]]'
    '[[ -x $ZPLUG_HOME/bin/pt ]]'
    '[[ ! -x $ZPLUG_HOME/bin/fzf ]]'
    '[[ -x $ZPLUG_HOME/bin/fzf-tmux ]]'
    )
}

zplug install || ret=1
zplug load --verbose || ret=1

# on (test case)

# SKIP
# this need to be tested after installation
#{
#    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