Compare commits
12 Commits
i652-v1
...
0.7.0-beta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
71dc090d02 | ||
|
|
6a310ada5b | ||
|
|
c1d5790c57 | ||
|
|
e9b1ce1a36 | ||
|
|
68fbe1a449 | ||
|
|
f02c0bf980 | ||
|
|
1be58a6f45 | ||
|
|
c0ad50e645 | ||
|
|
8b2768ab40 | ||
|
|
6f1f595e3e | ||
|
|
de95d50bce | ||
|
|
83862c1abb |
66
changelog.md
66
changelog.md
@@ -1,3 +1,69 @@
|
|||||||
|
# Changes in version 0.7.0
|
||||||
|
|
||||||
|
**Version 0.7.0 has not been released. This changelog is a work in progress.**
|
||||||
|
|
||||||
|
This is a stable bugfix and feature release. Major new features and changes include:
|
||||||
|
|
||||||
|
- Add `ZSH_HIGHLIGHT_DIRS_BLACKLIST` to disable "path" and "path prefix"
|
||||||
|
highlighting for specific directories
|
||||||
|
[#379]
|
||||||
|
|
||||||
|
- Add the "regexp" highlighter, modelled after the pattern highlighter
|
||||||
|
[4e6f60063f1c]
|
||||||
|
|
||||||
|
- When a word uses globbing, only the globbing metacharacters will be highlighted as globbing:
|
||||||
|
in `: foo*bar`, only the `*` will be blue.
|
||||||
|
[e48af357532c]
|
||||||
|
|
||||||
|
- Highlight pasted quotes (e.g., `: foo"bar"`)
|
||||||
|
[dc1b2f6fa4bb]
|
||||||
|
|
||||||
|
- Highlight command substitutions (`` : `ls` ``, `: $(ls)`)
|
||||||
|
[c0e64fe13178 and parents, e86f75a840e7, et al]
|
||||||
|
|
||||||
|
- Highlight process substitutions (`: >(nl)`, `: <(pwd)`, `: =(git diff)`)
|
||||||
|
[c0e64fe13178 and parents, e86f75a840e7, et al]
|
||||||
|
|
||||||
|
- Highlight command substitutions inside double quotes (``: "`foo`"``)
|
||||||
|
[f16e858f0c83]
|
||||||
|
|
||||||
|
- Highlight many precommands (e.g., `nice`, `stdbuf`, `eatmydata`;
|
||||||
|
see `$precommand_options` in the source)
|
||||||
|
|
||||||
|
- Highlight numeric globs (e.g., `echo /lib<->`)
|
||||||
|
|
||||||
|
- Assorted improvement to aliases highlighting
|
||||||
|
(e.g.,
|
||||||
|
`alias sudo_u='sudo -u'; sudo_u jrandom ls`,
|
||||||
|
`alias x=y y=z z=nosuchcommand; x`,
|
||||||
|
`alias ls='ls -l'; \ls`)
|
||||||
|
[f3410c5862fc, 57386f30aec8, #544, and many others]
|
||||||
|
|
||||||
|
- Highlight some more syntax errors
|
||||||
|
[dea05e44e671, 298ef6a2fa30]
|
||||||
|
|
||||||
|
- New styles: named file descriptors, `RC_QUOTES`, and unclosed quotes (e.g., `echo "foo<CURSOR>`)
|
||||||
|
[38c794a978cd, 25ae1c01216c, 967335dfc5fd]
|
||||||
|
|
||||||
|
- The 'brackets' highlighting no longer treats quotes specially.
|
||||||
|
[ecdda36ef56f]
|
||||||
|
|
||||||
|
|
||||||
|
Selected bugfixes include:
|
||||||
|
|
||||||
|
- Highlight `sudo` correctly when it's not installed
|
||||||
|
[26a82113b08b]
|
||||||
|
|
||||||
|
- Handle some non-default options being set in zshrc
|
||||||
|
[b07ada1255b7, a2a899b41b8, 972ad197c13d, b3f66fc8748f]
|
||||||
|
|
||||||
|
- Fix off-by-one highlighting in vi "visual" mode (vicmd keymap)
|
||||||
|
[be3882aeb054]
|
||||||
|
|
||||||
|
- The 'yank-pop' widget is not wrapped
|
||||||
|
[#183]
|
||||||
|
|
||||||
|
|
||||||
# Changes in version 0.6.0
|
# Changes in version 0.6.0
|
||||||
|
|
||||||
This is a stable release, featuring bugfixes and minor improvements.
|
This is a stable release, featuring bugfixes and minor improvements.
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ manual page][zshzle-Character-Highlighting].
|
|||||||
#### Parameters
|
#### Parameters
|
||||||
|
|
||||||
To avoid partial path lookups on a path, add the path to the `ZSH_HIGHLIGHT_DIRS_BLACKLIST` array.
|
To avoid partial path lookups on a path, add the path to the `ZSH_HIGHLIGHT_DIRS_BLACKLIST` array.
|
||||||
This interface is still experimental.
|
|
||||||
|
|
||||||
```zsh
|
```zsh
|
||||||
ZSH_HIGHLIGHT_DIRS_BLACKLIST+=(/mnt/slow_share)
|
ZSH_HIGHLIGHT_DIRS_BLACKLIST+=(/mnt/slow_share)
|
||||||
|
|||||||
@@ -309,9 +309,8 @@ _zsh_highlight_highlighter_main_paint()
|
|||||||
'builtin' ''
|
'builtin' ''
|
||||||
'command' :pvV
|
'command' :pvV
|
||||||
'exec' a:cl
|
'exec' a:cl
|
||||||
'nocorrect' ''
|
|
||||||
'noglob' ''
|
'noglob' ''
|
||||||
'time' ''
|
# 'time' and 'nocorrect' shouldn't be added here; they're reserved words, not precommands.
|
||||||
|
|
||||||
'doas' aCu:Lns # as of OpenBSD's doas(1) dated September 4, 2016
|
'doas' aCu:Lns # as of OpenBSD's doas(1) dated September 4, 2016
|
||||||
'nice' n: # as of current POSIX spec
|
'nice' n: # as of current POSIX spec
|
||||||
@@ -723,6 +722,10 @@ _zsh_highlight_main_highlighter_highlight_list()
|
|||||||
style=reserved-word
|
style=reserved-word
|
||||||
# Match braces and handle special cases.
|
# Match braces and handle special cases.
|
||||||
case $arg in
|
case $arg in
|
||||||
|
(time|nocorrect)
|
||||||
|
next_word=${next_word//:regular:/}
|
||||||
|
next_word+=':start:'
|
||||||
|
;;
|
||||||
($'\x7b')
|
($'\x7b')
|
||||||
braces_stack='Y'"$braces_stack"
|
braces_stack='Y'"$braces_stack"
|
||||||
;;
|
;;
|
||||||
|
|||||||
35
highlighters/main/test-data/alias-basic.zsh
Normal file
35
highlighters/main/test-data/alias-basic.zsh
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
# Copyright (c) 2015 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
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
alias foo="echo hello world"
|
||||||
|
BUFFER="foo"
|
||||||
|
|
||||||
|
expected_region_highlight+=(
|
||||||
|
"1 3 alias" # foo
|
||||||
|
)
|
||||||
35
highlighters/main/test-data/alias-loop2.zsh
Normal file
35
highlighters/main/test-data/alias-loop2.zsh
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
# Copyright (c) 2015 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
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
alias ls="ls"
|
||||||
|
BUFFER="ls"
|
||||||
|
|
||||||
|
expected_region_highlight+=(
|
||||||
|
"1 2 alias" # ls
|
||||||
|
)
|
||||||
34
highlighters/main/test-data/backslash.zsh
Normal file
34
highlighters/main/test-data/backslash.zsh
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
# Copyright (c) 2018 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=$'\\'
|
||||||
|
|
||||||
|
expected_region_highlight=(
|
||||||
|
'1 1 unknown-token' # \\
|
||||||
|
)
|
||||||
38
highlighters/main/test-data/pasted-quotes.zsh
Normal file
38
highlighters/main/test-data/pasted-quotes.zsh
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env zsh
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
# Copyright (c) 2013 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=$': \'foo\'bar"baz"'
|
||||||
|
|
||||||
|
expected_region_highlight=(
|
||||||
|
'1 1 builtin' # :
|
||||||
|
'3 15 default' # \'foo\'bar"baz"
|
||||||
|
'3 7 single-quoted-argument' # \'foo\'
|
||||||
|
'11 15 double-quoted-argument' # "baz"
|
||||||
|
)
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
#!/usr/bin/env zsh
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
# Copyright (c) 2017, 2020 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=$'< <(pwd) > >(nl)'
|
||||||
|
|
||||||
|
expected_region_highlight=(
|
||||||
|
'1 1 redirection' # <
|
||||||
|
'3 8 default' # <(pwd)
|
||||||
|
'3 8 process-substitution' # <(pwd)
|
||||||
|
'3 4 process-substitution-delimiter' # <(
|
||||||
|
'5 7 builtin' # pwd
|
||||||
|
'8 8 process-substitution-delimiter' # )
|
||||||
|
'10 10 redirection' # >
|
||||||
|
'12 16 default' # >(nl)
|
||||||
|
'12 16 process-substitution' # >(nl)
|
||||||
|
'12 13 process-substitution-delimiter' # >(
|
||||||
|
'14 15 command' # nl
|
||||||
|
'16 16 process-substitution-delimiter' # )
|
||||||
|
)
|
||||||
38
highlighters/main/test-data/redirection-is-not-option.zsh
Normal file
38
highlighters/main/test-data/redirection-is-not-option.zsh
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
# Copyright (c) 2018 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 >> --yy'
|
||||||
|
|
||||||
|
expected_region_highlight=(
|
||||||
|
'1 1 builtin' # :
|
||||||
|
'3 3 redirection' # >
|
||||||
|
'5 6 default' # -x
|
||||||
|
'8 9 redirection' # >>
|
||||||
|
'11 14 default' # --yy
|
||||||
|
)
|
||||||
39
highlighters/main/test-data/time-and-nocorrect1.zsh
Normal file
39
highlighters/main/test-data/time-and-nocorrect1.zsh
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env zsh
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
# Copyright (c) 2019 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=$'time ls; nocorrect ls'
|
||||||
|
|
||||||
|
expected_region_highlight=(
|
||||||
|
'1 4 reserved-word' # time
|
||||||
|
'6 7 command' # ls
|
||||||
|
'8 8 commandseparator' # ;
|
||||||
|
'10 18 reserved-word' # nocorrect
|
||||||
|
'20 21 command' # ls
|
||||||
|
)
|
||||||
40
highlighters/main/test-data/time-and-nocorrect2.zsh
Normal file
40
highlighters/main/test-data/time-and-nocorrect2.zsh
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#!/usr/bin/env zsh
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
# Copyright (c) 2019 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=$'time ls; nocorrect ls'
|
||||||
|
alias time=':' nocorrect=':'
|
||||||
|
|
||||||
|
expected_region_highlight=(
|
||||||
|
'1 4 alias' # time
|
||||||
|
'6 7 default' # ls
|
||||||
|
'8 8 commandseparator' # ;
|
||||||
|
'10 18 alias' # nocorrect
|
||||||
|
'20 21 default' # ls
|
||||||
|
)
|
||||||
@@ -55,15 +55,15 @@ _zsh_highlight_add_highlight()
|
|||||||
|
|
||||||
# Copyright block
|
# Copyright block
|
||||||
year="`LC_ALL=C date +%Y`"
|
year="`LC_ALL=C date +%Y`"
|
||||||
if ! read -q "?Set copyright year to $year? "; then
|
if ! { read -q "?Set copyright year to $year? " } always { echo "" }; then
|
||||||
year="YYYY"
|
year="YYYY"
|
||||||
fi
|
fi
|
||||||
exec >$fname
|
<$0 sed -n -e '1,/^$/p' | sed -e "s/2[0-9][0-9][0-9]/${year}/" > $fname
|
||||||
<$0 sed -n -e '1,/^$/p' | sed -e "s/2[0-9][0-9][0-9]/${year}/"
|
|
||||||
# Assumes stdout is line-buffered
|
# Assumes stdout is line-buffered
|
||||||
git add -- $fname
|
git add -- $fname
|
||||||
|
|
||||||
# Buffer
|
# Buffer
|
||||||
|
exec > >(tee -a $fname)
|
||||||
print -n 'BUFFER='
|
print -n 'BUFFER='
|
||||||
if [[ $buffer != (#s)[$'\t -~']#(#e) ]]; then
|
if [[ $buffer != (#s)[$'\t -~']#(#e) ]]; then
|
||||||
print -r -- ${(qqqq)buffer}
|
print -r -- ${(qqqq)buffer}
|
||||||
|
|||||||
Reference in New Issue
Block a user