diff --git a/zsh-syntax-highlighting/.gitattributes b/zsh-syntax-highlighting/.gitattributes deleted file mode 100644 index 715e624..0000000 --- a/zsh-syntax-highlighting/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -.revision-hash export-subst diff --git a/zsh-syntax-highlighting/.gitignore b/zsh-syntax-highlighting/.gitignore deleted file mode 100644 index fb2e708..0000000 --- a/zsh-syntax-highlighting/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.zwc* -.pc/ diff --git a/zsh-syntax-highlighting/.revision-hash b/zsh-syntax-highlighting/.revision-hash deleted file mode 100644 index 6828f88..0000000 --- a/zsh-syntax-highlighting/.revision-hash +++ /dev/null @@ -1 +0,0 @@ -$Format:%H$ diff --git a/zsh-syntax-highlighting/.version b/zsh-syntax-highlighting/.version deleted file mode 100644 index 746bd19..0000000 --- a/zsh-syntax-highlighting/.version +++ /dev/null @@ -1 +0,0 @@ -0.3.1-dev diff --git a/zsh-syntax-highlighting/COPYING.md b/zsh-syntax-highlighting/COPYING.md deleted file mode 100644 index 5512a0a..0000000 --- a/zsh-syntax-highlighting/COPYING.md +++ /dev/null @@ -1,23 +0,0 @@ -Copyright (c) 2010-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. diff --git a/zsh-syntax-highlighting/Makefile b/zsh-syntax-highlighting/Makefile deleted file mode 100644 index e4fa163..0000000 --- a/zsh-syntax-highlighting/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -NAME=zsh-syntax-highlighting - -INSTALL?=install -c -PREFIX?=/usr/local -SHARE_DIR=$(DESTDIR)$(PREFIX)/share/$(NAME) -ZSH?=zsh # zsh binary to run tests with - -# Have the default target do nothing. -all: - @ : - -install: - $(INSTALL) -d $(SHARE_DIR) - cp -r .version zsh-syntax-highlighting.zsh highlighters $(SHARE_DIR) - if [ x"true" = x"`git rev-parse --is-inside-work-tree 2>/dev/null`" ]; then \ - git rev-parse HEAD; \ - else \ - cat .revision-hash; \ - fi > $(SHARE_DIR)/.revision-hash - -test: - @result=0; \ - for test in highlighters/*; do \ - if [ -d $$test/test-data ]; then \ - echo "Running test $${test##*/}"; \ - $(ZSH) -f tests/test-highlighting.zsh "$${test##*/}"; \ - : $$(( result |= $$? )); \ - fi \ - done; \ - exit $$result - -perf: - @result=0; \ - for test in highlighters/*; do \ - if [ -d $$test/test-data ]; then \ - echo "Running test $${test##*/}"; \ - $(ZSH) -f tests/test-perfs.zsh "$${test##*/}"; \ - : $$(( result |= $$? )); \ - fi \ - done; \ - exit $$result - -.PHONY: all install test diff --git a/zsh-syntax-highlighting/README.md b/zsh-syntax-highlighting/README.md deleted file mode 100644 index d7fc4ad..0000000 --- a/zsh-syntax-highlighting/README.md +++ /dev/null @@ -1,89 +0,0 @@ -zsh-syntax-highlighting -======================= - -**[Fish shell](http://www.fishshell.com) like syntax highlighting for [Zsh](http://www.zsh.org).** - -*Requirements: zsh 4.3.17+.* - -This package provides syntax highlighing for the shell zsh. It enables -highlighing of commands whilst they are typed at a zsh prompt into an -interactive terminal. This helps in reviewing commands before running -them, particularly in catching syntax errors. - -[![Screenshot](images/preview-smaller.png)](images/preview.png) - - -How to install --------------- - -### Using packages - -* Arch Linux: [community/zsh-syntax-highlighting](https://www.archlinux.org/packages/zsh-syntax-highlighting) / [AUR/zsh-syntax-highlighting-git](https://aur.archlinux.org/packages/zsh-syntax-highlighting-git) -* Gentoo: [mv overlay](http://gpo.zugaina.org/app-shells/zsh-syntax-highlighting) -* Mac OS X / Homebrew: [brew install zsh-syntax-highlighting](https://github.com/Homebrew/homebrew/blob/master/Library/Formula/zsh-syntax-highlighting.rb) - -### In your ~/.zshrc - -* Clone this repository: - - git clone git://github.com/zsh-users/zsh-syntax-highlighting.git - - (or [download a snapshot](https://github.com/zsh-users/zsh-syntax-highlighting/archive/master.tar.gz)) - -* Source the script **at the end** of `~/.zshrc`: - - source /path/to/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh - -* Source `~/.zshrc` to take changes into account: - - source ~/.zshrc - - -### With oh-my-zsh - -* Download the script or clone this repository in [oh-my-zsh](http://github.com/robbyrussell/oh-my-zsh) plugins directory: - - git clone git://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting - -* Activate the plugin in `~/.zshrc`: - - plugins=( [plugins...] zsh-syntax-highlighting) - -* Source `~/.zshrc` to take changes into account: - - source ~/.zshrc - -Note that `zsh-syntax-highlighting` must be the last plugin sourced, -so make it the last element of the `$plugins` array. - -### System-wide installation - -Either of the above methods is suitable for a single-user installation, which requires -no special privileges. If, however, you desire to install zsh-syntax-highlighting -system-wide, you may do so by running `make install` and directing your users to -add `source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh` -in their `.zshrc`s. - - -FAQ ---- - -### Why must `zsh-syntax-highlighting.zsh` be sourced at the end of the `.zshrc` file? - -`zsh-syntax-highlighting.zsh` wraps ZLE widgets. It must be sourced after all -custom widgets have been created (i.e., after all `zle -N` calls and after -running `compinit`). Widgets created later will work, but will not update the -syntax highlighting. - -### How are new releases announced? - -There is currently no "push" announcements channel. However, the following alternatives exist: - -- GitHub's RSS feed of releases: https://github.com/zsh-users/zsh-syntax-highlighting/releases.atom -- An anitya entry: https://release-monitoring.org/project/7552/ - -How to tweak ------------- - -Syntax highlighting is done by pluggable highlighter scripts, see the [highlighters directory](highlighters) -for documentation and configuration settings. diff --git a/zsh-syntax-highlighting/changelog.md b/zsh-syntax-highlighting/changelog.md deleted file mode 100644 index dbffcde..0000000 --- a/zsh-syntax-highlighting/changelog.md +++ /dev/null @@ -1,212 +0,0 @@ -up to c0dafd1d850e582291b41d693369794d1ea31343 - - - - -# Changes in version 0.3.1 - - -## Added highlighting of: - -- incomplete sudo commands - (a3047a912100, 2f05620b19ae) - - sudo; - sudo -u; - -- command words following reserved words - (#207, #222, b397b12ac139 et seq, 6fbd2aa9579b et seq, 8b4adbd991b0) - - if ls; then ls; else ls; fi - repeat 10 do ls; done - - (The `ls` are now highlighted as a command.) - -- comments (when `INTERACTIVE_COMMENTS` is set) - (#163, #167, 693de99a9030) - - echo Hello # comment - -- closing brackets of arithmetic expansion, subshells, and blocks - (#226, a59f442d2d34, et seq) - - (( foo )) - ( foo ) - { foo } - - -## Fixed highlighting of: - -- precommand modifiers at non-command-word position - (#209, 2c9f8c8c95fa) - - ls command foo - -- sudo commands with infix redirections - (#221, be006aded590, 86e924970911) - - sudo -u >/tmp/foo.out user ls - -- subshells; anonymous functions - (#166, #194, 0d1bfbcbfa67, 9e178f9f3948) - - (true) - () { true } - -- parameter assignment statements with no command - (#205, 01d7eeb3c713) - - A=1; - - (The semicolon used to be highlighted as a mistake) - - -## Removed features: - -- Removed highlighting of approximate paths (`path_approx`). - (#187, 98aee7f8b9a3) - - -## Other changes: - -- main highlighter refactored to use states rather than booleans. - (2080a441ac49, et seq) - -- Fix initialization when sourcing `zsh-syntax-highlighting.zsh` via a symlink - (083c47b00707) - -- docs: Add screenshot. - (57624bb9f64b) - -- widgets wrapping: Don't add '--' when invoking widgets. - (c808d2187a73) - -- Refresh highlighting upon `accept-*` widgets (`accept-line` et al). - (59fbdda64c21) - -- Stop leaking match/mbegin/mend to global scope (thanks to upstream - `WARN_CREATE_GLOBAL` improvements). - (d3deffbf46a4) - - -## Developer-visible changes: - -- Test harness converted to [TAP](http://testanything.org/tap-specification.html) format - (d99aa58aaaef, et seq) - -- Run each test in a separate subprocess, isolating them from each other - (d99aa58aaaef, et seq) - -- Fix test failure with nonexisting $HOME - (#216, b2ac98b98150) - -- Test output is now colorized. - (4d3da30f8b72, 6fe07c096109) - -- Document `make install` - (a18a7427fd2c) - -- tests: Allow specifying the zsh binary to use. - (557bb7e0c6a0) - -- tests: Add 'make perf' target - (4513eaea71d7) - - - -# Changes in version 0.3.0 - - -## Added highlighting of: - -- suffix aliases (requires zsh 5.1.1 or newer): - - alias -s png=display - foo.png - -- prefix redirections: - - foo.txt - -- arithmetic evaluations: - - (( 42 )) - -- $'' strings, including \x/\octal/\u/\U escapes - - : $'foo\u0040bar' - -- multiline strings: - - % echo "line 1 - line 2" - -- string literals that haven't been finished: - - % echo "Hello, world - -- command words that involve tilde expansion: - - % ~/bin/foo - - -## Fixed highlighting of: - -- quoted command words: - - % \ls - -- backslash escapes in "" strings: - - % echo "\x41" - -- noglob after command separator: - - % :; noglob echo * - -- glob after command separator, when the first command starts with 'noglob': - - % noglob true; echo * - -- the region (vi visual mode / set-mark-command) (issue #165) - -- redirection and command separators that would be highlighted as `path_approx` - - % echo foo;‸ - % echo <‸ - - (where `‸` represents the cursor location) - -- escaped globbing (outside quotes) - - % echo \* - - -## Other changes: - -- implemented compatibility with zsh's paste highlighting (issue #175) - -- `$?` propagated correctly to wrapped widgets - -- don't leak $REPLY into global scope - - -## Developer-visible changes: - -- added makefile with `install` and `test` targets - -- set `warn_create_global` internally - -- document release process - - - - -# Version 0.2.1 - -(Start of changelog.) - diff --git a/zsh-syntax-highlighting/highlighters/README.md b/zsh-syntax-highlighting/highlighters/README.md deleted file mode 100644 index 987cc83..0000000 --- a/zsh-syntax-highlighting/highlighters/README.md +++ /dev/null @@ -1,50 +0,0 @@ -zsh-syntax-highlighting / highlighters -====================================== - -Syntax highlighting is done by pluggable highlighters: - -* [***main***](main) - the base highlighter, and the only one active by default. -* [***brackets***](brackets) - matches brackets and parenthesis. -* [***pattern***](pattern) - matches user-defined patterns. -* [***cursor***](cursor) - matches the cursor position. -* [***root***](root) - triggered if the current user is root. -* [***line***](line) - applied to the whole command line - - -How to activate highlighters ----------------------------- - -To activate an highlighter, add it to the `ZSH_HIGHLIGHT_HIGHLIGHTERS` array in `~/.zshrc`, for example: - - ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern cursor) - - -How to tweak highlighters -------------------------- - -Highlighters look up styles from the `ZSH_HIGHLIGHT_STYLES` array. Navigate into each highlighter directory to see what styles it defines and how to configure it. - - -How to implement a new highlighter ----------------------------------- - -To create your own ***myhighlighter*** highlighter: - -* Create your script at **highlighters/*myhighlighter*/*myhighlighter*-highlighter.zsh**. -* Implement the `_zsh_highlight_myhighlighter_highlighter_predicate` function. This function must return 0 when the highlighter needs to be called, for example: - - _zsh_highlight_myhighlighter_highlighter_predicate() { - # Call this highlighter in SVN repositories - [[ -d .svn ]] - } - -* Implement the `_zsh_highlight_myhighlighter_highlighter` function. This function does the actual syntax highlighting, by modifying `region_highlight`, for example: - - _zsh_highlight_myhighlighter_highlighter() { - # Colorize the whole buffer with blue background - region_highlight+=(0 $#BUFFER bg=blue) - } - -* Activate your highlighter in `~/.zshrc`: - - ZSH_HIGHLIGHT_HIGHLIGHTERS+=(myhighlighter) diff --git a/zsh-syntax-highlighting/highlighters/brackets/README.md b/zsh-syntax-highlighting/highlighters/brackets/README.md deleted file mode 100644 index 9fd4f96..0000000 --- a/zsh-syntax-highlighting/highlighters/brackets/README.md +++ /dev/null @@ -1,30 +0,0 @@ -zsh-syntax-highlighting / highlighters / brackets -================================================= - -This is the ***brackets*** highlighter, that highlights brackets, parenthesis and matches them. - - -How to activate it ------------------- -To activate it, add it to `ZSH_HIGHLIGHT_HIGHLIGHTERS`: - - 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 define styles for nested brackets up to level 4 - ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg=blue,bold' - ZSH_HIGHLIGHT_STYLES[bracket-level-2]='fg=red,bold' - 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). diff --git a/zsh-syntax-highlighting/highlighters/brackets/brackets-highlighter.zsh b/zsh-syntax-highlighting/highlighters/brackets/brackets-highlighter.zsh deleted file mode 100644 index 2b87a3e..0000000 --- a/zsh-syntax-highlighting/highlighters/brackets/brackets-highlighter.zsh +++ /dev/null @@ -1,110 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 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 -# ------------------------------------------------------------------------------------------------- - - -# Define default styles. -: ${ZSH_HIGHLIGHT_STYLES[bracket-error]:=fg=red,bold} -: ${ZSH_HIGHLIGHT_STYLES[bracket-level-1]:=fg=blue,bold} -: ${ZSH_HIGHLIGHT_STYLES[bracket-level-2]:=fg=green,bold} -: ${ZSH_HIGHLIGHT_STYLES[bracket-level-3]:=fg=magenta,bold} -: ${ZSH_HIGHLIGHT_STYLES[bracket-level-4]:=fg=yellow,bold} -: ${ZSH_HIGHLIGHT_STYLES[bracket-level-5]:=fg=cyan,bold} -: ${ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]:=standout} - -# Whether the brackets highlighter should be called or not. -_zsh_highlight_brackets_highlighter_predicate() -{ - _zsh_highlight_cursor_moved || _zsh_highlight_buffer_modified -} - -# Brackets highlighting function. -_zsh_highlight_brackets_highlighter() -{ - local level=0 pos - local -A levelpos lastoflevel matching typepos - region_highlight=() - - # Find all brackets and remember which one is matching - for (( pos = 0; $pos < ${#BUFFER}; pos++ )) ; do - local char="$BUFFER[pos+1]" - 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 - ;; - 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") - else - local style=$ZSH_HIGHLIGHT_STYLES[bracket-error] - region_highlight+=("$pos $((pos + 1)) $style") - 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") - fi -} - -# Helper function to differentiate type -_zsh_highlight_brackets_highlighter_brackettype() -{ - case $1 in - ["()"]) typepos[$pos]=round;; - ["[]"]) typepos[$pos]=bracket;; - ["{}"]) typepos[$pos]=curly;; - *) ;; - esac -} diff --git a/zsh-syntax-highlighting/highlighters/brackets/test-data/mismatch-patentheses.zsh b/zsh-syntax-highlighting/highlighters/brackets/test-data/mismatch-patentheses.zsh deleted file mode 100644 index 5671079..0000000 --- a/zsh-syntax-highlighting/highlighters/brackets/test-data/mismatch-patentheses.zsh +++ /dev/null @@ -1,37 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -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]" # ) -) diff --git a/zsh-syntax-highlighting/highlighters/brackets/test-data/nested-parentheses.zsh b/zsh-syntax-highlighting/highlighters/brackets/test-data/nested-parentheses.zsh deleted file mode 100644 index 291f8f4..0000000 --- a/zsh-syntax-highlighting/highlighters/brackets/test-data/nested-parentheses.zsh +++ /dev/null @@ -1,39 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -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]" # ) -) diff --git a/zsh-syntax-highlighting/highlighters/brackets/test-data/quoted-patentheses.zsh b/zsh-syntax-highlighting/highlighters/brackets/test-data/quoted-patentheses.zsh deleted file mode 100644 index a2c52c4..0000000 --- a/zsh-syntax-highlighting/highlighters/brackets/test-data/quoted-patentheses.zsh +++ /dev/null @@ -1,34 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -BUFFER='echo "foo ( bar"' - -expected_region_highlight=( -"1 16 $ZSH_HIGHLIGHT_STYLES[none]" # We expect the brackets highlighter to do nothing -) diff --git a/zsh-syntax-highlighting/highlighters/brackets/test-data/simple-parentheses.zsh b/zsh-syntax-highlighting/highlighters/brackets/test-data/simple-parentheses.zsh deleted file mode 100644 index 893145f..0000000 --- a/zsh-syntax-highlighting/highlighters/brackets/test-data/simple-parentheses.zsh +++ /dev/null @@ -1,37 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -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]" # ) -) diff --git a/zsh-syntax-highlighting/highlighters/brackets/test-data/unclosed-patentheses.zsh b/zsh-syntax-highlighting/highlighters/brackets/test-data/unclosed-patentheses.zsh deleted file mode 100644 index c36ba36..0000000 --- a/zsh-syntax-highlighting/highlighters/brackets/test-data/unclosed-patentheses.zsh +++ /dev/null @@ -1,36 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -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]" # } -) diff --git a/zsh-syntax-highlighting/highlighters/brackets/test-data/unclosed-patentheses2.zsh b/zsh-syntax-highlighting/highlighters/brackets/test-data/unclosed-patentheses2.zsh deleted file mode 100644 index 04c246b..0000000 --- a/zsh-syntax-highlighting/highlighters/brackets/test-data/unclosed-patentheses2.zsh +++ /dev/null @@ -1,36 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -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]" # ) -) diff --git a/zsh-syntax-highlighting/highlighters/cursor/README.md b/zsh-syntax-highlighting/highlighters/cursor/README.md deleted file mode 100644 index d28ac19..0000000 --- a/zsh-syntax-highlighting/highlighters/cursor/README.md +++ /dev/null @@ -1,24 +0,0 @@ -zsh-syntax-highlighting / highlighters / cursor -================================================= - -This is the ***cursor*** highlighter, that highlights the cursor. - - -How to activate it ------------------- -To activate it, add it to `ZSH_HIGHLIGHT_HIGHLIGHTERS`: - - ZSH_HIGHLIGHT_HIGHLIGHTERS=( [...] cursor) - - -How to tweak it ---------------- -This highlighter defines the following styles: - -* `cursor` - the style for the current cursor position - -To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`, for example in `~/.zshrc`: - - ZSH_HIGHLIGHT_STYLES[cursor]='bg=blue' - -The syntax for declaring styles is [documented here](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#SEC135). diff --git a/zsh-syntax-highlighting/highlighters/cursor/cursor-highlighter.zsh b/zsh-syntax-highlighting/highlighters/cursor/cursor-highlighter.zsh deleted file mode 100644 index d315c62..0000000 --- a/zsh-syntax-highlighting/highlighters/cursor/cursor-highlighter.zsh +++ /dev/null @@ -1,44 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 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 -# ------------------------------------------------------------------------------------------------- - - -# Define default styles. -: ${ZSH_HIGHLIGHT_STYLES[cursor]:=standout} - -# Whether the cursor highlighter should be called or not. -_zsh_highlight_cursor_highlighter_predicate() -{ - _zsh_highlight_cursor_moved -} - -# Cursor highlighting function. -_zsh_highlight_cursor_highlighter() -{ - region_highlight+=("$CURSOR $(( $CURSOR + 1 )) $ZSH_HIGHLIGHT_STYLES[cursor]") -} diff --git a/zsh-syntax-highlighting/highlighters/line/README.md b/zsh-syntax-highlighting/highlighters/line/README.md deleted file mode 100644 index 2be32a2..0000000 --- a/zsh-syntax-highlighting/highlighters/line/README.md +++ /dev/null @@ -1,24 +0,0 @@ -zsh-syntax-highlighting / highlighters / line -================================================= - -This is the ***line*** highlighter, that highlights the whole line. - - -How to activate it ------------------- -To activate it, add it to `ZSH_HIGHLIGHT_HIGHLIGHTERS`: - - ZSH_HIGHLIGHT_HIGHLIGHTERS=( [...] line) - - -How to tweak it ---------------- -This highlighter defines the following styles: - -* `line` - the style for the whole line - -To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`, for example in `~/.zshrc`: - - ZSH_HIGHLIGHT_STYLES[line]='bold' - -The syntax for declaring styles is [documented here](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#SEC135). diff --git a/zsh-syntax-highlighting/highlighters/line/line-highlighter.zsh b/zsh-syntax-highlighting/highlighters/line/line-highlighter.zsh deleted file mode 100644 index 68308cc..0000000 --- a/zsh-syntax-highlighting/highlighters/line/line-highlighter.zsh +++ /dev/null @@ -1,44 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 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 -# ------------------------------------------------------------------------------------------------- - - -# Define default styles. -: ${ZSH_HIGHLIGHT_STYLES[line]:=} - -# Whether the root highlighter should be called or not. -_zsh_highlight_line_highlighter_predicate() -{ - _zsh_highlight_buffer_modified -} - -# root highlighting function. -_zsh_highlight_line_highlighter() -{ - region_highlight+=("0 $#BUFFER $ZSH_HIGHLIGHT_STYLES[line]") -} diff --git a/zsh-syntax-highlighting/highlighters/main/README.md b/zsh-syntax-highlighting/highlighters/main/README.md deleted file mode 100644 index c748248..0000000 --- a/zsh-syntax-highlighting/highlighters/main/README.md +++ /dev/null @@ -1,68 +0,0 @@ -zsh-syntax-highlighting / highlighters / main -============================================= - -This is the ***main*** highlighter, that highlights: - -* Commands -* Options -* Arguments -* Paths -* Strings - -How to activate it ------------------- -To activate it, add it to `ZSH_HIGHLIGHT_HIGHLIGHTERS`: - - ZSH_HIGHLIGHT_HIGHLIGHTERS=( [...] main) - -This highlighter is active by default. - - -How to tweak it ---------------- -This highlighter defines the following styles: - -* `unknown-token` - unknown tokens / errors -* `reserved-word` - shell reserved words -* `alias` - aliases -* `suffix-alias` - suffix aliases (requires zsh 5.1.1 or newer) -* `builtin` - shell builtin commands -* `function` - functions -* `command` - commands -* `precommand` - precommands (i.e. exec, builtin, ...) -* `commandseparator` - command separation tokens -* `hashed-command` - hashed commands -* `path` - paths -* `path_prefix` - path prefixes -* `globbing` - globbing expressions (`*.txt`) -* `history-expansion` - history expansion expressions (`!foo` and `^foo^bar`) -* `single-hyphen-option` - single hyphen options (-o) -* `double-hyphen-option` - double hyphen options (--option) -* `back-quoted-argument` - backquoted expressions (`` `foo` ``) -* `single-quoted-argument` - single quoted arguments (`` 'foo' ``) -* `double-quoted-argument` - double quoted arguments (`` "foo" ``) -* `dollar-quoted-argument` - dollar quoted arguments (`` $'foo' ``) -* `dollar-double-quoted-argument` - dollar double quoted arguments ($foo inside "") -* `back-double-quoted-argument` - back double quoted arguments (\x inside "") -* `back-dollar-quoted-argument` - back dollar quoted arguments (\x inside $'') -* `assign` - variable assignments -* `redirection` - redirection operators (`<`, `>`, etc) -* `comment` - interactive comments, when `setopt INTERACTIVE_COMMENTS` is in effect (`echo # foo`) -* `default` - parts of the buffer that do not match anything - -To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`, for example in `~/.zshrc`: - - # Declare the variable - typeset -A ZSH_HIGHLIGHT_STYLES - - # To differentiate aliases from other command types - ZSH_HIGHLIGHT_STYLES[alias]='fg=magenta,bold' - - # To have paths colored instead of underlined - ZSH_HIGHLIGHT_STYLES[path]='fg=cyan' - - # To disable highlighting of globbing expressions - ZSH_HIGHLIGHT_STYLES[globbing]='none' - -The syntax for declaring styles is documented in [the `zshzle(1)` manual -page](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#SEC135). diff --git a/zsh-syntax-highlighting/highlighters/main/main-highlighter.zsh b/zsh-syntax-highlighting/highlighters/main/main-highlighter.zsh deleted file mode 100644 index 64a2032..0000000 --- a/zsh-syntax-highlighting/highlighters/main/main-highlighter.zsh +++ /dev/null @@ -1,494 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-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 -# ------------------------------------------------------------------------------------------------- - - -# Define default styles. -: ${ZSH_HIGHLIGHT_STYLES[default]:=none} -: ${ZSH_HIGHLIGHT_STYLES[unknown-token]:=fg=red,bold} -: ${ZSH_HIGHLIGHT_STYLES[reserved-word]:=fg=yellow} -: ${ZSH_HIGHLIGHT_STYLES[alias]:=fg=green} -: ${ZSH_HIGHLIGHT_STYLES[suffix-alias]:=fg=green,underline} -: ${ZSH_HIGHLIGHT_STYLES[builtin]:=fg=green} -: ${ZSH_HIGHLIGHT_STYLES[function]:=fg=green} -: ${ZSH_HIGHLIGHT_STYLES[command]:=fg=green} -: ${ZSH_HIGHLIGHT_STYLES[precommand]:=fg=green,underline} -: ${ZSH_HIGHLIGHT_STYLES[commandseparator]:=none} -: ${ZSH_HIGHLIGHT_STYLES[hashed-command]:=fg=green} -: ${ZSH_HIGHLIGHT_STYLES[path]:=underline} -: ${ZSH_HIGHLIGHT_STYLES[path_prefix]:=underline} -: ${ZSH_HIGHLIGHT_STYLES[globbing]:=fg=blue} -: ${ZSH_HIGHLIGHT_STYLES[history-expansion]:=fg=blue} -: ${ZSH_HIGHLIGHT_STYLES[single-hyphen-option]:=none} -: ${ZSH_HIGHLIGHT_STYLES[double-hyphen-option]:=none} -: ${ZSH_HIGHLIGHT_STYLES[back-quoted-argument]:=none} -: ${ZSH_HIGHLIGHT_STYLES[single-quoted-argument]:=fg=yellow} -: ${ZSH_HIGHLIGHT_STYLES[double-quoted-argument]:=fg=yellow} -: ${ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]:=fg=yellow} -: ${ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]:=fg=cyan} -: ${ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]:=fg=cyan} -: ${ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]:=fg=cyan} -: ${ZSH_HIGHLIGHT_STYLES[assign]:=none} -: ${ZSH_HIGHLIGHT_STYLES[redirection]:=none} -: ${ZSH_HIGHLIGHT_STYLES[comment]:=fg=black,bold} - -# Whether the highlighter should be called or not. -_zsh_highlight_main_highlighter_predicate() -{ - # accept-* may trigger removal of path_prefix highlighting - [[ $WIDGET == accept-* ]] || - _zsh_highlight_buffer_modified -} - -# Helper to deal with tokens crossing line boundaries. -_zsh_highlight_main_add_region_highlight() { - integer start=$1 end=$2 - local style=$3 - - # The calculation was relative to $PREBUFFER$BUFFER, but region_highlight is - # relative to $BUFFER. - (( start -= $#PREBUFFER )) - (( end -= $#PREBUFFER )) - - (( end < 0 )) && return # having end<0 would be a bug - (( start < 0 )) && start=0 # having start<0 is normal with e.g. multiline strings - region_highlight+=("$start $end $style") -} - -# Main syntax highlighting function. -_zsh_highlight_main_highlighter() -{ - if [[ -o interactive_comments ]]; then - local interactive_comments= # set to empty - fi - emulate -L zsh - setopt localoptions extendedglob bareglobqual - local start_pos=0 end_pos highlight_glob=true arg style - typeset -a ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR - typeset -a ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS - typeset -a ZSH_HIGHLIGHT_TOKENS_CONTROL_FLOW - local buf="$PREBUFFER$BUFFER" - region_highlight=() - - ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR=( - '|' '||' ';' '&' '&&' - ) - ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS=( - 'builtin' 'command' 'exec' 'nocorrect' 'noglob' - ) - - # Tokens that, at (naively-determined) "command position", are followed by - # a de jure command position. All of these are reserved words. - ZSH_HIGHLIGHT_TOKENS_CONTROL_FLOW=( - $'\x7b' # block - $'\x28' # subshell - '()' # anonymous function - 'while' - 'until' - 'if' - 'then' - 'elif' - 'else' - 'do' - 'time' - 'coproc' - '!' # reserved word; unrelated to $histchars[1] - ) - - # State machine - # - # The states are: - # - :start: Command word - # - :sudo_opt: A leading-dash option to sudo (such as "-u" or "-i") - # - :sudo_arg: The argument to a sudo leading-dash option that takes one, - # when given as a separate word; i.e., "foo" in "-u foo" (two - # words) but not in "-ufoo" (one word). - # - :regular: "Not a command word". - # Mainly used to detect premature termination of commands. - # - # When the kind of a word is not yet known, $this_word / $next_word may contain - # multiple states. For example, after "sudo -i", the next word may be either - # another --flag or a command name, hence the state would include both :start: - # and :sudo_opt:. - # - # The tokens are always added with both leading and trailing colons to serve as - # word delimiters (an improvised array); [[ $x == *:foo:* ]] and x=${x//:foo:/} - # will DTRT regardless of how many elements or repetitions $x has.. - # - # Handling of redirections: upon seeing a redirection token, we must stall - # the current state --- that is, the value of $this_word --- for two iterations - # (one for the redirection operator, one for the word following it representing - # the redirection target). Therefore, we set $in_redirection to 2 upon seeing a - # redirection operator, decrement it each iteration, and stall the current state - # when it is non-zero. Thus, upon reaching the next word (the one that follows - # the redirection operator and target), $this_word will still contain values - # appropriate for the word immediately following the word that preceded the - # redirection operator. - # - # The "the previous word was a redirection operator" state is not communicated - # to the next iteration via $next_word/$this_word as usual, but via - # $in_redirection. The value of $next_word from the iteration that processed - # the operator is discarded. - # - local this_word=':start:' next_word - integer in_redirection - for arg in ${interactive_comments-${(z)buf}} \ - ${interactive_comments+${(zZ+c+)buf}}; do - if (( in_redirection )); then - (( --in_redirection )) - fi - if (( in_redirection == 0 )); then - next_word=':regular:' - fi - # $already_added is set to 1 to disable adding an entry to region_highlight - # for this iteration. Currently, that is done for "" and $'' strings, - # which add the entry early so escape sequences within the string override - # the string's color. - integer already_added=0 - local style_override="" - if [[ $this_word == *':start:'* ]] && [[ $arg = 'noglob' ]]; then - highlight_glob=false - fi - - # advance $start_pos, skipping over whitespace in $buf. - if [[ $arg == ';' ]] ; then - # We're looking for either a semicolon or a newline, whichever comes - # first. Both of these are rendered as a ";" (SEPER) by the ${(z)..} - # flag. - # - # We can't use the (Z+n+) flag because that elides the end-of-command - # token altogether, so 'echo foo\necho bar' (two commands) becomes - # indistinguishable from 'echo foo echo bar' (one command with three - # words for arguments). - local needle=$'[;\n]' - integer offset=${${buf[start_pos+1,-1]}[(i)$needle]} - (( start_pos += offset - 1 )) - (( end_pos = start_pos + $#arg )) - else - ((start_pos+=${#buf[$start_pos+1,-1]}-${#${buf[$start_pos+1,-1]##([[:space:]]|\\[[:space:]])#}})) - ((end_pos=$start_pos+${#arg})) - fi - - if [[ -n ${interactive_comments+'set'} && $arg[1] == $histchars[3] ]]; then - if [[ $this_word == *(':regular:'|':start:')* ]]; then - style=$ZSH_HIGHLIGHT_STYLES[comment] - else - style=$ZSH_HIGHLIGHT_STYLES[unknown-token] # prematurely terminated - fi - _zsh_highlight_main_add_region_highlight $start_pos $end_pos $style - already_added=1 - continue - fi - - # Parse the sudo command line - if (( ! in_redirection )); then - if [[ $this_word == *':sudo_opt:'* ]]; then - case "$arg" in - # Flag that requires an argument - '-'[Cgprtu]) this_word=${this_word//:start:/}; - next_word=':sudo_arg:';; - # This prevents misbehavior with sudo -u -otherargument - '-'*) this_word=${this_word//:start:/}; - next_word+=':start:'; - next_word+=':sudo_opt:';; - *) ;; - esac - elif [[ $this_word == *':sudo_arg:'* ]]; then - next_word+=':sudo_opt:' - next_word+=':start:' - fi - fi - - if [[ $this_word == *':start:'* ]] && (( in_redirection == 0 )); then # $arg is the command word - if [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS:#"$arg"} ]]; then - style=$ZSH_HIGHLIGHT_STYLES[precommand] - elif [[ "$arg" = "sudo" ]]; then - style=$ZSH_HIGHLIGHT_STYLES[precommand] - next_word=${next_word//:regular:/} - next_word+=':sudo_opt:' - next_word+=':start:' - else - _zsh_highlight_main_highlighter_expand_path $arg - local expanded_arg="$REPLY" - local res="$(LC_ALL=C builtin type -w -- ${expanded_arg} 2>/dev/null)" - case $res in - *': reserved') style=$ZSH_HIGHLIGHT_STYLES[reserved-word];; - *': suffix alias') - style=$ZSH_HIGHLIGHT_STYLES[suffix-alias] - ;; - *': alias') style=$ZSH_HIGHLIGHT_STYLES[alias] - local aliased_command="${"$(alias -- $arg)"#*=}" - [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS:#"$aliased_command"} && -z ${(M)ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS:#"$arg"} ]] && ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS+=($arg) - ;; - *': builtin') style=$ZSH_HIGHLIGHT_STYLES[builtin];; - *': function') style=$ZSH_HIGHLIGHT_STYLES[function];; - *': command') style=$ZSH_HIGHLIGHT_STYLES[command];; - *': hashed') style=$ZSH_HIGHLIGHT_STYLES[hashed-command];; - *) if _zsh_highlight_main_highlighter_check_assign; then - style=$ZSH_HIGHLIGHT_STYLES[assign] - if [[ $arg[-1] != '(' ]]; then - # assignment to a scalar parameter. - # (For array assignments, the command doesn't start until the ")" token.) - next_word+=':start:' - fi - elif [[ $arg[0,1] == $histchars[0,1] || $arg[0,1] == $histchars[2,2] ]]; then - style=$ZSH_HIGHLIGHT_STYLES[history-expansion] - elif [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:#"$arg"} ]] && - [[ $this_word == *':regular:'* ]]; then - # This highlights empty commands (semicolon follows nothing) as an error. - # Zsh accepts them, though. - style=$ZSH_HIGHLIGHT_STYLES[commandseparator] - elif [[ $arg[1] == '<' || $arg[1] == '>' ]]; then - style=$ZSH_HIGHLIGHT_STYLES[redirection] - (( in_redirection=2 )) - elif [[ $arg[1,2] == '((' ]]; then - # Arithmetic evaluation. - # - # Note: prior to zsh-5.1.1-52-g4bed2cf (workers/36669), the ${(z)...} - # splitter would only output the '((' token if the matching '))' had - # been typed. Therefore, under those versions of zsh, BUFFER="(( 42" - # would be highlighted as an error until the matching "))" are typed. - # - # We highlight just the opening parentheses, as a reserved word; this - # is how [[ ... ]] is highlighted, too. - style=$ZSH_HIGHLIGHT_STYLES[reserved-word] - _zsh_highlight_main_add_region_highlight $start_pos $((start_pos + 2)) $style - already_added=1 - if [[ $arg[-2,-1] == '))' ]]; then - _zsh_highlight_main_add_region_highlight $((end_pos - 2)) $end_pos $style - already_added=1 - fi - elif [[ $arg == '()' || $arg == $'\x28' ]]; then - # anonymous function - # subshell - style=$ZSH_HIGHLIGHT_STYLES[reserved-word] - else - if _zsh_highlight_main_highlighter_check_path; then - style=$ZSH_HIGHLIGHT_STYLES[path] - else - style=$ZSH_HIGHLIGHT_STYLES[unknown-token] - fi - fi - ;; - esac - fi - else # $arg is a non-command word - case $arg in - $'\x29') style=$ZSH_HIGHLIGHT_STYLES[reserved-word];; # subshell - $'\x7d') style=$ZSH_HIGHLIGHT_STYLES[reserved-word];; # block - '--'*) style=$ZSH_HIGHLIGHT_STYLES[double-hyphen-option];; - '-'*) style=$ZSH_HIGHLIGHT_STYLES[single-hyphen-option];; - "'"*) style=$ZSH_HIGHLIGHT_STYLES[single-quoted-argument];; - '"'*) style=$ZSH_HIGHLIGHT_STYLES[double-quoted-argument] - _zsh_highlight_main_add_region_highlight $start_pos $end_pos $style - _zsh_highlight_main_highlighter_highlight_string - already_added=1 - ;; - \$\'*) style=$ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument] - _zsh_highlight_main_add_region_highlight $start_pos $end_pos $style - _zsh_highlight_main_highlighter_highlight_dollar_string - already_added=1 - ;; - '`'*) style=$ZSH_HIGHLIGHT_STYLES[back-quoted-argument];; - [*?]*|*[^\\][*?]*) - $highlight_glob && style=$ZSH_HIGHLIGHT_STYLES[globbing] || style=$ZSH_HIGHLIGHT_STYLES[default];; - *) if false; then - elif [[ $arg[0,1] = $histchars[0,1] ]]; then - style=$ZSH_HIGHLIGHT_STYLES[history-expansion] - elif [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:#"$arg"} ]]; then - if [[ $this_word == *':regular:'* ]]; then - style=$ZSH_HIGHLIGHT_STYLES[commandseparator] - else - style=$ZSH_HIGHLIGHT_STYLES[unknown-token] - fi - elif [[ $arg[1] == '<' || $arg[1] == '>' ]]; then - style=$ZSH_HIGHLIGHT_STYLES[redirection] - (( in_redirection=2 )) - else - if _zsh_highlight_main_highlighter_check_path; then - style=$ZSH_HIGHLIGHT_STYLES[path] - else - style=$ZSH_HIGHLIGHT_STYLES[default] - fi - fi - ;; - esac - fi - # if a style_override was set (eg in _zsh_highlight_main_highlighter_check_path), use it - [[ -n $style_override ]] && style=$ZSH_HIGHLIGHT_STYLES[$style_override] - (( already_added )) || _zsh_highlight_main_add_region_highlight $start_pos $end_pos $style - if [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:#"$arg"} ]]; then - next_word=':start:' - elif - [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_CONTROL_FLOW:#"$arg"} && $this_word == *':start:' ]] || - [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS:#"$arg"} && $this_word == *':start:' ]]; then - next_word=':start:' - elif [[ $arg == "repeat" && $this_word == *':start:'* ]]; then - # skip the repeat-count word - in_redirection=2 - # The redirection mechanism assumes $this_word describes the word - # following the redirection. Make it so. - # - # The repeat-count word will be handled like a redirection target. - this_word=':start:' - fi - [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:#"$arg"} ]] && highlight_glob=true - start_pos=$end_pos - (( in_redirection == 0 )) && this_word=$next_word - done -} - -# Check if $arg is variable assignment -_zsh_highlight_main_highlighter_check_assign() -{ - setopt localoptions extended_glob - [[ $arg == [[:alpha:]_][[:alnum:]_]#(|\[*\])(|[+])=* ]] -} - -# Check if $arg is a path. -_zsh_highlight_main_highlighter_check_path() -{ - _zsh_highlight_main_highlighter_expand_path $arg; - local expanded_path="$REPLY" - - [[ -z $expanded_path ]] && return 1 - [[ -e $expanded_path ]] && return 0 - - # Search the path in CDPATH - local cdpath_dir - for cdpath_dir in $cdpath ; do - [[ -e "$cdpath_dir/$expanded_path" ]] && return 0 - done - - # If dirname($arg) doesn't exist, neither does $arg. - [[ ! -e ${expanded_path:h} ]] && return 1 - - # If this word ends the buffer, check if it's the prefix of a valid path. - if [[ ${BUFFER[1]} != "-" && ${#BUFFER} == $end_pos ]] && - [[ $WIDGET != accept-* ]]; then - local -a tmp - tmp=( ${expanded_path}*(N) ) - (( $#tmp > 0 )) && style_override=path_prefix && return 0 - fi - - # It's not a path. - return 1 -} - -# Highlight special chars inside double-quoted strings -_zsh_highlight_main_highlighter_highlight_string() -{ - setopt localoptions noksharrays - local -a match mbegin mend - local MATCH; integer MBEGIN MEND - local i j k style - # Starting quote is at 1, so start parsing at offset 2 in the string. - for (( i = 2 ; i < end_pos - start_pos ; i += 1 )) ; do - (( j = i + start_pos - 1 )) - (( k = j + 1 )) - case "$arg[$i]" in - '$' ) style=$ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument] - # Look for an alphanumeric parameter name. - if [[ ${arg:$i} =~ ^([A-Za-z_][A-Za-z0-9_]*|[0-9]+) ]] ; then - (( k += $#MATCH )) # highlight the parameter name - (( i += $#MATCH )) # skip past it - else - continue - fi - ;; - "\\") style=$ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument] - if [[ \\\`\"\$ == *$arg[$i+1]* ]]; then - (( k += 1 )) # Color following char too. - (( i += 1 )) # Skip parsing the escaped char. - else - continue - fi - ;; - *) continue ;; - - esac - _zsh_highlight_main_add_region_highlight $j $k $style - done -} - -# Highlight special chars inside dollar-quoted strings -_zsh_highlight_main_highlighter_highlight_dollar_string() -{ - setopt localoptions noksharrays - local -a match mbegin mend - local MATCH; integer MBEGIN MEND - local i j k style - local AA - integer c - # Starting dollar-quote is at 1:2, so start parsing at offset 3 in the string. - for (( i = 3 ; i < end_pos - start_pos ; i += 1 )) ; do - (( j = i + start_pos - 1 )) - (( k = j + 1 )) - case "$arg[$i]" in - "\\") style=$ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument] - for (( c = i + 1 ; c <= end_pos - start_pos ; c += 1 )); do - [[ "$arg[$c]" != ([0-9xXuUa-fA-F]) ]] && break - done - AA=$arg[$i+1,$c-1] - # Matching for HEX and OCT values like \0xA6, \xA6 or \012 - if [[ "$AA" =~ "^(x|X)[0-9a-fA-F]{1,2}" - || "$AA" =~ "^[0-7]{1,3}" - || "$AA" =~ "^u[0-9a-fA-F]{1,4}" - || "$AA" =~ "^U[0-9a-fA-F]{1,8}" - ]]; then - (( k += $#MATCH )) - (( i += $#MATCH )) - else - if (( $#arg > $i+1 )) && [[ $arg[$i+1] == [xXuU] ]]; then - # \x not followed by hex digits is probably an error - style=$ZSH_HIGHLIGHT_STYLES[unknown-token] - fi - (( k += 1 )) # Color following char too. - (( i += 1 )) # Skip parsing the escaped char. - fi - ;; - *) continue ;; - - esac - _zsh_highlight_main_add_region_highlight $j $k $style - done -} - -# Called with a single positional argument. -# Perform filename expansion (tilde expansion) on the argument and set $REPLY to the expanded value. -# -# Does not perform filename generation (globbing). -_zsh_highlight_main_highlighter_expand_path() -{ - (( $# == 1 )) || echo "zsh-syntax-highlighting: BUG: _zsh_highlight_main_highlighter_expand_path: called without argument" >&2 - - # The $~1 syntax normally performs filename generation, but not when it's on the right-hand side of ${x:=y}. - setopt localoptions nonomatch - unset REPLY - : ${REPLY:=${(Q)~1}} -} diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/alias.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/alias.zsh deleted file mode 100644 index aa84a58..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/alias.zsh +++ /dev/null @@ -1,51 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 alias1="unused expansion" -alias -s alias2="echo" -alias1() {} # to check that it's highlighted as an alias, not as a function - -ZSH_HIGHLIGHT_STYLES[alias]=$unused_highlight -BUFFER='x.alias2; alias1' - -# Set expected_region_highlight as a function of zsh version. -# -# Highlight of suffix alias requires zsh-5.1.1 or newer; see issue #126, -# and commit 36403 to zsh itself. Therefore, check if the requisite zsh -# functionality is present, and skip verifying suffix-alias highlighting -# if it isn't. -expected_region_highlight=() -if [[ "$(type -w x.alias2)" == *suffix* ]]; then - expected_region_highlight+=( - "1 8 $ZSH_HIGHLIGHT_STYLES[suffix-alias]" # x.alias2 - ) -fi -expected_region_highlight+=( - "11 16 $ZSH_HIGHLIGHT_STYLES[alias]" # alias1 -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/anonymous-function.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/anonymous-function.zsh deleted file mode 100644 index 62714ed..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/anonymous-function.zsh +++ /dev/null @@ -1,40 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -BUFFER='() echo hello; () { echo world }' - -expected_region_highlight=( - "1 2 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # () - "4 7 $ZSH_HIGHLIGHT_STYLES[command]" # echo - "9 13 $ZSH_HIGHLIGHT_STYLES[default]" # hello - "14 14 $ZSH_HIGHLIGHT_STYLES[commandseparator]" # ; - "16 17 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # () - "19 19 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # { - "21 24 $ZSH_HIGHLIGHT_STYLES[command]" # echo -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/arithmetic-evaluation.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/arithmetic-evaluation.zsh deleted file mode 100644 index 9287e91..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/arithmetic-evaluation.zsh +++ /dev/null @@ -1,40 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -# Must be at command word, since the word following 'if' isn't currently considered -# a command word (issue #207). -# -# An opening '((' without matching '))' is highlighted correctly under zsh-5.1.1-52-g4bed2cf -# or newer, only (issue #188). -BUFFER='(( x == 42 ))' - -expected_region_highlight=( - "1 2 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # (( - "12 13 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # )) -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/assign-append.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/assign-append.zsh deleted file mode 100644 index a38cd86..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/assign-append.zsh +++ /dev/null @@ -1,35 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -ZSH_HIGHLIGHT_STYLES[assign]=$unused_highlight -BUFFER='a+=(lorem ipsum)' - -expected_region_highlight=( - "1 4 $ZSH_HIGHLIGHT_STYLES[assign]" # a+=( -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/assign-semicolon.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/assign-semicolon.zsh deleted file mode 100644 index c3692d4..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/assign-semicolon.zsh +++ /dev/null @@ -1,36 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -ZSH_HIGHLIGHT_STYLES[commandseparator]=$unused_highlight -BUFFER='A=1; echo hello world' - -expected_region_highlight=( - "4 4 $ZSH_HIGHLIGHT_STYLES[commandseparator]" # ; - "6 9 $ZSH_HIGHLIGHT_STYLES[command]" # echo -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/assign.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/assign.zsh deleted file mode 100644 index ef38668..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/assign.zsh +++ /dev/null @@ -1,36 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -ZSH_HIGHLIGHT_STYLES[assign]=$unused_highlight -BUFFER='A=1 b=("foo" bar)' - -expected_region_highlight=( - "1 3 $ZSH_HIGHLIGHT_STYLES[assign]" # A=1 - "8 12 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # "foo" -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/back-quoted-argument.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/back-quoted-argument.zsh deleted file mode 100644 index 6dfba71..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/back-quoted-argument.zsh +++ /dev/null @@ -1,35 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -ZSH_HIGHLIGHT_STYLES[back-quoted-argument]=$unused_highlight -BUFFER='echo `echo 42`' - -expected_region_highlight=( - "6 14 $ZSH_HIGHLIGHT_STYLES[back-quoted-argument]" -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/backslash-continuation.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/backslash-continuation.zsh deleted file mode 100644 index 9fbd916..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/backslash-continuation.zsh +++ /dev/null @@ -1,35 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -PREBUFFER=$'echo \\\n' -BUFFER='noglob' - -expected_region_highlight=( - "1 6 none" # 'noglob' highlighted as a string, not as a precomand -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/commandseparator.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/commandseparator.zsh deleted file mode 100644 index 383bd47..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/commandseparator.zsh +++ /dev/null @@ -1,37 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -ZSH_HIGHLIGHT_STYLES[commandseparator]=$unused_highlight - -BUFFER=':; pwd' - -expected_region_highlight=( - "2 2 $ZSH_HIGHLIGHT_STYLES[commandseparator]" # ; - "4 6 $ZSH_HIGHLIGHT_STYLES[builtin]" # pwd -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/comment-leading.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/comment-leading.zsh deleted file mode 100644 index a30af8b..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/comment-leading.zsh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 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 -# ------------------------------------------------------------------------------------------------- - -setopt interactive_comments - -BUFFER='# echo foo' - -expected_region_highlight=( - "1 1 ${(q-)ZSH_HIGHLIGHT_STYLES[comment]}" # # - "2 10 ${(q-)ZSH_HIGHLIGHT_STYLES[comment]}" # " echo foo" -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/comment-off.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/comment-off.zsh deleted file mode 100644 index 5aa16af..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/comment-off.zsh +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 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 -# ------------------------------------------------------------------------------------------------- - -unsetopt interactive_comments - -BUFFER='# echo foo' - -expected_region_highlight=( - "1 1 ${(q-)ZSH_HIGHLIGHT_STYLES[unknown-token]}" # # - "3 6 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # " echo foo" - "8 10 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # " echo foo" -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/comments.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/comments.zsh deleted file mode 100644 index 4b9c974..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/comments.zsh +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 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 -# ------------------------------------------------------------------------------------------------- - -setopt interactive_comments - -BUFFER='echo "foo #bar" #baz # quux' - -expected_region_highlight=( - "1 4 $ZSH_HIGHLIGHT_STYLES[command]" # echo - "6 15 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # "foo #bar" - "17 27 ${(q-)ZSH_HIGHLIGHT_STYLES[comment]}" # #baz # quux -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/control-flow.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/control-flow.zsh deleted file mode 100644 index 3107f50..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/control-flow.zsh +++ /dev/null @@ -1,51 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -ZSH_HIGHLIGHT_STYLES[alias]=$unused_highlight -BUFFER='while if echo Hello; then ls /; else ls; fi; do stat "x"; done; repeat 10 ls' - -expected_region_highlight+=( - "1 5 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # while - "7 8 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # if - "10 13 $ZSH_HIGHLIGHT_STYLES[builtin]" # echo - "15 19 $ZSH_HIGHLIGHT_STYLES[default]" # Hello - "22 25 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # then - "27 28 $ZSH_HIGHLIGHT_STYLES[command]" # ls - "30 30 $ZSH_HIGHLIGHT_STYLES[path]" # / - "31 31 $ZSH_HIGHLIGHT_STYLES[commandseparator]" # ; - "33 36 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # else - "38 39 $ZSH_HIGHLIGHT_STYLES[command]" # ls - "42 43 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # fi - "46 47 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # do - "49 52 $ZSH_HIGHLIGHT_STYLES[command]" # stat - "54 56 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # "x" - "59 62 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # done - "65 70 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # repeat - "75 76 $ZSH_HIGHLIGHT_STYLES[command]" # ls -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/dollar-quoted.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/dollar-quoted.zsh deleted file mode 100644 index ea12f9f..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/dollar-quoted.zsh +++ /dev/null @@ -1,36 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]=$unused_highlight -BUFFER=": \$'*' 'foo'" - -expected_region_highlight=( - "3 6 $ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]" # $'*' - not a glob - "8 12 $ZSH_HIGHLIGHT_STYLES[single-quoted-argument]" # 'foo' -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/dollar-quoted2.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/dollar-quoted2.zsh deleted file mode 100644 index 1ce9bb4..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/dollar-quoted2.zsh +++ /dev/null @@ -1,41 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=$unused_highlight -BUFFER=": \$'foo\xbar\udeadbeef\uzzzz'" - -expected_region_highlight=( - "3 7 $ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]" # $'foo - "8 11 $ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]" # \xba - "12 12 $ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]" # r - "13 18 $ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]" # \dead - "19 22 $ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]" # beef - "23 24 $ZSH_HIGHLIGHT_STYLES[unknown-token]" # \u - "25 29 $ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]" # zzzz' -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/dollar-quoted3.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/dollar-quoted3.zsh deleted file mode 100644 index 53ee171..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/dollar-quoted3.zsh +++ /dev/null @@ -1,38 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -# Similar to double-quoted2.zsh -ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=$unused_highlight -# This test checks that the '1' gets highlighted correctly. Do not append to the BUFFER. -BUFFER=": \$'\xa1" - -expected_region_highlight=( - "3 4 $ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]" # $' - "5 8 $ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]" # \xa1 -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/double-hyphen-option.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/double-hyphen-option.zsh deleted file mode 100644 index b87ebe8..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/double-hyphen-option.zsh +++ /dev/null @@ -1,35 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -ZSH_HIGHLIGHT_STYLES[double-hyphen-option]=$unused_highlight -BUFFER='hello --world' - -expected_region_highlight=( - "7 13 $ZSH_HIGHLIGHT_STYLES[double-hyphen-option]" # --world -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/double-quoted.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/double-quoted.zsh deleted file mode 100644 index 3f80f9e..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/double-quoted.zsh +++ /dev/null @@ -1,45 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -BUFFER=': "foo$bar:\`:\":\$:' -BUFFER+=\\\\:\" - -expected_region_highlight=( - "3 6 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # "foo - "7 10 $ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]" # $bar - "11 11 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # : - "12 13 $ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]" # \` - "14 14 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # : - "15 16 $ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]" # \$ - "17 17 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # : - "18 19 $ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]" # \" - "20 20 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # : - "21 22 $ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]" # \\ - "23 24 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # :" -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/double-quoted2.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/double-quoted2.zsh deleted file mode 100644 index d3facb2..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/double-quoted2.zsh +++ /dev/null @@ -1,37 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 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 -# ------------------------------------------------------------------------------------------------- - -# Similar to dollar-quoted3.zsh -# This test checks that the 'r' gets highlighted correctly. Do not append to the BUFFER. -BUFFER=': "foo$bar' - -expected_region_highlight=( - "3 6 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # "foo - "7 10 $ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]" # $bar -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/double-quoted3.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/double-quoted3.zsh deleted file mode 100644 index 6b9001c..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/double-quoted3.zsh +++ /dev/null @@ -1,39 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 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=': "$" "$42foo"' -BUFFER+=\ \"\\\'\\x\" - -expected_region_highlight=( - "3 5 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # "$" - "7 7 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # " - "8 10 $ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]" # $42 - "11 14 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # foo" - "16 21 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # "\'\x" - \' and \x are not escape sequences -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/empty-command.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/empty-command.zsh deleted file mode 100644 index 9e4b13f..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/empty-command.zsh +++ /dev/null @@ -1,35 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -BUFFER='echo; ;' - -expected_region_highlight=( - "5 5 $ZSH_HIGHLIGHT_STYLES[commandseparator]" # ; - "7 7 $ZSH_HIGHLIGHT_STYLES[unknown-token]" # ; -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/function.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/function.zsh deleted file mode 100644 index 3e579ab..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/function.zsh +++ /dev/null @@ -1,47 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -ZSH_HIGHLIGHT_STYLES[function]=$unused_highlight -cd() { - builtin cd "$@" -} -ls() { - command ls "$@" -} -BUFFER='cd;ls' - -# Use $unused_highlight to see that function highlighting has precedence over command and builtin - -expected_region_highlight=( - "1 2 $ZSH_HIGHLIGHT_STYLES[function]" # cd - "4 5 $ZSH_HIGHLIGHT_STYLES[function]" # ls -) - -# don't 'unfunction cd ls', since cd() and ls() should still be a functions -# when _zsh_highlight runs. Leaving the wrapper functions is harmless. diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/glob.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/glob.zsh deleted file mode 100644 index d808e2b..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/glob.zsh +++ /dev/null @@ -1,38 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -BUFFER=': foo* bar? *baz qux\?' - -expected_region_highlight=( - "1 1 $ZSH_HIGHLIGHT_STYLES[builtin]" # : - "3 6 $ZSH_HIGHLIGHT_STYLES[globbing]" # foo* - "8 11 $ZSH_HIGHLIGHT_STYLES[globbing]" # bar? - "13 16 $ZSH_HIGHLIGHT_STYLES[globbing]" # *baz - "18 22 $ZSH_HIGHLIGHT_STYLES[default]" # qux\? -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/hashed-command.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/hashed-command.zsh deleted file mode 100644 index ce41b45..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/hashed-command.zsh +++ /dev/null @@ -1,36 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -hash zsh_syntax_highlighting_hash=/doesnotexist -ZSH_HIGHLIGHT_STYLES[hashed-command]=$unused_highlight -BUFFER='zsh_syntax_highlighting_hash' - -expected_region_highlight=( - "1 28 $ZSH_HIGHLIGHT_STYLES[hashed-command]" -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/history-expansion.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/history-expansion.zsh deleted file mode 100644 index c670312..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/history-expansion.zsh +++ /dev/null @@ -1,36 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -BUFFER='!foo bar !baz' - -expected_region_highlight=( - "1 4 $ZSH_HIGHLIGHT_STYLES[history-expansion]" # !foo - "6 8 $ZSH_HIGHLIGHT_STYLES[default]" # bar - "10 13 $ZSH_HIGHLIGHT_STYLES[history-expansion]" # !baz -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/history-expansion2.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/history-expansion2.zsh deleted file mode 100644 index 45af624..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/history-expansion2.zsh +++ /dev/null @@ -1,34 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -BUFFER='^foo^bar' - -expected_region_highlight=( - "1 8 $ZSH_HIGHLIGHT_STYLES[history-expansion]" # ^foo^bar -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/multiline-string.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/multiline-string.zsh deleted file mode 100644 index 987dd20..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/multiline-string.zsh +++ /dev/null @@ -1,36 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -PREBUFFER=$'echo "foo1\n' -BUFFER='foo2" ./' - -expected_region_highlight=( - "1 5 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # 'foo2"' - "7 8 $ZSH_HIGHLIGHT_STYLES[path]" # './' -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/multiline-string2.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/multiline-string2.zsh deleted file mode 100644 index 9753e5d..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/multiline-string2.zsh +++ /dev/null @@ -1,35 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -ZSH_HIGHLIGHT_STYLES[double-quoted-argument]=$unused_highlight -BUFFER=$'echo "foo1\n' - -expected_region_highlight=( - "6 10 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # 'foo2"' -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/multiple-redirections.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/multiple-redirections.zsh deleted file mode 100644 index 374de8a..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/multiple-redirections.zsh +++ /dev/null @@ -1,46 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 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='ps aux | grep java | sort | uniq | tail | head' - -expected_region_highlight=( - "1 2 $ZSH_HIGHLIGHT_STYLES[command]" # ps - "4 6 $ZSH_HIGHLIGHT_STYLES[default]" # aux - "8 8 $ZSH_HIGHLIGHT_STYLES[default]" # | - "10 13 $ZSH_HIGHLIGHT_STYLES[command]" # grep - "15 18 $ZSH_HIGHLIGHT_STYLES[default]" # java - "20 20 $ZSH_HIGHLIGHT_STYLES[default]" # | - "22 25 $ZSH_HIGHLIGHT_STYLES[command]" # sort - "27 27 $ZSH_HIGHLIGHT_STYLES[default]" # | - "29 32 $ZSH_HIGHLIGHT_STYLES[command]" # uniq - "34 34 $ZSH_HIGHLIGHT_STYLES[default]" # | - "36 39 $ZSH_HIGHLIGHT_STYLES[command]" # tail - "41 41 $ZSH_HIGHLIGHT_STYLES[default]" # | - "43 46 $ZSH_HIGHLIGHT_STYLES[command]" # head -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/noglob-alias.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/noglob-alias.zsh deleted file mode 100644 index 44d253a..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/noglob-alias.zsh +++ /dev/null @@ -1,35 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 x=command -BUFFER='x ls' - -expected_region_highlight=( - "3 4 $ZSH_HIGHLIGHT_STYLES[command]" # ls -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/noglob1.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/noglob1.zsh deleted file mode 100644 index d9bc69b..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/noglob1.zsh +++ /dev/null @@ -1,34 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -BUFFER=':; noglob echo *' - -expected_region_highlight=( - "16 16 $ZSH_HIGHLIGHT_STYLES[default]" # * -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/noglob2.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/noglob2.zsh deleted file mode 100644 index 2c19250..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/noglob2.zsh +++ /dev/null @@ -1,35 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -BUFFER='noglob echo *; echo *' - -expected_region_highlight=( - "13 13 $ZSH_HIGHLIGHT_STYLES[default]" # * - "21 21 $ZSH_HIGHLIGHT_STYLES[globbing]" # * -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/path-space- .zsh b/zsh-syntax-highlighting/highlighters/main/test-data/path-space- .zsh deleted file mode 100644 index f6b889e..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/path-space- .zsh +++ /dev/null @@ -1,35 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 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='ls highlighters/main/test-data/path-space-\ .zsh' - -expected_region_highlight=( - "1 2 $ZSH_HIGHLIGHT_STYLES[command]" # ls - "4 48 $ZSH_HIGHLIGHT_STYLES[path]" # highlighters/main/test-data/path-space-\ .zsh -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/path-tilde-home.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/path-tilde-home.zsh deleted file mode 100644 index 31ad1e9..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/path-tilde-home.zsh +++ /dev/null @@ -1,36 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 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 -# ------------------------------------------------------------------------------------------------- - -HOME="." -BUFFER='ls ~' - -expected_region_highlight=( - "1 2 $ZSH_HIGHLIGHT_STYLES[command]" # ls - "4 4 $ZSH_HIGHLIGHT_STYLES[path]" # ~ -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/path-tilde-home2.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/path-tilde-home2.zsh deleted file mode 100644 index 18dd17b..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/path-tilde-home2.zsh +++ /dev/null @@ -1,37 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -HOME="/nonexistent" -BUFFER='ls ~' - -expected_region_highlight=( - "1 2 $ZSH_HIGHLIGHT_STYLES[command]" # ls - "4 4 $ZSH_HIGHLIGHT_STYLES[default]" # ~ -) - diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/path-tilde-named.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/path-tilde-named.zsh deleted file mode 100644 index be5bb5a..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/path-tilde-named.zsh +++ /dev/null @@ -1,37 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -hash -d D=highlighters/main/test-data - -BUFFER='ls ~D/path-tilde-named.zsh' - -expected_region_highlight=( - "1 2 $ZSH_HIGHLIGHT_STYLES[command]" # ls - "4 26 $ZSH_HIGHLIGHT_STYLES[path]" # ~D/path-tilde-named.zsh -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/path.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/path.zsh deleted file mode 100644 index 3688b9b..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/path.zsh +++ /dev/null @@ -1,35 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 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='ls highlighters/main/test-data/path.zsh' - -expected_region_highlight=( - "1 2 $ZSH_HIGHLIGHT_STYLES[command]" # ls - "4 39 $ZSH_HIGHLIGHT_STYLES[path]" # highlighters/main/test-data/path.zsh -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/path_prefix.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/path_prefix.zsh deleted file mode 100644 index 17cd26c..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/path_prefix.zsh +++ /dev/null @@ -1,38 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -# Assumes that '/bin/sh' exists and '/bin/s' does not exist. -# Related to path_prefix2.zsh - -ZSH_HIGHLIGHT_STYLES[path_prefix]=$unused_highlight -BUFFER='ls /bin/s' - -expected_region_highlight=( - "4 9 $ZSH_HIGHLIGHT_STYLES[path_prefix]" # /bin/s -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/path_prefix2.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/path_prefix2.zsh deleted file mode 100644 index a1974eb..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/path_prefix2.zsh +++ /dev/null @@ -1,39 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -# Assumes that '/bin/sh' exists and '/bin/s' does not exist. -# Related to path_prefix.zsh - -ZSH_HIGHLIGHT_STYLES[path_prefix]=$unused_highlight -BUFFER='ls /bin/s' -WIDGET=accept-line - -expected_region_highlight=( - "4 9 $ZSH_HIGHLIGHT_STYLES[default]" # /bin/s -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/precommand.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/precommand.zsh deleted file mode 100644 index 156b72d..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/precommand.zsh +++ /dev/null @@ -1,37 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -ZSH_HIGHLIGHT_STYLES[assign]=$unused_highlight -BUFFER=': command zzzzzz' - -expected_region_highlight=( - "1 1 $ZSH_HIGHLIGHT_STYLES[command]" # ls - "3 9 $ZSH_HIGHLIGHT_STYLES[default]" # not precommand - "11 16 $ZSH_HIGHLIGHT_STYLES[default]" # not unknown-token (since 'zzzzzz' is not a command) -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/prefix-redirection.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/prefix-redirection.zsh deleted file mode 100644 index 0eddf0f..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/prefix-redirection.zsh +++ /dev/null @@ -1,39 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -BUFFER='>/tmp >/tmp sudo echo >/tmp foo' - -expected_region_highlight=( - "2 5 $ZSH_HIGHLIGHT_STYLES[path]" # /tmp - "8 11 $ZSH_HIGHLIGHT_STYLES[path]" # /tmp - "13 16 $ZSH_HIGHLIGHT_STYLES[precommand]" # sudo - "18 21 $ZSH_HIGHLIGHT_STYLES[builtin]" # echo - "24 27 $ZSH_HIGHLIGHT_STYLES[path]" # /tmp - "29 31 $ZSH_HIGHLIGHT_STYLES[default]" # foo -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/redirection.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/redirection.zsh deleted file mode 100644 index 7515352..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/redirection.zsh +++ /dev/null @@ -1,37 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -# Redirection before and after the command word are implemented differently; test both. -ZSH_HIGHLIGHT_STYLES[redirection]=$unused_highlight -BUFFER='<<>&!bar' - -expected_region_highlight=( - "1 3 $ZSH_HIGHLIGHT_STYLES[redirection]" # <<< - "13 16 $ZSH_HIGHLIGHT_STYLES[redirection]" # >>&! -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/reserved-word.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/reserved-word.zsh deleted file mode 100644 index 2f62103..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/reserved-word.zsh +++ /dev/null @@ -1,38 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -ZSH_HIGHLIGHT_STYLES[reserved-word]=$unused_highlight -BUFFER='repeat "1" do done' - -expected_region_highlight=( - "1 6 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # repeat - "8 10 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # "1" - "12 13 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # do - "15 18 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # done -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/simple-command.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/simple-command.zsh deleted file mode 100644 index 51dd9a9..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/simple-command.zsh +++ /dev/null @@ -1,34 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 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='ls' - -expected_region_highlight=( - "1 2 $ZSH_HIGHLIGHT_STYLES[command]" # ls -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/simple-redirection.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/simple-redirection.zsh deleted file mode 100644 index 191c67e..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/simple-redirection.zsh +++ /dev/null @@ -1,38 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -BUFFER='ps aux | grep java' - -expected_region_highlight=( - "1 2 $ZSH_HIGHLIGHT_STYLES[command]" # ps - "4 6 $ZSH_HIGHLIGHT_STYLES[default]" # aux - "8 8 $ZSH_HIGHLIGHT_STYLES[default]" # | - "10 13 $ZSH_HIGHLIGHT_STYLES[command]" # grep - "15 18 $ZSH_HIGHLIGHT_STYLES[default]" # java -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/subshell.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/subshell.zsh deleted file mode 100644 index 3e98476..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/subshell.zsh +++ /dev/null @@ -1,41 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -BUFFER='tar cf - * | (cd /target; tar xfp -) | { cat }' - -expected_region_highlight=( - "1 3 $ZSH_HIGHLIGHT_STYLES[command]" # tar - "14 14 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # ( - "15 16 $ZSH_HIGHLIGHT_STYLES[command]" # cd - "27 29 $ZSH_HIGHLIGHT_STYLES[command]" # tar - "36 36 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # ) - "40 40 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # { - "42 44 $ZSH_HIGHLIGHT_STYLES[command]" # cat - "46 46 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # } -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/sudo-command.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/sudo-command.zsh deleted file mode 100644 index ec1ccff..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/sudo-command.zsh +++ /dev/null @@ -1,47 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=$unused_highlight -# Tests three codepaths: -# * -i (no argument) -# * -C3 (pasted argument) -# * -u otheruser (non-pasted argument) -BUFFER='sudo -C3 -u otheruser -i ls /; sudo ; sudo -u ;' - -expected_region_highlight=( - "1 4 $ZSH_HIGHLIGHT_STYLES[precommand]" # sudo - "6 8 $ZSH_HIGHLIGHT_STYLES[single-hyphen-option]" # -C3 - "10 11 $ZSH_HIGHLIGHT_STYLES[single-hyphen-option]" # -u - "13 21 $ZSH_HIGHLIGHT_STYLES[default]" # otheruser - "23 24 $ZSH_HIGHLIGHT_STYLES[single-hyphen-option]" # -i - "26 27 $ZSH_HIGHLIGHT_STYLES[command]" # ls - "29 29 $ZSH_HIGHLIGHT_STYLES[path]" # / - "37 37 $ZSH_HIGHLIGHT_STYLES[unknown-token]" # ;, error because empty command - "47 47 $ZSH_HIGHLIGHT_STYLES[unknown-token]" # ;, error because incomplete command -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/sudo-comment.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/sudo-comment.zsh deleted file mode 100644 index 8a70ae3..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/sudo-comment.zsh +++ /dev/null @@ -1,38 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=$unused_highlight -setopt interactive_comments -BUFFER='sudo -u # comment' - -expected_region_highlight=( - "1 4 $ZSH_HIGHLIGHT_STYLES[precommand]" # sudo - "6 7 $ZSH_HIGHLIGHT_STYLES[single-hyphen-option]" # -u - "9 17 $ZSH_HIGHLIGHT_STYLES[unknown-token]" # "# comment" - error because argument missed -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/sudo-redirection.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/sudo-redirection.zsh deleted file mode 100644 index e31ce6e..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/sudo-redirection.zsh +++ /dev/null @@ -1,46 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -BUFFER='sudo -u >/tmp otheruser ls; sudo ls; sudo -i ls' - -expected_region_highlight=( - "1 4 $ZSH_HIGHLIGHT_STYLES[precommand]" # sudo - "6 7 $ZSH_HIGHLIGHT_STYLES[single-hyphen-option]" # -u - "9 9 $ZSH_HIGHLIGHT_STYLES[redirection]" # > - "10 13 $ZSH_HIGHLIGHT_STYLES[path]" # /tmp - "15 23 $ZSH_HIGHLIGHT_STYLES[default]" # otheruser - "25 26 $ZSH_HIGHLIGHT_STYLES[command]" # ls - "27 27 $ZSH_HIGHLIGHT_STYLES[commandseparator]" # ; - "29 32 $ZSH_HIGHLIGHT_STYLES[precommand]" # sudo - "34 35 $ZSH_HIGHLIGHT_STYLES[command]" # ls - "36 36 $ZSH_HIGHLIGHT_STYLES[commandseparator]" # ; - "38 41 $ZSH_HIGHLIGHT_STYLES[precommand]" # sudo - "43 44 $ZSH_HIGHLIGHT_STYLES[single-hyphen-option]" # -i - "46 47 $ZSH_HIGHLIGHT_STYLES[command]" # ls -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/sudo-redirection2.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/sudo-redirection2.zsh deleted file mode 100644 index f806178..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/sudo-redirection2.zsh +++ /dev/null @@ -1,39 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -BUFFER='sudo >/tmp -u otheruser ls' - -expected_region_highlight=( - "1 4 $ZSH_HIGHLIGHT_STYLES[precommand]" # sudo - "6 6 $ZSH_HIGHLIGHT_STYLES[redirection]" # > - "7 10 $ZSH_HIGHLIGHT_STYLES[path]" # /tmp - "12 13 $ZSH_HIGHLIGHT_STYLES[single-hyphen-option]" # -u - "15 23 $ZSH_HIGHLIGHT_STYLES[default]" # otheruser - "25 26 $ZSH_HIGHLIGHT_STYLES[command]" # ls -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/tilde-command-word.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/tilde-command-word.zsh deleted file mode 100644 index e66db8e..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/tilde-command-word.zsh +++ /dev/null @@ -1,37 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -hash -d D=/usr/bin - -BUFFER='~D/env foo' - -expected_region_highlight=( - "1 6 $ZSH_HIGHLIGHT_STYLES[command]" # ~D/env [= /usr/bin/env] - "8 10 $ZSH_HIGHLIGHT_STYLES[default]" # foo -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/unbackslash.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/unbackslash.zsh deleted file mode 100644 index b96c055..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/unbackslash.zsh +++ /dev/null @@ -1,35 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -ZSH_HIGHLIGHT_STYLES[command]=$unused_highlight -BUFFER='\sh' - -expected_region_highlight=( - "1 3 $ZSH_HIGHLIGHT_STYLES[command]" # \sh (runs 'sh', bypassing aliases) -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/unknown-command.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/unknown-command.zsh deleted file mode 100644 index 9b9e8d3..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/unknown-command.zsh +++ /dev/null @@ -1,34 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 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='azertyuiop' - -expected_region_highlight=( - "1 10 $ZSH_HIGHLIGHT_STYLES[unknown-token]" # azertyuiop -) diff --git a/zsh-syntax-highlighting/highlighters/main/test-data/vanilla-newline.zsh b/zsh-syntax-highlighting/highlighters/main/test-data/vanilla-newline.zsh deleted file mode 100644 index 7fa9ba2..0000000 --- a/zsh-syntax-highlighting/highlighters/main/test-data/vanilla-newline.zsh +++ /dev/null @@ -1,39 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -PREBUFFER=$'echo foo; echo bar\n\n\n' -BUFFER=' echo baz; echo qux' - -expected_region_highlight=( - "2 5 $ZSH_HIGHLIGHT_STYLES[builtin]" # echo - "7 9 $ZSH_HIGHLIGHT_STYLES[default]" # baz - "10 10 $ZSH_HIGHLIGHT_STYLES[commandseparator]" # semicolon - "12 15 $ZSH_HIGHLIGHT_STYLES[builtin]" # echo - "17 19 $ZSH_HIGHLIGHT_STYLES[default]" # qux -) diff --git a/zsh-syntax-highlighting/highlighters/pattern/README.md b/zsh-syntax-highlighting/highlighters/pattern/README.md deleted file mode 100644 index 82a7c65..0000000 --- a/zsh-syntax-highlighting/highlighters/pattern/README.md +++ /dev/null @@ -1,21 +0,0 @@ -zsh-syntax-highlighting / highlighters / pattern -================================================ - -This is the ***pattern*** highlighter, that highlights user defined patterns. - - -How to activate it ------------------- -To activate it, add it to `ZSH_HIGHLIGHT_HIGHLIGHTERS`: - - ZSH_HIGHLIGHT_HIGHLIGHTERS=( [...] pattern) - - -How to tweak it ---------------- -To use this highlighter, associate patterns with styles in the `ZSH_HIGHLIGHT_PATTERNS` array, for example in `~/.zshrc`: - - # To have commands starting with `rm -rf` in red: - ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=red') - -The syntax for declaring styles is [documented here](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#SEC135). diff --git a/zsh-syntax-highlighting/highlighters/pattern/pattern-highlighter.zsh b/zsh-syntax-highlighting/highlighters/pattern/pattern-highlighter.zsh deleted file mode 100644 index 4e2eabd..0000000 --- a/zsh-syntax-highlighting/highlighters/pattern/pattern-highlighter.zsh +++ /dev/null @@ -1,60 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 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 -# ------------------------------------------------------------------------------------------------- - - -# List of keyword and color pairs. -typeset -gA ZSH_HIGHLIGHT_PATTERNS - -# Whether the pattern highlighter should be called or not. -_zsh_highlight_pattern_highlighter_predicate() -{ - _zsh_highlight_buffer_modified -} - -# Pattern syntax highlighting function. -_zsh_highlight_pattern_highlighter() -{ - setopt localoptions extendedglob - local pattern - for pattern in ${(k)ZSH_HIGHLIGHT_PATTERNS}; do - _zsh_highlight_pattern_highlighter_loop "$BUFFER" "$pattern" - done -} - -_zsh_highlight_pattern_highlighter_loop() -{ - # This does *not* do its job syntactically, sorry. - local buf="$1" pat="$2" - local -a match mbegin mend - local MATCH; integer MBEGIN MEND - if [[ "$buf" == (#b)(*)(${~pat})* ]]; then - region_highlight+=("$((mbegin[2] - 1)) $mend[2] $ZSH_HIGHLIGHT_PATTERNS[$pat]") - "$0" "$match[1]" "$pat"; return $? - fi -} diff --git a/zsh-syntax-highlighting/highlighters/root/README.md b/zsh-syntax-highlighting/highlighters/root/README.md deleted file mode 100644 index 53c871b..0000000 --- a/zsh-syntax-highlighting/highlighters/root/README.md +++ /dev/null @@ -1,24 +0,0 @@ -zsh-syntax-highlighting / highlighters / root -================================================= - -This is the ***root*** highlighter, that highlights the whole line if the current user is root. - - -How to activate it ------------------- -To activate it, add it to `ZSH_HIGHLIGHT_HIGHLIGHTERS`: - - ZSH_HIGHLIGHT_HIGHLIGHTERS=( [...] root) - - -How to tweak it ---------------- -This highlighter defines the following styles: - -* `root` - the style for the whole line if the current user is root. - -To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`, for example in `~/.zshrc`: - - ZSH_HIGHLIGHT_STYLES[root]='bg=red' - -The syntax for declaring styles is [documented here](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#SEC135). diff --git a/zsh-syntax-highlighting/highlighters/root/root-highlighter.zsh b/zsh-syntax-highlighting/highlighters/root/root-highlighter.zsh deleted file mode 100644 index 4362379..0000000 --- a/zsh-syntax-highlighting/highlighters/root/root-highlighter.zsh +++ /dev/null @@ -1,44 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 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 -# ------------------------------------------------------------------------------------------------- - - -# Define default styles. -: ${ZSH_HIGHLIGHT_STYLES[root]:=standout} - -# Whether the root highlighter should be called or not. -_zsh_highlight_root_highlighter_predicate() -{ - _zsh_highlight_buffer_modified -} - -# root highlighting function. -_zsh_highlight_root_highlighter() -{ - if [[ $(command id -u) -eq 0 ]] { region_highlight+=("0 $#BUFFER $ZSH_HIGHLIGHT_STYLES[root]") } -} diff --git a/zsh-syntax-highlighting/images/preview-smaller.png b/zsh-syntax-highlighting/images/preview-smaller.png deleted file mode 100644 index 6fb84d1..0000000 Binary files a/zsh-syntax-highlighting/images/preview-smaller.png and /dev/null differ diff --git a/zsh-syntax-highlighting/images/preview.png b/zsh-syntax-highlighting/images/preview.png deleted file mode 100644 index 545cc51..0000000 Binary files a/zsh-syntax-highlighting/images/preview.png and /dev/null differ diff --git a/zsh-syntax-highlighting/release.md b/zsh-syntax-highlighting/release.md deleted file mode 100644 index a38d677..0000000 --- a/zsh-syntax-highlighting/release.md +++ /dev/null @@ -1,15 +0,0 @@ -# Release procedure (for developers): - -- Check open issues and outstanding pull requests -- Confirm `make test` passes - - check with multiple zsh versions -- Update changelog.md -- Remove `-dev` suffix from `./.version`; - Commit that; - Tag it using `git tag $(<.version)`; - Increment `./.version` and restore the `-dev` suffix; - Commit that. -- Push with `git push --tags` -- Notify downstreams (OS packages) - - anitya should autodetect the tag -- Update /topic on IRC diff --git a/zsh-syntax-highlighting/tests/README.md b/zsh-syntax-highlighting/tests/README.md deleted file mode 100644 index e82a64b..0000000 --- a/zsh-syntax-highlighting/tests/README.md +++ /dev/null @@ -1,38 +0,0 @@ -zsh-syntax-highlighting / tests -=============================== - -Utility scripts for testing zsh-syntax-highlighting highlighters. - -The tests expect the highlighter directory to contain a `test-data` directory with test data files. See the [main highlighter](../highlighters/main/test-data) for examples. - -Each test should define the array parameter `$expected_region_highlight`. -The value of that parameter is a list of `"$i $j $style [$todo]"` strings. -Each string specifies the highlighting that `$BUFFER[$i,$j]` should have; -that is, `$i` and `$j` specify a range, 1-indexed, inclusive of both endpoints. -If `$todo` exists, the test point is marked as TODO (the failure of that test point will not fail the test), and `$todo` is used as the explanation. - -_Note_: `$region_highlight` uses the same `"$i $j $style"` syntax but interprets the indexes differently. - - -highlighting test ------------------ -[`test-highlighting.zsh`](tests/test-highlighting.zsh) tests the correctness of the highlighting. Usage: - - zsh test-highlighting.zsh - -All tests may be run with - - make test - -which will run all highlighting tests and report results in [TAP](http://testanything.org/) format. - - -performance test ----------------- -[`test-perfs.zsh`](tests/test-perfs.zsh) measures the time spent doing the highlighting. Usage: - - zsh test-perfs.zsh - -All tests may be run with - - make perf diff --git a/zsh-syntax-highlighting/tests/tap-colorizer.zsh b/zsh-syntax-highlighting/tests/tap-colorizer.zsh deleted file mode 100755 index cb645c6..0000000 --- a/zsh-syntax-highlighting/tests/tap-colorizer.zsh +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# 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 -# ------------------------------------------------------------------------------------------------- - -# This is a stdin-to-stdout filter that takes TAP output (such as 'make test') -# on stdin and passes it, colorized, to stdout. - -emulate -LR zsh - -if [[ ! -t 1 ]] ; then - exec cat -fi - -while read -r line; -do - case $line in - # comment (filename header) or plan - (#* | <->..<->) - print -nP %F{blue} - ;; - # XPASS - (ok*# TODO*) - print -nP %F{red} - ;; - # XFAIL - (not ok*# TODO*) - print -nP %F{yellow} - ;; - # FAIL - (not ok*) - print -nP %F{red} - ;; - # PASS - (ok*) - print -nP %F{green} - ;; - esac - print -nr - "$line" - print -nP %f - echo "" # newline -done diff --git a/zsh-syntax-highlighting/tests/test-highlighting.zsh b/zsh-syntax-highlighting/tests/test-highlighting.zsh deleted file mode 100755 index 1eed974..0000000 --- a/zsh-syntax-highlighting/tests/test-highlighting.zsh +++ /dev/null @@ -1,118 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-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 -# ------------------------------------------------------------------------------------------------- - - -# Check an highlighter was given as argument. -[[ -n "$1" ]] || { - echo >&2 "Bail out! You must provide the name of a valid highlighter as argument." - exit 2 -} - -# Check the highlighter is valid. -[[ -f ${0:h:h}/highlighters/$1/$1-highlighter.zsh ]] || { - echo >&2 "Bail out! Could not find highlighter '$1'." - exit 2 -} - -# Check the highlighter has test data. -[[ -d ${0:h:h}/highlighters/$1/test-data ]] || { - echo >&2 "Bail out! Highlighter '$1' has no test data." - exit 2 -} - -# Load the main script. -. ${0:h:h}/zsh-syntax-highlighting.zsh - -# Activate the highlighter. -ZSH_HIGHLIGHT_HIGHLIGHTERS=($1) - -# Runs a highlighting test -# $1: data file -run_test() { - local -a highlight_zone - local unused_highlight='bg=red,underline' # a style unused by anything else, for tests to use - - echo "# ${1:t:r}" - - # Load the data and prepare checking it. - PREBUFFER= BUFFER= ; - . "$1" - - # Check the data declares $PREBUFFER or $BUFFER. - [[ -z $PREBUFFER && -z $BUFFER ]] && { echo >&2 "Bail out! Either 'PREBUFFER' or 'BUFFER' must be declared and non-blank"; return 1; } - # Check the data declares $expected_region_highlight. - (( ${#expected_region_highlight} == 0 )) && { echo >&2 "Bail out! 'expected_region_highlight' is not declared or empty."; return 1; } - - # Process the data. - region_highlight=() - _zsh_highlight - - # Overlapping regions can be declared in region_highlight, so we first build an array of the - # observed highlighting. - local -A observed_result - for ((i=1; i<=${#region_highlight}; i++)); do - highlight_zone=${(z)region_highlight[$i]} - integer start=$highlight_zone[1] end=$highlight_zone[2] - if (( start < end )) # region_highlight ranges are half-open - then - (( --end )) # convert to closed range, like expected_region_highlight - (( ++start, ++end )) # region_highlight is 0-indexed; expected_region_highlight is 1-indexed - for j in {$start..$end}; do - observed_result[$j]=$highlight_zone[3] - done - else - # noop range; ignore. - fi - done - - # Then we compare the observed result with the expected one. - echo "1..${#expected_region_highlight}" - for ((i=1; i<=${#expected_region_highlight}; i++)); do - local todo= - highlight_zone=${(z)expected_region_highlight[$i]} - [[ -n "$highlight_zone[4]" ]] && todo=" # TODO $highlight_zone[4]" - for j in {$highlight_zone[1]..$highlight_zone[2]}; do - if [[ "$observed_result[$j]" != "$highlight_zone[3]" ]]; then - echo "not ok $i '$BUFFER[$highlight_zone[1],$highlight_zone[2]]' [$highlight_zone[1],$highlight_zone[2]]: expected '$highlight_zone[3]', observed '$observed_result[$j]'.$todo" - continue 2 - fi - done - echo "ok $i$todo" - done -} - -# Process each test data file in test data directory. -integer something_failed=0 -for data_file in ${0:h:h}/highlighters/$1/test-data/*.zsh; do - (run_test "$data_file") | tee >(${0:A:h}/tap-colorizer.zsh) | grep -v '^not ok.*# TODO' | grep -q '^not ok\|^ok.*# TODO' && (( something_failed=1 )) - (( $pipestatus[1] )) && exit 2 -done - -exit $something_failed diff --git a/zsh-syntax-highlighting/tests/test-perfs.zsh b/zsh-syntax-highlighting/tests/test-perfs.zsh deleted file mode 100755 index 0d4adc3..0000000 --- a/zsh-syntax-highlighting/tests/test-perfs.zsh +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 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 -# ------------------------------------------------------------------------------------------------- - - -# Check an highlighter was given as argument. -[[ -n "$1" ]] || { - echo "You must provide the name of a valid highlighter as argument." >&2 - exit 1 -} - -# Check the highlighter is valid. -[[ -f ${0:h:h}/highlighters/$1/$1-highlighter.zsh ]] || { - echo "Could not find highlighter '$1'." >&2 - exit 1 -} - -# Check the highlighter has test data. -[[ -d ${0:h:h}/highlighters/$1/test-data ]] || { - echo "Highlighter '$1' has no test data." >&2 - exit 1 -} - -# Load the main script. -. ${0:h:h}/zsh-syntax-highlighting.zsh - -# Activate the highlighter. -ZSH_HIGHLIGHT_HIGHLIGHTERS=($1) - -# Process each test data file in test data directory. -for data_file in ${0:h:h}/highlighters/$1/test-data/*; do - - # Load the data and prepare checking it. - BUFFER= - echo -n "* ${data_file:t:r}: " - . $data_file - - # Check the data declares $BUFFER. - if [[ ${#BUFFER} -eq 0 ]]; then - echo "KO\n - 'BUFFER' is not declared or blank." - else - - # Measure the time taken by _zsh_highlight. - TIMEFMT="%*Es" - time ( BUFFER="$BUFFER" && _zsh_highlight) - - fi - -done diff --git a/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh b/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh deleted file mode 120000 index cc95cd4..0000000 --- a/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh +++ /dev/null @@ -1 +0,0 @@ -zsh-syntax-highlighting.zsh \ No newline at end of file diff --git a/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh deleted file mode 100644 index 1d63dbf..0000000 --- a/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +++ /dev/null @@ -1,281 +0,0 @@ -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-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 -# ------------------------------------------------------------------------------------------------- - - -if [[ -o function_argzero ]]; then - # $0 is reliable - ZSH_HIGHLIGHT_VERSION=$(<"$0:A:h"/.version) - ZSH_HIGHLIGHT_REVISION=$(<"$0:A:h"/.revision-hash) - if [[ $ZSH_HIGHLIGHT_REVISION == \$Format:* ]]; then - # When running from a source tree without 'make install', $ZSH_HIGHLIGHT_REVISION - # would be set to '$Format:%H$' literally. That's an invalid value, and obtaining - # the valid value (via `git rev-parse HEAD`, as Makefile does) might be costly, so: - unset ZSH_HIGHLIGHT_REVISION - fi -else - # $0 is unreliable, so the call to _zsh_highlight_load_highlighters will fail. - # TODO: If 'zmodload zsh/parameter' is available, ${funcsourcetrace[1]%:*} might serve as a substitute? - # TODO: also check POSIX_ARGZERO, but not it's not available in older zsh - echo "zsh-syntax-highlighting: error: not compatible with FUNCTION_ARGZERO" >&2 - return 1 -fi - -# ------------------------------------------------------------------------------------------------- -# Core highlighting update system -# ------------------------------------------------------------------------------------------------- - -# Array declaring active highlighters names. -typeset -ga ZSH_HIGHLIGHT_HIGHLIGHTERS - -# Update ZLE buffer syntax highlighting. -# -# Invokes each highlighter that needs updating. -# This function is supposed to be called whenever the ZLE state changes. -_zsh_highlight() -{ - # Store the previous command return code to restore it whatever happens. - local ret=$? - - setopt localoptions warncreateglobal - local REPLY # don't leak $REPLY into global scope - - # Do not highlight if there are more than 300 chars in the buffer. It's most - # likely a pasted command or a huge list of files in that case.. - [[ -n ${ZSH_HIGHLIGHT_MAXLENGTH:-} ]] && [[ $#BUFFER -gt $ZSH_HIGHLIGHT_MAXLENGTH ]] && return $ret - - # Do not highlight if there are pending inputs (copy/paste). - [[ $PENDING -gt 0 ]] && return $ret - - # Reset region highlight to build it from scratch - typeset -ga region_highlight - region_highlight=(); - - { - local cache_place - local -a region_highlight_copy - - # Select which highlighters in ZSH_HIGHLIGHT_HIGHLIGHTERS need to be invoked. - local highlighter; for highlighter in $ZSH_HIGHLIGHT_HIGHLIGHTERS; do - - # eval cache place for current highlighter and prepare it - cache_place="_zsh_highlight_${highlighter}_highlighter_cache" - typeset -ga ${cache_place} - - # If highlighter needs to be invoked - if "_zsh_highlight_${highlighter}_highlighter_predicate"; then - - # save a copy, and cleanup region_highlight - region_highlight_copy=("${region_highlight[@]}") - region_highlight=() - - # Execute highlighter and save result - { - "_zsh_highlight_${highlighter}_highlighter" - } always { - eval "${cache_place}=(\"\${region_highlight[@]}\")" - } - - # Restore saved region_highlight - region_highlight=("${region_highlight_copy[@]}") - - fi - - # Use value form cache if any cached - eval "region_highlight+=(\"\${${cache_place}[@]}\")" - - done - - # Re-apply zle_highlight settings - () { - if (( REGION_ACTIVE )) ; then - # zle_highlight[region] defaults to 'standout' if unspecified - local region="${${zle_highlight[(r)region:*]#region:}:-standout}" - integer start end - if (( MARK > CURSOR )) ; then - start=$CURSOR end=$MARK - else - start=$MARK end=$CURSOR - fi - region_highlight+=("$start $end $region") - fi - } - # YANK_ACTIVE is only available in zsh-5.1.1 and newer - (( $+YANK_ACTIVE )) && () { - if (( YANK_ACTIVE )) ; then - # zle_highlight[paste] defaults to 'standout' if unspecified - local paste="${${zle_highlight[(r)paste:*]#paste:}:-standout}" - integer start end - if (( YANK_END > YANK_START )) ; then - start=$YANK_START end=$YANK_END - else - start=$YANK_END end=$YANK_START - fi - region_highlight+=("$start $end $paste") - fi - } - - return $ret - - - } always { - typeset -g _ZSH_HIGHLIGHT_PRIOR_BUFFER="$BUFFER" - typeset -gi _ZSH_HIGHLIGHT_PRIOR_CURSOR=$CURSOR - } -} - - -# ------------------------------------------------------------------------------------------------- -# API/utility functions for highlighters -# ------------------------------------------------------------------------------------------------- - -# Array used by highlighters to declare user overridable styles. -typeset -gA ZSH_HIGHLIGHT_STYLES - -# Whether the command line buffer has been modified or not. -# -# Returns 0 if the buffer has changed since _zsh_highlight was last called. -_zsh_highlight_buffer_modified() -{ - [[ "${_ZSH_HIGHLIGHT_PRIOR_BUFFER:-}" != "$BUFFER" ]] -} - -# Whether the cursor has moved or not. -# -# Returns 0 if the cursor has moved since _zsh_highlight was last called. -_zsh_highlight_cursor_moved() -{ - [[ -n $CURSOR ]] && [[ -n ${_ZSH_HIGHLIGHT_PRIOR_CURSOR-} ]] && (($_ZSH_HIGHLIGHT_PRIOR_CURSOR != $CURSOR)) -} - - -# ------------------------------------------------------------------------------------------------- -# Setup functions -# ------------------------------------------------------------------------------------------------- - -# Helper for _zsh_highlight_bind_widgets -# $1 is name of widget to call -_zsh_highlight_call_widget() -{ - builtin zle "$@" && - _zsh_highlight -} - -# Rebind all ZLE widgets to make them invoke _zsh_highlights. -_zsh_highlight_bind_widgets() -{ - # Load ZSH module zsh/zleparameter, needed to override user defined widgets. - zmodload zsh/zleparameter 2>/dev/null || { - echo 'zsh-syntax-highlighting: failed loading zsh/zleparameter.' >&2 - return 1 - } - - # Override ZLE widgets to make them invoke _zsh_highlight. - local cur_widget - for cur_widget in ${${(f)"$(builtin zle -la)"}:#(.*|_*|orig-*|run-help|which-command|beep|set-local-history|yank)}; do - case $widgets[$cur_widget] in - - # Already rebound event: do nothing. - user:$cur_widget|user:_zsh_highlight_widget_*);; - - # User defined widget: override and rebind old one with prefix "orig-". - user:*) eval "zle -N orig-$cur_widget ${widgets[$cur_widget]#*:}; \ - _zsh_highlight_widget_$cur_widget() { _zsh_highlight_call_widget orig-$cur_widget \"\$@\" }; \ - zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; - - # Completion widget: override and rebind old one with prefix "orig-". - completion:*) eval "zle -C orig-$cur_widget ${${widgets[$cur_widget]#*:}/:/ }; \ - _zsh_highlight_widget_$cur_widget() { _zsh_highlight_call_widget orig-$cur_widget \"\$@\" }; \ - zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; - - # Builtin widget: override and make it call the builtin ".widget". - builtin) eval "_zsh_highlight_widget_$cur_widget() { _zsh_highlight_call_widget .$cur_widget \"\$@\" }; \ - zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; - - # Default: unhandled case. - *) echo "zsh-syntax-highlighting: unhandled ZLE widget '$cur_widget'" >&2 ;; - esac - done -} - -# Load highlighters from directory. -# -# Arguments: -# 1) Path to the highlighters directory. -_zsh_highlight_load_highlighters() -{ - # Check the directory exists. - [[ -d "$1" ]] || { - echo "zsh-syntax-highlighting: highlighters directory '$1' not found." >&2 - return 1 - } - - # Load highlighters from highlighters directory and check they define required functions. - local highlighter highlighter_dir - for highlighter_dir ($1/*/); do - highlighter="${highlighter_dir:t}" - [[ -f "$highlighter_dir/${highlighter}-highlighter.zsh" ]] && { - . "$highlighter_dir/${highlighter}-highlighter.zsh" - type "_zsh_highlight_${highlighter}_highlighter" &> /dev/null && - type "_zsh_highlight_${highlighter}_highlighter_predicate" &> /dev/null || { - echo "zsh-syntax-highlighting: '${highlighter}' highlighter should define both required functions '_zsh_highlight_${highlighter}_highlighter' and '_zsh_highlight_${highlighter}_highlighter_predicate' in '${highlighter_dir}/${highlighter}-highlighter.zsh'." >&2 - } - } - done -} - - -# ------------------------------------------------------------------------------------------------- -# Setup -# ------------------------------------------------------------------------------------------------- - -# Try binding widgets. -_zsh_highlight_bind_widgets || { - echo 'zsh-syntax-highlighting: failed binding ZLE widgets, exiting.' >&2 - return 1 -} - -# Resolve highlighters directory location. -_zsh_highlight_load_highlighters "${ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR:-${${0:A}:h}/highlighters}" || { - echo 'zsh-syntax-highlighting: failed loading highlighters, exiting.' >&2 - return 1 -} - -# Reset scratch variables when commandline is done. -_zsh_highlight_preexec_hook() -{ - typeset -g _ZSH_HIGHLIGHT_PRIOR_BUFFER= - typeset -gi _ZSH_HIGHLIGHT_PRIOR_CURSOR= -} -autoload -U add-zsh-hook -add-zsh-hook preexec _zsh_highlight_preexec_hook 2>/dev/null || { - echo 'zsh-syntax-highlighting: failed loading add-zsh-hook.' >&2 - } - -# Initialize the array of active highlighters if needed. -[[ $#ZSH_HIGHLIGHT_HIGHLIGHTERS -eq 0 ]] && ZSH_HIGHLIGHT_HIGHLIGHTERS=(main) || true