abra zsh config 2.0
This commit is contained in:
@@ -1,25 +1,20 @@
|
||||
zsh-syntax-highlighting / highlighters / brackets
|
||||
=================================================
|
||||
-------------------------------------------------
|
||||
|
||||
This is the ***brackets*** highlighter, that highlights brackets, parenthesis and matches them.
|
||||
This is the `brackets` highlighter, that highlights brackets and parentheses, and
|
||||
matches them.
|
||||
|
||||
|
||||
How to activate it
|
||||
------------------
|
||||
To activate it, add it to `ZSH_HIGHLIGHT_HIGHLIGHTERS`:
|
||||
### How to tweak it
|
||||
|
||||
ZSH_HIGHLIGHT_HIGHLIGHTERS=( [...] brackets)
|
||||
|
||||
|
||||
How to tweak it
|
||||
---------------
|
||||
This highlighter defines the following styles:
|
||||
|
||||
* `bracket-error` - unmatched brackets
|
||||
* `bracket-level-N` - brackets with nest level N
|
||||
* `cursor-matchingbracket` - the matching bracket, if cursor is on a bracket
|
||||
|
||||
To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`, for example in `~/.zshrc`:
|
||||
To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`,
|
||||
for example in `~/.zshrc`:
|
||||
|
||||
# To define styles for nested brackets up to level 4
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg=blue,bold'
|
||||
@@ -27,4 +22,8 @@ To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`, for
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-3]='fg=yellow,bold'
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-4]='fg=magenta,bold'
|
||||
|
||||
The syntax for declaring styles is [documented here](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#SEC135).
|
||||
The syntax for values is the same as the syntax of "types of highlighting" of
|
||||
the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)`
|
||||
manual page][zshzle-Character-Highlighting].
|
||||
|
||||
[zshzle-Character-Highlighting]: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting
|
||||
|
@@ -1,5 +1,5 @@
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors
|
||||
# Copyright (c) 2010-2017 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
@@ -38,73 +38,69 @@
|
||||
: ${ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]:=standout}
|
||||
|
||||
# Whether the brackets highlighter should be called or not.
|
||||
_zsh_highlight_brackets_highlighter_predicate()
|
||||
_zsh_highlight_highlighter_brackets_predicate()
|
||||
{
|
||||
_zsh_highlight_cursor_moved || _zsh_highlight_buffer_modified
|
||||
[[ $WIDGET == zle-line-finish ]] || _zsh_highlight_cursor_moved || _zsh_highlight_buffer_modified
|
||||
}
|
||||
|
||||
# Brackets highlighting function.
|
||||
_zsh_highlight_brackets_highlighter()
|
||||
_zsh_highlight_highlighter_brackets_paint()
|
||||
{
|
||||
local level=0 pos
|
||||
local -A levelpos lastoflevel matching typepos
|
||||
region_highlight=()
|
||||
local char style
|
||||
local -i bracket_color_size=${#ZSH_HIGHLIGHT_STYLES[(I)bracket-level-*]} buflen=${#BUFFER} level=0 matchingpos pos
|
||||
local -A levelpos lastoflevel matching
|
||||
|
||||
# Find all brackets and remember which one is matching
|
||||
for (( pos = 0; $pos < ${#BUFFER}; pos++ )) ; do
|
||||
local char="$BUFFER[pos+1]"
|
||||
for (( pos = 1; pos <= buflen; pos++ )) ; do
|
||||
char=$BUFFER[pos]
|
||||
case $char in
|
||||
["([{"])
|
||||
levelpos[$pos]=$((++level))
|
||||
lastoflevel[$level]=$pos
|
||||
_zsh_highlight_brackets_highlighter_brackettype "$char"
|
||||
;;
|
||||
[")]}"])
|
||||
matching[$lastoflevel[$level]]=$pos
|
||||
matching[$pos]=$lastoflevel[$level]
|
||||
levelpos[$pos]=$((level--))
|
||||
_zsh_highlight_brackets_highlighter_brackettype "$char"
|
||||
;;
|
||||
['"'\'])
|
||||
# Skip everything inside quotes
|
||||
local quotetype=$char
|
||||
while (( $pos < ${#BUFFER} )) ; do
|
||||
(( pos++ ))
|
||||
[[ $BUFFER[$pos+1] == $quotetype ]] && break
|
||||
done
|
||||
if (( level > 0 )); then
|
||||
matchingpos=$lastoflevel[$level]
|
||||
levelpos[$pos]=$((level--))
|
||||
if _zsh_highlight_brackets_match $matchingpos $pos; then
|
||||
matching[$matchingpos]=$pos
|
||||
matching[$pos]=$matchingpos
|
||||
fi
|
||||
else
|
||||
levelpos[$pos]=-1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Now highlight all found brackets
|
||||
for pos in ${(k)levelpos}; do
|
||||
if [[ -n $matching[$pos] ]] && [[ $typepos[$pos] == $typepos[$matching[$pos]] ]]; then
|
||||
local bracket_color_size=${#ZSH_HIGHLIGHT_STYLES[(I)bracket-level-*]}
|
||||
local bracket_color_level=bracket-level-$(( (levelpos[$pos] - 1) % bracket_color_size + 1 ))
|
||||
local style=$ZSH_HIGHLIGHT_STYLES[$bracket_color_level]
|
||||
region_highlight+=("$pos $((pos + 1)) $style")
|
||||
if (( $+matching[$pos] )); then
|
||||
if (( bracket_color_size )); then
|
||||
_zsh_highlight_add_highlight $((pos - 1)) $pos bracket-level-$(( (levelpos[$pos] - 1) % bracket_color_size + 1 ))
|
||||
fi
|
||||
else
|
||||
local style=$ZSH_HIGHLIGHT_STYLES[bracket-error]
|
||||
region_highlight+=("$pos $((pos + 1)) $style")
|
||||
_zsh_highlight_add_highlight $((pos - 1)) $pos bracket-error
|
||||
fi
|
||||
done
|
||||
|
||||
# If cursor is on a bracket, then highlight corresponding bracket, if any
|
||||
pos=$CURSOR
|
||||
if [[ -n $levelpos[$pos] ]] && [[ -n $matching[$pos] ]]; then
|
||||
local otherpos=$matching[$pos]
|
||||
local style=$ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]
|
||||
region_highlight+=("$otherpos $((otherpos + 1)) $style")
|
||||
# If cursor is on a bracket, then highlight corresponding bracket, if any.
|
||||
if [[ $WIDGET != zle-line-finish ]]; then
|
||||
pos=$((CURSOR + 1))
|
||||
if (( $+levelpos[$pos] )) && (( $+matching[$pos] )); then
|
||||
local -i otherpos=$matching[$pos]
|
||||
_zsh_highlight_add_highlight $((otherpos - 1)) $otherpos cursor-matchingbracket
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Helper function to differentiate type
|
||||
_zsh_highlight_brackets_highlighter_brackettype()
|
||||
_zsh_highlight_brackets_match()
|
||||
{
|
||||
case $1 in
|
||||
["()"]) typepos[$pos]=round;;
|
||||
["[]"]) typepos[$pos]=bracket;;
|
||||
["{}"]) typepos[$pos]=curly;;
|
||||
*) ;;
|
||||
case $BUFFER[$1] in
|
||||
\() [[ $BUFFER[$2] == \) ]];;
|
||||
\[) [[ $BUFFER[$2] == \] ]];;
|
||||
\{) [[ $BUFFER[$2] == \} ]];;
|
||||
*) false;;
|
||||
esac
|
||||
}
|
||||
|
@@ -0,0 +1,36 @@
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2016 zsh-syntax-highlighting contributors
|
||||
# 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-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS 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.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
WIDGET=zle-line-finish
|
||||
|
||||
BUFFER=': $foo[bar]'
|
||||
CURSOR=6 # cursor is zero-based
|
||||
|
||||
expected_region_highlight=(
|
||||
)
|
@@ -0,0 +1,47 @@
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2016 zsh-syntax-highlighting contributors
|
||||
# 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-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS 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.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
unsorted=1
|
||||
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-3]=
|
||||
|
||||
BUFFER=': ((( )))'
|
||||
CURSOR=2 # cursor is zero-based
|
||||
|
||||
expected_region_highlight=(
|
||||
"3 3 bracket-level-1"
|
||||
"4 4 bracket-level-2"
|
||||
"5 5 bracket-level-3"
|
||||
"7 7 bracket-level-3"
|
||||
"8 8 bracket-level-2"
|
||||
"9 9 bracket-level-1"
|
||||
"9 9 cursor-matchingbracket"
|
||||
)
|
33
.zprezto/modules/syntax-highlighting/external/highlighters/brackets/test-data/empty-styles.zsh
vendored
Normal file
33
.zprezto/modules/syntax-highlighting/external/highlighters/brackets/test-data/empty-styles.zsh
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2016 zsh-syntax-highlighting contributors
|
||||
# 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-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS 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.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
BUFFER=': (x)'
|
||||
|
||||
expected_region_highlight=(
|
||||
)
|
53
.zprezto/modules/syntax-highlighting/external/highlighters/brackets/test-data/loop-styles.zsh
vendored
Normal file
53
.zprezto/modules/syntax-highlighting/external/highlighters/brackets/test-data/loop-styles.zsh
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2016 zsh-syntax-highlighting contributors
|
||||
# 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-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS 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.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
unsorted=1
|
||||
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-3]=
|
||||
|
||||
BUFFER=': ({[({[(x)]})]})'
|
||||
|
||||
expected_region_highlight=(
|
||||
"3 3 bracket-level-1"
|
||||
"4 4 bracket-level-2"
|
||||
"5 5 bracket-level-3"
|
||||
"6 6 bracket-level-1"
|
||||
"7 7 bracket-level-2"
|
||||
"8 8 bracket-level-3"
|
||||
"9 9 bracket-level-1"
|
||||
"11 11 bracket-level-1"
|
||||
"12 12 bracket-level-3"
|
||||
"13 13 bracket-level-2"
|
||||
"14 14 bracket-level-1"
|
||||
"15 15 bracket-level-3"
|
||||
"16 16 bracket-level-2"
|
||||
"17 17 bracket-level-1"
|
||||
)
|
@@ -27,11 +27,16 @@
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
unsorted=1
|
||||
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=
|
||||
|
||||
BUFFER='echo ({x}]'
|
||||
|
||||
expected_region_highlight=(
|
||||
"6 6 $ZSH_HIGHLIGHT_STYLES[bracket-error]" # (
|
||||
"7 7 $ZSH_HIGHLIGHT_STYLES[bracket-level-2]" # {
|
||||
"9 9 $ZSH_HIGHLIGHT_STYLES[bracket-level-2]" # }
|
||||
"10 10 $ZSH_HIGHLIGHT_STYLES[bracket-error]" # )
|
||||
"6 6 bracket-error" # (
|
||||
"7 7 bracket-level-2" # {
|
||||
"9 9 bracket-level-2" # }
|
||||
"10 10 bracket-error" # )
|
||||
)
|
||||
|
42
.zprezto/modules/syntax-highlighting/external/highlighters/brackets/test-data/near-quotes.zsh
vendored
Normal file
42
.zprezto/modules/syntax-highlighting/external/highlighters/brackets/test-data/near-quotes.zsh
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2016 zsh-syntax-highlighting contributors
|
||||
# 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-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS 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.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
unsorted=1
|
||||
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=
|
||||
|
||||
BUFFER=': {"{x}"}'
|
||||
|
||||
expected_region_highlight=(
|
||||
"3 3 bracket-level-1"
|
||||
"5 5 bracket-level-2"
|
||||
"7 7 bracket-level-2"
|
||||
"9 9 bracket-level-1"
|
||||
)
|
@@ -27,13 +27,19 @@
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
unsorted=1
|
||||
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-3]=
|
||||
|
||||
BUFFER='echo $(echo ${(z)array})'
|
||||
|
||||
expected_region_highlight=(
|
||||
"7 7 $ZSH_HIGHLIGHT_STYLES[bracket-level-1]" # (
|
||||
"14 14 $ZSH_HIGHLIGHT_STYLES[bracket-level-2]" # {
|
||||
"15 15 $ZSH_HIGHLIGHT_STYLES[bracket-level-3]" # (
|
||||
"17 17 $ZSH_HIGHLIGHT_STYLES[bracket-level-3]" # )
|
||||
"23 23 $ZSH_HIGHLIGHT_STYLES[bracket-level-2]" # }
|
||||
"24 24 $ZSH_HIGHLIGHT_STYLES[bracket-level-1]" # )
|
||||
"7 7 bracket-level-1" # (
|
||||
"14 14 bracket-level-2" # {
|
||||
"15 15 bracket-level-3" # (
|
||||
"17 17 bracket-level-3" # )
|
||||
"23 23 bracket-level-2" # }
|
||||
"24 24 bracket-level-1" # )
|
||||
)
|
||||
|
34
.zprezto/modules/syntax-highlighting/external/highlighters/brackets/test-data/only-error.zsh
vendored
Normal file
34
.zprezto/modules/syntax-highlighting/external/highlighters/brackets/test-data/only-error.zsh
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2017 zsh-syntax-highlighting contributors
|
||||
# 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-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS 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.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
BUFFER=': x)'
|
||||
|
||||
expected_region_highlight=(
|
||||
"4 4 bracket-error" # )
|
||||
)
|
@@ -30,5 +30,5 @@
|
||||
BUFFER='echo "foo ( bar"'
|
||||
|
||||
expected_region_highlight=(
|
||||
"1 16 $ZSH_HIGHLIGHT_STYLES[none]" # We expect the brackets highlighter to do nothing
|
||||
"11 11 bracket-error"
|
||||
)
|
||||
|
@@ -27,11 +27,16 @@
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
unsorted=1
|
||||
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=
|
||||
|
||||
BUFFER='echo ({x})'
|
||||
|
||||
expected_region_highlight=(
|
||||
"6 6 $ZSH_HIGHLIGHT_STYLES[bracket-level-1]" # (
|
||||
"7 7 $ZSH_HIGHLIGHT_STYLES[bracket-level-2]" # {
|
||||
"9 9 $ZSH_HIGHLIGHT_STYLES[bracket-level-2]" # }
|
||||
"10 10 $ZSH_HIGHLIGHT_STYLES[bracket-level-1]" # )
|
||||
"6 6 bracket-level-1" # (
|
||||
"7 7 bracket-level-2" # {
|
||||
"9 9 bracket-level-2" # }
|
||||
"10 10 bracket-level-1" # )
|
||||
)
|
||||
|
@@ -27,10 +27,15 @@
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
unsorted=1
|
||||
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=
|
||||
|
||||
BUFFER='echo ({x}'
|
||||
|
||||
expected_region_highlight=(
|
||||
"6 6 $ZSH_HIGHLIGHT_STYLES[bracket-error]" # (
|
||||
"7 7 $ZSH_HIGHLIGHT_STYLES[bracket-level-2]" # {
|
||||
"9 9 $ZSH_HIGHLIGHT_STYLES[bracket-level-2]" # }
|
||||
"6 6 bracket-error" # (
|
||||
"7 7 bracket-level-2" # {
|
||||
"9 9 bracket-level-2" # }
|
||||
)
|
||||
|
@@ -27,10 +27,14 @@
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
unsorted=1
|
||||
|
||||
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=
|
||||
|
||||
BUFFER='echo {x})'
|
||||
|
||||
expected_region_highlight=(
|
||||
"6 6 $ZSH_HIGHLIGHT_STYLES[bracket-level-1]" # {
|
||||
"8 8 $ZSH_HIGHLIGHT_STYLES[bracket-level-1]" # }
|
||||
"9 9 $ZSH_HIGHLIGHT_STYLES[bracket-error]" # )
|
||||
"6 6 bracket-level-1" # {
|
||||
"8 8 bracket-level-1" # }
|
||||
"9 9 bracket-error" # )
|
||||
)
|
||||
|
Reference in New Issue
Block a user