@andespindola/crow-term-linux-x64 0.0.0-bootstrap.1 → 0.1.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +55 -0
- package/NOTICE.md +25 -0
- package/README.md +5 -0
- package/THIRD_PARTY_LICENSES.txt +71128 -0
- package/assets/fonts/OFL.txt +96 -0
- package/assets/theme-license.txt +21 -0
- package/bin/crow-term +4 -0
- package/bin/shell/README.md +37 -0
- package/bin/shell/plugins.lock.json +63 -0
- package/bin/shell/setup.py +241 -0
- package/bin/shell/vendor/fisher/LICENSE.md +7 -0
- package/bin/shell/vendor/fisher/completions/fisher.fish +7 -0
- package/bin/shell/vendor/fisher/functions/fisher.fish +251 -0
- package/bin/shell/vendor/z/LICENSE +21 -0
- package/bin/shell/vendor/z/conf.d/z.fish +63 -0
- package/bin/shell/vendor/z/functions/__z.fish +178 -0
- package/bin/shell/vendor/z/functions/__z_add.fish +49 -0
- package/bin/shell/vendor/z/functions/__z_clean.fish +11 -0
- package/bin/shell/vendor/z/functions/__z_complete.fish +13 -0
- package/bin/shell/vendor/zsh-autosuggestions/LICENSE +23 -0
- package/bin/shell/vendor/zsh-autosuggestions/zsh-autosuggestions.zsh +867 -0
- package/bin/shell/vendor/zsh-syntax-highlighting/.revision-hash +1 -0
- package/bin/shell/vendor/zsh-syntax-highlighting/.version +1 -0
- package/bin/shell/vendor/zsh-syntax-highlighting/COPYING.md +23 -0
- package/bin/shell/vendor/zsh-syntax-highlighting/highlighters/brackets/brackets-highlighter.zsh +107 -0
- package/bin/shell/vendor/zsh-syntax-highlighting/highlighters/cursor/cursor-highlighter.zsh +47 -0
- package/bin/shell/vendor/zsh-syntax-highlighting/highlighters/line/line-highlighter.zsh +44 -0
- package/bin/shell/vendor/zsh-syntax-highlighting/highlighters/main/main-highlighter.zsh +1853 -0
- package/bin/shell/vendor/zsh-syntax-highlighting/highlighters/pattern/pattern-highlighter.zsh +60 -0
- package/bin/shell/vendor/zsh-syntax-highlighting/highlighters/regexp/regexp-highlighter.zsh +62 -0
- package/bin/shell/vendor/zsh-syntax-highlighting/highlighters/root/root-highlighter.zsh +44 -0
- package/bin/shell/vendor/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +587 -0
- package/package.json +35 -1
|
@@ -0,0 +1,587 @@
|
|
|
1
|
+
# -------------------------------------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) 2010-2020 zsh-syntax-highlighting contributors
|
|
3
|
+
# All rights reserved.
|
|
4
|
+
#
|
|
5
|
+
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
|
6
|
+
# provided that the following conditions are met:
|
|
7
|
+
#
|
|
8
|
+
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
|
9
|
+
# and the following disclaimer.
|
|
10
|
+
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
|
11
|
+
# conditions and the following disclaimer in the documentation and/or other materials provided
|
|
12
|
+
# with the distribution.
|
|
13
|
+
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
|
14
|
+
# may be used to endorse or promote products derived from this software without specific prior
|
|
15
|
+
# written permission.
|
|
16
|
+
#
|
|
17
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
|
18
|
+
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
20
|
+
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
21
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
22
|
+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
|
23
|
+
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
|
24
|
+
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
25
|
+
# -------------------------------------------------------------------------------------------------
|
|
26
|
+
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
|
27
|
+
# vim: ft=zsh sw=2 ts=2 et
|
|
28
|
+
# -------------------------------------------------------------------------------------------------
|
|
29
|
+
|
|
30
|
+
# First of all, ensure predictable parsing.
|
|
31
|
+
typeset zsh_highlight__aliases="$(builtin alias -Lm '[^+]*')"
|
|
32
|
+
# In zsh <= 5.2, aliases that begin with a plus sign ('alias -- +foo=42')
|
|
33
|
+
# are emitted by `alias -L` without a '--' guard, so they don't round trip.
|
|
34
|
+
#
|
|
35
|
+
# Hence, we exclude them from unaliasing:
|
|
36
|
+
builtin unalias -m '[^+]*'
|
|
37
|
+
|
|
38
|
+
# Set $0 to the expected value, regardless of functionargzero.
|
|
39
|
+
0=${(%):-%N}
|
|
40
|
+
if true; then
|
|
41
|
+
# $0 is reliable
|
|
42
|
+
typeset -g ZSH_HIGHLIGHT_VERSION=$(<"${0:A:h}"/.version)
|
|
43
|
+
typeset -g ZSH_HIGHLIGHT_REVISION=$(<"${0:A:h}"/.revision-hash)
|
|
44
|
+
if [[ $ZSH_HIGHLIGHT_REVISION == \$Format:* ]]; then
|
|
45
|
+
# When running from a source tree without 'make install', $ZSH_HIGHLIGHT_REVISION
|
|
46
|
+
# would be set to '$Format:%H$' literally. That's an invalid value, and obtaining
|
|
47
|
+
# the valid value (via `git rev-parse HEAD`, as Makefile does) might be costly, so:
|
|
48
|
+
ZSH_HIGHLIGHT_REVISION=HEAD
|
|
49
|
+
fi
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
# This function takes a single argument F and returns True iff F is an autoload stub.
|
|
53
|
+
_zsh_highlight__function_is_autoload_stub_p() {
|
|
54
|
+
if zmodload -e zsh/parameter; then
|
|
55
|
+
#(( ${+functions[$1]} )) &&
|
|
56
|
+
[[ "$functions[$1]" == *"builtin autoload -X"* ]]
|
|
57
|
+
else
|
|
58
|
+
#[[ $(type -wa -- "$1") == *'function'* ]] &&
|
|
59
|
+
[[ "${${(@f)"$(which -- "$1")"}[2]}" == $'\t'$histchars[3]' undefined' ]]
|
|
60
|
+
fi
|
|
61
|
+
# Do nothing here: return the exit code of the if.
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
# Return True iff the argument denotes a function name.
|
|
65
|
+
_zsh_highlight__is_function_p() {
|
|
66
|
+
if zmodload -e zsh/parameter; then
|
|
67
|
+
(( ${+functions[$1]} ))
|
|
68
|
+
else
|
|
69
|
+
[[ $(type -wa -- "$1") == *'function'* ]]
|
|
70
|
+
fi
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
# This function takes a single argument F and returns True iff F denotes the
|
|
74
|
+
# name of a callable function. A function is callable if it is fully defined
|
|
75
|
+
# or if it is marked for autoloading and autoloading it at the first call to it
|
|
76
|
+
# will succeed. In particular, if F has been marked for autoloading
|
|
77
|
+
# but is not available in $fpath, then calling this function on F will return False.
|
|
78
|
+
#
|
|
79
|
+
# See users/21671 https://www.zsh.org/cgi-bin/mla/redirect?USERNUMBER=21671
|
|
80
|
+
_zsh_highlight__function_callable_p() {
|
|
81
|
+
if _zsh_highlight__is_function_p "$1" &&
|
|
82
|
+
! _zsh_highlight__function_is_autoload_stub_p "$1"
|
|
83
|
+
then
|
|
84
|
+
# Already fully loaded.
|
|
85
|
+
return 0 # true
|
|
86
|
+
else
|
|
87
|
+
# "$1" is either an autoload stub, or not a function at all.
|
|
88
|
+
#
|
|
89
|
+
# Use a subshell to avoid affecting the calling shell.
|
|
90
|
+
#
|
|
91
|
+
# We expect 'autoload +X' to return non-zero if it fails to fully load
|
|
92
|
+
# the function.
|
|
93
|
+
( autoload -U +X -- "$1" 2>/dev/null )
|
|
94
|
+
return $?
|
|
95
|
+
fi
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
# -------------------------------------------------------------------------------------------------
|
|
99
|
+
# Core highlighting update system
|
|
100
|
+
# -------------------------------------------------------------------------------------------------
|
|
101
|
+
|
|
102
|
+
# Use workaround for bug in ZSH?
|
|
103
|
+
# zsh-users/zsh@48cadf4 https://www.zsh.org/mla/workers/2017/msg00034.html
|
|
104
|
+
autoload -Uz is-at-least
|
|
105
|
+
if is-at-least 5.4; then
|
|
106
|
+
typeset -g zsh_highlight__pat_static_bug=false
|
|
107
|
+
else
|
|
108
|
+
typeset -g zsh_highlight__pat_static_bug=true
|
|
109
|
+
fi
|
|
110
|
+
|
|
111
|
+
# Array declaring active highlighters names.
|
|
112
|
+
typeset -ga ZSH_HIGHLIGHT_HIGHLIGHTERS
|
|
113
|
+
|
|
114
|
+
# Update ZLE buffer syntax highlighting.
|
|
115
|
+
#
|
|
116
|
+
# Invokes each highlighter that needs updating.
|
|
117
|
+
# This function is supposed to be called whenever the ZLE state changes.
|
|
118
|
+
_zsh_highlight()
|
|
119
|
+
{
|
|
120
|
+
# Store the previous command return code to restore it whatever happens.
|
|
121
|
+
local ret=$?
|
|
122
|
+
# Make it read-only. Can't combine this with the previous line when POSIX_BUILTINS may be set.
|
|
123
|
+
typeset -r ret
|
|
124
|
+
|
|
125
|
+
# $region_highlight should be predefined, either by zle or by the test suite's mock (non-special) array.
|
|
126
|
+
(( ${+region_highlight[@]} )) || {
|
|
127
|
+
echo >&2 'zsh-syntax-highlighting: error: $region_highlight is not defined'
|
|
128
|
+
echo >&2 'zsh-syntax-highlighting: (Check whether zsh-syntax-highlighting was installed according to the instructions.)'
|
|
129
|
+
return $ret
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
# Probe the memo= feature, once.
|
|
133
|
+
(( ${+zsh_highlight__memo_feature} )) || {
|
|
134
|
+
region_highlight+=( " 0 0 fg=red, memo=zsh-syntax-highlighting" )
|
|
135
|
+
case ${region_highlight[-1]} in
|
|
136
|
+
("0 0 fg=red")
|
|
137
|
+
# zsh 5.8 or earlier
|
|
138
|
+
integer -gr zsh_highlight__memo_feature=0
|
|
139
|
+
;;
|
|
140
|
+
("0 0 fg=red memo=zsh-syntax-highlighting")
|
|
141
|
+
# zsh 5.9 or later
|
|
142
|
+
integer -gr zsh_highlight__memo_feature=1
|
|
143
|
+
;;
|
|
144
|
+
(" 0 0 fg=red, memo=zsh-syntax-highlighting") ;&
|
|
145
|
+
(*)
|
|
146
|
+
# We can get here in two ways:
|
|
147
|
+
#
|
|
148
|
+
# 1. When not running as a widget. In that case, $region_highlight is
|
|
149
|
+
# not a special variable (= one with custom getter/setter functions
|
|
150
|
+
# written in C) but an ordinary one, so the third case pattern matches
|
|
151
|
+
# and we fall through to this block. (The test suite uses this codepath.)
|
|
152
|
+
#
|
|
153
|
+
# 2. When running under a future version of zsh that will have changed
|
|
154
|
+
# the serialization of $region_highlight elements from their underlying
|
|
155
|
+
# C structs, so that none of the previous case patterns will match.
|
|
156
|
+
#
|
|
157
|
+
# In either case, fall back to a version check.
|
|
158
|
+
if is-at-least 5.9; then
|
|
159
|
+
integer -gr zsh_highlight__memo_feature=1
|
|
160
|
+
else
|
|
161
|
+
integer -gr zsh_highlight__memo_feature=0
|
|
162
|
+
fi
|
|
163
|
+
;;
|
|
164
|
+
esac
|
|
165
|
+
region_highlight[-1]=()
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
# Reset region_highlight to build it from scratch
|
|
169
|
+
if (( zsh_highlight__memo_feature )); then
|
|
170
|
+
region_highlight=( "${(@)region_highlight:#*memo=zsh-syntax-highlighting*}" )
|
|
171
|
+
else
|
|
172
|
+
# Legacy codepath. Not very interoperable with other plugins (issue #418).
|
|
173
|
+
region_highlight=()
|
|
174
|
+
fi
|
|
175
|
+
|
|
176
|
+
# Remove all highlighting in isearch, so that only the underlining done by zsh itself remains.
|
|
177
|
+
# For details see FAQ entry 'Why does syntax highlighting not work while searching history?'.
|
|
178
|
+
# This disables highlighting during isearch (for reasons explained in README.md) unless zsh is new enough
|
|
179
|
+
# and doesn't have the pattern matching bug
|
|
180
|
+
if [[ $WIDGET == zle-isearch-update ]] && { $zsh_highlight__pat_static_bug || ! (( $+ISEARCHMATCH_ACTIVE )) }; then
|
|
181
|
+
return $ret
|
|
182
|
+
fi
|
|
183
|
+
|
|
184
|
+
# Before we 'emulate -L', save the user's options
|
|
185
|
+
local -A zsyh_user_options
|
|
186
|
+
if zmodload -e zsh/parameter; then
|
|
187
|
+
zsyh_user_options=("${(kv)options[@]}")
|
|
188
|
+
else
|
|
189
|
+
local canonical_options onoff option raw_options
|
|
190
|
+
raw_options=(${(f)"$(emulate -R zsh; set -o)"})
|
|
191
|
+
canonical_options=(${${${(M)raw_options:#*off}%% *}#no} ${${(M)raw_options:#*on}%% *})
|
|
192
|
+
for option in "${canonical_options[@]}"; do
|
|
193
|
+
[[ -o $option ]]
|
|
194
|
+
case $? in
|
|
195
|
+
(0) zsyh_user_options+=($option on);;
|
|
196
|
+
(1) zsyh_user_options+=($option off);;
|
|
197
|
+
(*) # Can't happen, surely?
|
|
198
|
+
echo "zsh-syntax-highlighting: warning: '[[ -o $option ]]' returned $?"
|
|
199
|
+
;;
|
|
200
|
+
esac
|
|
201
|
+
done
|
|
202
|
+
fi
|
|
203
|
+
typeset -r zsyh_user_options
|
|
204
|
+
|
|
205
|
+
emulate -L zsh
|
|
206
|
+
setopt localoptions warncreateglobal nobashrematch
|
|
207
|
+
local REPLY # don't leak $REPLY into global scope
|
|
208
|
+
|
|
209
|
+
# Do not highlight if there are more than 300 chars in the buffer. It's most
|
|
210
|
+
# likely a pasted command or a huge list of files in that case..
|
|
211
|
+
[[ -n ${ZSH_HIGHLIGHT_MAXLENGTH:-} ]] && [[ $#BUFFER -gt $ZSH_HIGHLIGHT_MAXLENGTH ]] && return $ret
|
|
212
|
+
|
|
213
|
+
# Do not highlight if there are pending inputs (copy/paste).
|
|
214
|
+
(( KEYS_QUEUED_COUNT > 0 )) && return $ret
|
|
215
|
+
(( PENDING > 0 )) && return $ret
|
|
216
|
+
|
|
217
|
+
{
|
|
218
|
+
local cache_place
|
|
219
|
+
local -a region_highlight_copy
|
|
220
|
+
|
|
221
|
+
# Select which highlighters in ZSH_HIGHLIGHT_HIGHLIGHTERS need to be invoked.
|
|
222
|
+
local highlighter; for highlighter in $ZSH_HIGHLIGHT_HIGHLIGHTERS; do
|
|
223
|
+
|
|
224
|
+
# eval cache place for current highlighter and prepare it
|
|
225
|
+
cache_place="_zsh_highlight__highlighter_${highlighter}_cache"
|
|
226
|
+
typeset -ga ${cache_place}
|
|
227
|
+
|
|
228
|
+
# If highlighter needs to be invoked
|
|
229
|
+
if ! type "_zsh_highlight_highlighter_${highlighter}_predicate" >&/dev/null; then
|
|
230
|
+
echo "zsh-syntax-highlighting: warning: disabling the ${(qq)highlighter} highlighter as it has not been loaded" >&2
|
|
231
|
+
# TODO: use ${(b)} rather than ${(q)} if supported
|
|
232
|
+
ZSH_HIGHLIGHT_HIGHLIGHTERS=( ${ZSH_HIGHLIGHT_HIGHLIGHTERS:#${highlighter}} )
|
|
233
|
+
elif "_zsh_highlight_highlighter_${highlighter}_predicate"; then
|
|
234
|
+
|
|
235
|
+
# save a copy, and cleanup region_highlight
|
|
236
|
+
region_highlight_copy=("${region_highlight[@]}")
|
|
237
|
+
region_highlight=()
|
|
238
|
+
|
|
239
|
+
# Execute highlighter and save result
|
|
240
|
+
{
|
|
241
|
+
"_zsh_highlight_highlighter_${highlighter}_paint"
|
|
242
|
+
} always {
|
|
243
|
+
: ${(AP)cache_place::="${region_highlight[@]}"}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
# Restore saved region_highlight
|
|
247
|
+
region_highlight=("${region_highlight_copy[@]}")
|
|
248
|
+
|
|
249
|
+
fi
|
|
250
|
+
|
|
251
|
+
# Use value form cache if any cached
|
|
252
|
+
region_highlight+=("${(@P)cache_place}")
|
|
253
|
+
|
|
254
|
+
done
|
|
255
|
+
|
|
256
|
+
# Re-apply zle_highlight settings
|
|
257
|
+
|
|
258
|
+
# region
|
|
259
|
+
() {
|
|
260
|
+
(( REGION_ACTIVE )) || return
|
|
261
|
+
integer min max
|
|
262
|
+
if (( MARK > CURSOR )) ; then
|
|
263
|
+
min=$CURSOR max=$MARK
|
|
264
|
+
else
|
|
265
|
+
min=$MARK max=$CURSOR
|
|
266
|
+
fi
|
|
267
|
+
if (( REGION_ACTIVE == 1 )); then
|
|
268
|
+
[[ $KEYMAP = vicmd ]] && (( max++ ))
|
|
269
|
+
elif (( REGION_ACTIVE == 2 )); then
|
|
270
|
+
local needle=$'\n'
|
|
271
|
+
# CURSOR and MARK are 0 indexed between letters like region_highlight
|
|
272
|
+
# Do not include the newline in the highlight
|
|
273
|
+
(( min = ${BUFFER[(Ib:min:)$needle]} ))
|
|
274
|
+
(( max = ${BUFFER[(ib:max:)$needle]} - 1 ))
|
|
275
|
+
fi
|
|
276
|
+
_zsh_highlight_apply_zle_highlight region standout "$min" "$max"
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
# yank / paste (zsh-5.1.1 and newer)
|
|
280
|
+
(( $+YANK_ACTIVE )) && (( YANK_ACTIVE )) && _zsh_highlight_apply_zle_highlight paste standout "$YANK_START" "$YANK_END"
|
|
281
|
+
|
|
282
|
+
# isearch
|
|
283
|
+
(( $+ISEARCHMATCH_ACTIVE )) && (( ISEARCHMATCH_ACTIVE )) && _zsh_highlight_apply_zle_highlight isearch underline "$ISEARCHMATCH_START" "$ISEARCHMATCH_END"
|
|
284
|
+
|
|
285
|
+
# suffix
|
|
286
|
+
(( $+SUFFIX_ACTIVE )) && (( SUFFIX_ACTIVE )) && _zsh_highlight_apply_zle_highlight suffix bold "$SUFFIX_START" "$SUFFIX_END"
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
return $ret
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
} always {
|
|
293
|
+
typeset -g _ZSH_HIGHLIGHT_PRIOR_BUFFER="$BUFFER"
|
|
294
|
+
typeset -gi _ZSH_HIGHLIGHT_PRIOR_CURSOR=$CURSOR
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
# Apply highlighting based on entries in the zle_highlight array.
|
|
299
|
+
# This function takes four arguments:
|
|
300
|
+
# 1. The exact entry (no patterns) in the zle_highlight array:
|
|
301
|
+
# region, paste, isearch, or suffix
|
|
302
|
+
# 2. The default highlighting that should be applied if the entry is unset
|
|
303
|
+
# 3. and 4. Two integer values describing the beginning and end of the
|
|
304
|
+
# range. The order does not matter.
|
|
305
|
+
_zsh_highlight_apply_zle_highlight() {
|
|
306
|
+
local entry="$1" default="$2"
|
|
307
|
+
integer first="$3" second="$4"
|
|
308
|
+
|
|
309
|
+
# read the relevant entry from zle_highlight
|
|
310
|
+
#
|
|
311
|
+
# ### In zsh≥5.0.8 we'd use ${(b)entry}, but we support older zsh's, so we don't
|
|
312
|
+
# ### add (b). The only effect is on the failure mode for callers that violate
|
|
313
|
+
# ### the precondition.
|
|
314
|
+
local region="${zle_highlight[(r)${entry}:*]-}"
|
|
315
|
+
|
|
316
|
+
if [[ -z "$region" ]]; then
|
|
317
|
+
# entry not specified at all, use default value
|
|
318
|
+
region=$default
|
|
319
|
+
else
|
|
320
|
+
# strip prefix
|
|
321
|
+
region="${region#${entry}:}"
|
|
322
|
+
|
|
323
|
+
# no highlighting when set to the empty string or to 'none'
|
|
324
|
+
if [[ -z "$region" ]] || [[ "$region" == none ]]; then
|
|
325
|
+
return
|
|
326
|
+
fi
|
|
327
|
+
fi
|
|
328
|
+
|
|
329
|
+
integer start end
|
|
330
|
+
if (( first < second )); then
|
|
331
|
+
start=$first end=$second
|
|
332
|
+
else
|
|
333
|
+
start=$second end=$first
|
|
334
|
+
fi
|
|
335
|
+
region_highlight+=("$start $end $region, memo=zsh-syntax-highlighting")
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
# -------------------------------------------------------------------------------------------------
|
|
340
|
+
# API/utility functions for highlighters
|
|
341
|
+
# -------------------------------------------------------------------------------------------------
|
|
342
|
+
|
|
343
|
+
# Array used by highlighters to declare user overridable styles.
|
|
344
|
+
typeset -gA ZSH_HIGHLIGHT_STYLES
|
|
345
|
+
|
|
346
|
+
# Whether the command line buffer has been modified or not.
|
|
347
|
+
#
|
|
348
|
+
# Returns 0 if the buffer has changed since _zsh_highlight was last called.
|
|
349
|
+
_zsh_highlight_buffer_modified()
|
|
350
|
+
{
|
|
351
|
+
[[ "${_ZSH_HIGHLIGHT_PRIOR_BUFFER:-}" != "$BUFFER" ]]
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
# Whether the cursor has moved or not.
|
|
355
|
+
#
|
|
356
|
+
# Returns 0 if the cursor has moved since _zsh_highlight was last called.
|
|
357
|
+
_zsh_highlight_cursor_moved()
|
|
358
|
+
{
|
|
359
|
+
[[ -n $CURSOR ]] && [[ -n ${_ZSH_HIGHLIGHT_PRIOR_CURSOR-} ]] && (($_ZSH_HIGHLIGHT_PRIOR_CURSOR != $CURSOR))
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
# Add a highlight defined by ZSH_HIGHLIGHT_STYLES.
|
|
363
|
+
#
|
|
364
|
+
# Should be used by all highlighters aside from 'pattern' (cf. ZSH_HIGHLIGHT_PATTERN).
|
|
365
|
+
# Overwritten in tests/test-highlighting.zsh when testing.
|
|
366
|
+
_zsh_highlight_add_highlight()
|
|
367
|
+
{
|
|
368
|
+
local -i start end
|
|
369
|
+
local highlight
|
|
370
|
+
start=$1
|
|
371
|
+
end=$2
|
|
372
|
+
shift 2
|
|
373
|
+
for highlight; do
|
|
374
|
+
if (( $+ZSH_HIGHLIGHT_STYLES[$highlight] )); then
|
|
375
|
+
region_highlight+=("$start $end $ZSH_HIGHLIGHT_STYLES[$highlight], memo=zsh-syntax-highlighting")
|
|
376
|
+
break
|
|
377
|
+
fi
|
|
378
|
+
done
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
# -------------------------------------------------------------------------------------------------
|
|
382
|
+
# Setup functions
|
|
383
|
+
# -------------------------------------------------------------------------------------------------
|
|
384
|
+
|
|
385
|
+
# Helper for _zsh_highlight_bind_widgets
|
|
386
|
+
# $1 is name of widget to call
|
|
387
|
+
_zsh_highlight_call_widget()
|
|
388
|
+
{
|
|
389
|
+
builtin zle "$@" &&
|
|
390
|
+
_zsh_highlight
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
# Decide whether to use the zle-line-pre-redraw codepath (colloquially known as
|
|
394
|
+
# "feature/redrawhook", after the topic branch's name) or the legacy "bind all
|
|
395
|
+
# widgets" codepath.
|
|
396
|
+
#
|
|
397
|
+
# We use the new codepath under two conditions:
|
|
398
|
+
#
|
|
399
|
+
# 1. If it's available, which we check by testing for add-zle-hook-widget's availability.
|
|
400
|
+
#
|
|
401
|
+
# 2. If zsh has the memo= feature, which is required for interoperability reasons.
|
|
402
|
+
# See issues #579 and #735, and the issues referenced from them.
|
|
403
|
+
#
|
|
404
|
+
# We check this with a plain version number check, since a functional check,
|
|
405
|
+
# as done by _zsh_highlight, can only be done from inside a widget
|
|
406
|
+
# function — a catch-22.
|
|
407
|
+
if is-at-least 5.9 && _zsh_highlight__function_callable_p add-zle-hook-widget
|
|
408
|
+
then
|
|
409
|
+
autoload -U add-zle-hook-widget
|
|
410
|
+
_zsh_highlight__zle-line-finish() {
|
|
411
|
+
# Reset $WIDGET since the 'main' highlighter depends on it.
|
|
412
|
+
#
|
|
413
|
+
# Since $WIDGET is declared by zle as read-only in this function's scope,
|
|
414
|
+
# a nested function is required in order to shadow its built-in value;
|
|
415
|
+
# see "User-defined widgets" in zshall.
|
|
416
|
+
() {
|
|
417
|
+
local -h -r WIDGET=zle-line-finish
|
|
418
|
+
_zsh_highlight
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
_zsh_highlight__zle-line-pre-redraw() {
|
|
422
|
+
# Set $? to 0 for _zsh_highlight. Without this, subsequent
|
|
423
|
+
# zle-line-pre-redraw hooks won't run, since add-zle-hook-widget happens to
|
|
424
|
+
# call us with $? == 1 in the common case.
|
|
425
|
+
true && _zsh_highlight "$@"
|
|
426
|
+
}
|
|
427
|
+
_zsh_highlight_bind_widgets(){}
|
|
428
|
+
if [[ -o zle ]]; then
|
|
429
|
+
add-zle-hook-widget zle-line-pre-redraw _zsh_highlight__zle-line-pre-redraw
|
|
430
|
+
add-zle-hook-widget zle-line-finish _zsh_highlight__zle-line-finish
|
|
431
|
+
fi
|
|
432
|
+
else
|
|
433
|
+
# Rebind all ZLE widgets to make them invoke _zsh_highlights.
|
|
434
|
+
_zsh_highlight_bind_widgets()
|
|
435
|
+
{
|
|
436
|
+
setopt localoptions noksharrays
|
|
437
|
+
typeset -F SECONDS
|
|
438
|
+
local prefix=orig-s$SECONDS-r$RANDOM # unique each time, in case we're sourced more than once
|
|
439
|
+
|
|
440
|
+
# Load ZSH module zsh/zleparameter, needed to override user defined widgets.
|
|
441
|
+
zmodload zsh/zleparameter 2>/dev/null || {
|
|
442
|
+
print -r -- >&2 'zsh-syntax-highlighting: failed loading zsh/zleparameter.'
|
|
443
|
+
return 1
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
# Override ZLE widgets to make them invoke _zsh_highlight.
|
|
447
|
+
local -U widgets_to_bind
|
|
448
|
+
widgets_to_bind=(${${(k)widgets}:#(.*|run-help|which-command|beep|set-local-history|yank|yank-pop)})
|
|
449
|
+
|
|
450
|
+
# Always wrap special zle-line-finish widget. This is needed to decide if the
|
|
451
|
+
# current line ends and special highlighting logic needs to be applied.
|
|
452
|
+
# E.g. remove cursor imprint, don't highlight partial paths, ...
|
|
453
|
+
widgets_to_bind+=(zle-line-finish)
|
|
454
|
+
|
|
455
|
+
# Always wrap special zle-isearch-update widget to be notified of updates in isearch.
|
|
456
|
+
# This is needed because we need to disable highlighting in that case.
|
|
457
|
+
widgets_to_bind+=(zle-isearch-update)
|
|
458
|
+
|
|
459
|
+
local cur_widget
|
|
460
|
+
for cur_widget in $widgets_to_bind; do
|
|
461
|
+
case ${widgets[$cur_widget]:-""} in
|
|
462
|
+
|
|
463
|
+
# Already rebound event: do nothing.
|
|
464
|
+
user:_zsh_highlight_widget_*);;
|
|
465
|
+
|
|
466
|
+
# The "eval"'s are required to make $cur_widget a closure: the value of the parameter at function
|
|
467
|
+
# definition time is used.
|
|
468
|
+
#
|
|
469
|
+
# We can't use ${0/_zsh_highlight_widget_} because these widgets are always invoked with
|
|
470
|
+
# NO_function_argzero, regardless of the option's setting here.
|
|
471
|
+
|
|
472
|
+
# User defined widget: override and rebind old one with prefix "orig-".
|
|
473
|
+
user:*) zle -N $prefix-$cur_widget ${widgets[$cur_widget]#*:}
|
|
474
|
+
eval "_zsh_highlight_widget_${(q)prefix}-${(q)cur_widget}() { _zsh_highlight_call_widget ${(q)prefix}-${(q)cur_widget} -- \"\$@\" }"
|
|
475
|
+
zle -N $cur_widget _zsh_highlight_widget_$prefix-$cur_widget;;
|
|
476
|
+
|
|
477
|
+
# Completion widget: override and rebind old one with prefix "orig-".
|
|
478
|
+
completion:*) zle -C $prefix-$cur_widget ${${(s.:.)widgets[$cur_widget]}[2,3]}
|
|
479
|
+
eval "_zsh_highlight_widget_${(q)prefix}-${(q)cur_widget}() { _zsh_highlight_call_widget ${(q)prefix}-${(q)cur_widget} -- \"\$@\" }"
|
|
480
|
+
zle -N $cur_widget _zsh_highlight_widget_$prefix-$cur_widget;;
|
|
481
|
+
|
|
482
|
+
# Builtin widget: override and make it call the builtin ".widget".
|
|
483
|
+
builtin) eval "_zsh_highlight_widget_${(q)prefix}-${(q)cur_widget}() { _zsh_highlight_call_widget .${(q)cur_widget} -- \"\$@\" }"
|
|
484
|
+
zle -N $cur_widget _zsh_highlight_widget_$prefix-$cur_widget;;
|
|
485
|
+
|
|
486
|
+
# Incomplete or nonexistent widget: Bind to z-sy-h directly.
|
|
487
|
+
*)
|
|
488
|
+
if [[ $cur_widget == zle-* ]] && (( ! ${+widgets[$cur_widget]} )); then
|
|
489
|
+
_zsh_highlight_widget_${cur_widget}() { :; _zsh_highlight }
|
|
490
|
+
zle -N $cur_widget _zsh_highlight_widget_$cur_widget
|
|
491
|
+
else
|
|
492
|
+
# Default: unhandled case.
|
|
493
|
+
print -r -- >&2 "zsh-syntax-highlighting: unhandled ZLE widget ${(qq)cur_widget}"
|
|
494
|
+
print -r -- >&2 "zsh-syntax-highlighting: (This is sometimes caused by doing \`bindkey <keys> ${(q-)cur_widget}\` without creating the ${(qq)cur_widget} widget with \`zle -N\` or \`zle -C\`.)"
|
|
495
|
+
fi
|
|
496
|
+
esac
|
|
497
|
+
done
|
|
498
|
+
}
|
|
499
|
+
fi
|
|
500
|
+
|
|
501
|
+
# Load highlighters from directory.
|
|
502
|
+
#
|
|
503
|
+
# Arguments:
|
|
504
|
+
# 1) Path to the highlighters directory.
|
|
505
|
+
_zsh_highlight_load_highlighters()
|
|
506
|
+
{
|
|
507
|
+
setopt localoptions noksharrays bareglobqual
|
|
508
|
+
|
|
509
|
+
# Check the directory exists.
|
|
510
|
+
[[ -d "$1" ]] || {
|
|
511
|
+
print -r -- >&2 "zsh-syntax-highlighting: highlighters directory ${(qq)1} not found."
|
|
512
|
+
return 1
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
# Load highlighters from highlighters directory and check they define required functions.
|
|
516
|
+
local highlighter highlighter_dir
|
|
517
|
+
for highlighter_dir ($1/*/(/)); do
|
|
518
|
+
highlighter="${highlighter_dir:t}"
|
|
519
|
+
[[ -f "$highlighter_dir${highlighter}-highlighter.zsh" ]] &&
|
|
520
|
+
. "$highlighter_dir${highlighter}-highlighter.zsh"
|
|
521
|
+
if type "_zsh_highlight_highlighter_${highlighter}_paint" &> /dev/null &&
|
|
522
|
+
type "_zsh_highlight_highlighter_${highlighter}_predicate" &> /dev/null;
|
|
523
|
+
then
|
|
524
|
+
# New (0.5.0) function names
|
|
525
|
+
elif type "_zsh_highlight_${highlighter}_highlighter" &> /dev/null &&
|
|
526
|
+
type "_zsh_highlight_${highlighter}_highlighter_predicate" &> /dev/null;
|
|
527
|
+
then
|
|
528
|
+
# Old (0.4.x) function names
|
|
529
|
+
if false; then
|
|
530
|
+
# TODO: only show this warning for plugin authors/maintainers, not for end users
|
|
531
|
+
print -r -- >&2 "zsh-syntax-highlighting: warning: ${(qq)highlighter} highlighter uses deprecated entry point names; please ask its maintainer to update it: https://github.com/zsh-users/zsh-syntax-highlighting/issues/329"
|
|
532
|
+
fi
|
|
533
|
+
# Make it work.
|
|
534
|
+
eval "_zsh_highlight_highlighter_${(q)highlighter}_paint() { _zsh_highlight_${(q)highlighter}_highlighter \"\$@\" }"
|
|
535
|
+
eval "_zsh_highlight_highlighter_${(q)highlighter}_predicate() { _zsh_highlight_${(q)highlighter}_highlighter_predicate \"\$@\" }"
|
|
536
|
+
else
|
|
537
|
+
print -r -- >&2 "zsh-syntax-highlighting: ${(qq)highlighter} highlighter should define both required functions '_zsh_highlight_highlighter_${highlighter}_paint' and '_zsh_highlight_highlighter_${highlighter}_predicate' in ${(qq):-"$highlighter_dir${highlighter}-highlighter.zsh"}."
|
|
538
|
+
fi
|
|
539
|
+
done
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
# -------------------------------------------------------------------------------------------------
|
|
544
|
+
# Setup
|
|
545
|
+
# -------------------------------------------------------------------------------------------------
|
|
546
|
+
|
|
547
|
+
# Try binding widgets.
|
|
548
|
+
_zsh_highlight_bind_widgets || {
|
|
549
|
+
print -r -- >&2 'zsh-syntax-highlighting: failed binding ZLE widgets, exiting.'
|
|
550
|
+
return 1
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
# Resolve highlighters directory location.
|
|
554
|
+
_zsh_highlight_load_highlighters "${ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR:-${${0:A}:h}/highlighters}" || {
|
|
555
|
+
print -r -- >&2 'zsh-syntax-highlighting: failed loading highlighters, exiting.'
|
|
556
|
+
return 1
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
# Reset scratch variables when commandline is done.
|
|
560
|
+
_zsh_highlight_preexec_hook()
|
|
561
|
+
{
|
|
562
|
+
typeset -g _ZSH_HIGHLIGHT_PRIOR_BUFFER=
|
|
563
|
+
typeset -gi _ZSH_HIGHLIGHT_PRIOR_CURSOR=
|
|
564
|
+
}
|
|
565
|
+
autoload -Uz add-zsh-hook
|
|
566
|
+
add-zsh-hook preexec _zsh_highlight_preexec_hook 2>/dev/null || {
|
|
567
|
+
print -r -- >&2 'zsh-syntax-highlighting: failed loading add-zsh-hook.'
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
# Load zsh/parameter module if available
|
|
571
|
+
zmodload zsh/parameter 2>/dev/null || true
|
|
572
|
+
|
|
573
|
+
# Initialize the array of active highlighters if needed.
|
|
574
|
+
[[ $#ZSH_HIGHLIGHT_HIGHLIGHTERS -eq 0 ]] && ZSH_HIGHLIGHT_HIGHLIGHTERS=(main)
|
|
575
|
+
|
|
576
|
+
if (( $+X_ZSH_HIGHLIGHT_DIRS_BLACKLIST )); then
|
|
577
|
+
print >&2 'zsh-syntax-highlighting: X_ZSH_HIGHLIGHT_DIRS_BLACKLIST is deprecated. Please use ZSH_HIGHLIGHT_DIRS_BLACKLIST.'
|
|
578
|
+
ZSH_HIGHLIGHT_DIRS_BLACKLIST=($X_ZSH_HIGHLIGHT_DIRS_BLACKLIST)
|
|
579
|
+
unset X_ZSH_HIGHLIGHT_DIRS_BLACKLIST
|
|
580
|
+
fi
|
|
581
|
+
|
|
582
|
+
# Restore the aliases we unned
|
|
583
|
+
eval "$zsh_highlight__aliases"
|
|
584
|
+
builtin unset zsh_highlight__aliases
|
|
585
|
+
|
|
586
|
+
# Set $?.
|
|
587
|
+
true
|
package/package.json
CHANGED
|
@@ -1 +1,35 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"name": "@andespindola/crow-term-linux-x64",
|
|
3
|
+
"version": "0.1.0-alpha.5",
|
|
4
|
+
"description": "Crow Term native binary for linux-x64 (installed by @andespindola/crow-term)",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
6
|
+
"homepage": "https://github.com/andersonflima/crow-term",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/andersonflima/crow-term.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/andersonflima/crow-term/issues"
|
|
13
|
+
},
|
|
14
|
+
"os": [
|
|
15
|
+
"linux"
|
|
16
|
+
],
|
|
17
|
+
"cpu": [
|
|
18
|
+
"x64"
|
|
19
|
+
],
|
|
20
|
+
"files": [
|
|
21
|
+
"bin",
|
|
22
|
+
"LICENSE",
|
|
23
|
+
"NOTICE.md",
|
|
24
|
+
"THIRD_PARTY_LICENSES.txt",
|
|
25
|
+
"assets/fonts/OFL.txt",
|
|
26
|
+
"assets/theme-license.txt"
|
|
27
|
+
],
|
|
28
|
+
"preferUnplugged": true,
|
|
29
|
+
"libc": [
|
|
30
|
+
"glibc"
|
|
31
|
+
],
|
|
32
|
+
"crowTerm": {
|
|
33
|
+
"glibc": "2.35"
|
|
34
|
+
}
|
|
35
|
+
}
|