-
Couldn't load subscription status.
- Fork 1.4k
Fix function definition highlighting #563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -406,6 +406,7 @@ _zsh_highlight_main_highlighter_highlight_list() | |
| # - :regular: "Not a command word", and command delimiters are permitted. | ||
| # Mainly used to detect premature termination of commands. | ||
| # - :always: The word 'always' in the «{ foo } always { bar }» syntax. | ||
| # - :function: Function names after 'function' or before '()' | ||
| # | ||
| # 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 | ||
|
|
@@ -651,8 +652,8 @@ _zsh_highlight_main_highlighter_highlight_list() | |
|
|
||
| # The Great Fork: is this a command word? Is this a non-command word? | ||
| if [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:#"$arg"} ]]; then | ||
| if _zsh_highlight_main__stack_pop T || _zsh_highlight_main__stack_pop Q; then | ||
| # Missing closing square bracket(s) | ||
| if (( in_redirection )) || _zsh_highlight_main__stack_pop T || _zsh_highlight_main__stack_pop Q; then | ||
| # Unfinished redirection or missing closing square bracket(s) | ||
| style=unknown-token | ||
| elif [[ $this_word == *':regular:'* ]]; then | ||
| # This highlights empty commands (semicolon follows nothing) as an error. | ||
|
|
@@ -668,12 +669,39 @@ _zsh_highlight_main_highlighter_highlight_list() | |
| next_word=':start:' | ||
| highlight_glob=true | ||
| fi | ||
| elif ! (( in_redirection)) && [[ $this_word == *':always:'* && $arg == 'always' ]]; then | ||
| elif (( in_redirection )); then | ||
| if [[ $this_word == *:function:* ]]; then | ||
| this_word=':start:' | ||
| fi | ||
| if [[ $arg == ($'\x29'|'()') ]] || { [[ $arg == $'\x7d' ]] && $right_brace_is_recognised_everywhere }; then | ||
| style=unknown-token | ||
| else | ||
| _zsh_highlight_main_highlighter_highlight_argument 1 0 | ||
| continue | ||
| fi | ||
| elif [[ $this_word == *':always:'* && $arg == 'always' ]]; then | ||
| # try-always construct | ||
| style=reserved-word # de facto a reserved word, although not de jure | ||
| next_word=':start:' | ||
| elif ! (( in_redirection)) && [[ $this_word == *':start:'* ]]; then # $arg is the command word | ||
| if (( ${+precommand_options[$arg]} )) && _zsh_highlight_main__is_runnable $arg; then | ||
| elif [[ $this_word == *:function:* ]]; then | ||
| if [[ $arg == '()' ]]; then | ||
| style=reserved-word | ||
| next_word=':start:' | ||
| elif [[ $arg == $'\x7b' ]]; then | ||
| style=reserved-word | ||
| next_word=':start:' | ||
| braces_stack='Y'"$braces_stack" | ||
| else | ||
| style=function-definition | ||
| next_word=':function:' | ||
| fi | ||
| elif [[ $this_word == *':start:'* ]]; then # $arg is the command word | ||
| if [[ $res != reserved && $arg != '()' && ( $args[1] == '()' || | ||
| # TODO: Function names can be absurd; this handles the more common cases without invoking Cthulhu. | ||
| ( $zsyh_user_options[multifuncdef] == on && $args[(r)*[^[:alnum:]_-]*] == '()' ) ) ]]; then | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if we could do something along the line of "after There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, that's what I meant. "If one of the following words is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would probably be a better approach, but I'm not sure how to keep it fast or how to enumerate all of the invalid function names. (Aside |
||
| style=function-definition | ||
| next_word=:function: | ||
| elif (( ${+precommand_options[$arg]} )) && _zsh_highlight_main__is_runnable $arg; then | ||
| style=precommand | ||
| flags_with_argument=${precommand_options[$arg]%:*} | ||
| flags_sans_argument=${precommand_options[$arg]#*:} | ||
|
|
@@ -746,6 +774,10 @@ _zsh_highlight_main_highlighter_highlight_list() | |
| # | ||
| # The repeat-count word will be handled like a redirection target. | ||
| this_word=':start::regular:' | ||
| ;; | ||
| ('function') | ||
| next_word=':function:' | ||
| ;; | ||
| esac | ||
| ;; | ||
| 'suffix alias') style=suffix-alias;; | ||
|
|
@@ -831,8 +863,6 @@ _zsh_highlight_main_highlighter_highlight_list() | |
| style=assign | ||
| in_array_assignment=false | ||
| next_word+=':start:' | ||
| elif (( in_redirection )); then | ||
| style=unknown-token | ||
| else | ||
| if _zsh_highlight_main__stack_pop 'S'; then | ||
| REPLY=$start_pos | ||
|
|
@@ -841,24 +871,17 @@ _zsh_highlight_main_highlighter_highlight_list() | |
| fi | ||
| _zsh_highlight_main__stack_pop 'R' reserved-word | ||
| fi;; | ||
| $'\x28\x29') # possibly a function definition | ||
| if (( in_redirection )) || $in_array_assignment; then | ||
| style=unknown-token | ||
| else | ||
| if [[ $zsyh_user_options[multifuncdef] == on ]] || false # TODO: or if the previous word was a command word | ||
| then | ||
| next_word+=':start:' | ||
| fi | ||
| style=reserved-word | ||
| fi | ||
| '()') | ||
| # Function definition was handled above | ||
| style=unknown-token | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When can this happen? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or after a redirection or in an array assignment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about empty There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right now it's highlighted as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With this branch the |
||
| ;; | ||
| *) if false; then | ||
| elif [[ $arg = $'\x7d' ]] && $right_brace_is_recognised_everywhere; then | ||
| # Parsing rule: { | ||
| # | ||
| # Additionally, `tt(})' is recognized in any position if neither the | ||
| # tt(IGNORE_BRACES) option nor the tt(IGNORE_CLOSE_BRACES) option is set. | ||
| if (( in_redirection )) || $in_array_assignment; then | ||
| if $in_array_assignment; then | ||
| style=unknown-token | ||
| else | ||
| _zsh_highlight_main__stack_pop 'Y' reserved-word | ||
|
|
@@ -873,7 +896,7 @@ _zsh_highlight_main_highlighter_highlight_list() | |
| elif [[ $arg == $'\x5d' ]] && _zsh_highlight_main__stack_pop 'Q' builtin; then | ||
| : | ||
| else | ||
| _zsh_highlight_main_highlighter_highlight_argument 1 $(( 1 != in_redirection )) | ||
| _zsh_highlight_main_highlighter_highlight_argument 1 1 | ||
| continue | ||
| fi | ||
| ;; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #!/usr/bin/env zsh | ||
| # ------------------------------------------------------------------------------------------------- | ||
| # Copyright (c) 2018 zsh-syntax-highlighting contributors | ||
| # All rights reserved. | ||
| # | ||
| # Redistribution and use in source and binary forms, with or without modification, are permitted | ||
| # provided that the following conditions are met: | ||
| # | ||
| # * Redistributions of source code must retain the above copyright notice, this list of conditions | ||
| # and the following disclaimer. | ||
| # * Redistributions in binary form must reproduce the above copyright notice, this list of | ||
| # conditions and the following disclaimer in the documentation and/or other materials provided | ||
| # with the distribution. | ||
| # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors | ||
| # may be used to endorse or promote products derived from this software without specific prior | ||
| # written permission. | ||
| # | ||
| # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR | ||
| # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
| # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR | ||
| # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER | ||
| # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | ||
| # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| # ------------------------------------------------------------------------------------------------- | ||
| # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- | ||
| # vim: ft=zsh sw=2 ts=2 et | ||
| # ------------------------------------------------------------------------------------------------- | ||
|
|
||
| BUFFER='function foo () { : }' | ||
|
|
||
| expected_region_highlight=( | ||
| '1 8 reserved-word' # function | ||
| '10 12 function-definition' # foo | ||
| '14 15 reserved-word' # () | ||
| '17 17 reserved-word' # { | ||
| '19 19 builtin' # : | ||
| '21 21 reserved-word' # } | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| #!/usr/bin/env zsh | ||
| # ------------------------------------------------------------------------------------------------- | ||
| # Copyright (c) 2018 zsh-syntax-highlighting contributors | ||
| # All rights reserved. | ||
| # | ||
| # Redistribution and use in source and binary forms, with or without modification, are permitted | ||
| # provided that the following conditions are met: | ||
| # | ||
| # * Redistributions of source code must retain the above copyright notice, this list of conditions | ||
| # and the following disclaimer. | ||
| # * Redistributions in binary form must reproduce the above copyright notice, this list of | ||
| # conditions and the following disclaimer in the documentation and/or other materials provided | ||
| # with the distribution. | ||
| # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors | ||
| # may be used to endorse or promote products derived from this software without specific prior | ||
| # written permission. | ||
| # | ||
| # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR | ||
| # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
| # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR | ||
| # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER | ||
| # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | ||
| # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| # ------------------------------------------------------------------------------------------------- | ||
| # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- | ||
| # vim: ft=zsh sw=2 ts=2 et | ||
| # ------------------------------------------------------------------------------------------------- | ||
|
|
||
| setopt no_multifuncdef | ||
|
|
||
| BUFFER='foo bar () { : }' | ||
|
|
||
| expected_region_highlight=( | ||
| '1 3 unknown-token' # foo | ||
| '5 7 default' # bar | ||
| '9 10 unknown-token' # () | ||
| '12 12 default' # { | ||
| '14 14 default' # : | ||
| '16 16 unknown-token' # } | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #!/usr/bin/env zsh | ||
| # ------------------------------------------------------------------------------------------------- | ||
| # Copyright (c) 2018 zsh-syntax-highlighting contributors | ||
| # All rights reserved. | ||
| # | ||
| # Redistribution and use in source and binary forms, with or without modification, are permitted | ||
| # provided that the following conditions are met: | ||
| # | ||
| # * Redistributions of source code must retain the above copyright notice, this list of conditions | ||
| # and the following disclaimer. | ||
| # * Redistributions in binary form must reproduce the above copyright notice, this list of | ||
| # conditions and the following disclaimer in the documentation and/or other materials provided | ||
| # with the distribution. | ||
| # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors | ||
| # may be used to endorse or promote products derived from this software without specific prior | ||
| # written permission. | ||
| # | ||
| # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR | ||
| # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
| # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR | ||
| # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER | ||
| # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | ||
| # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| # ------------------------------------------------------------------------------------------------- | ||
| # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- | ||
| # vim: ft=zsh sw=2 ts=2 et | ||
| # ------------------------------------------------------------------------------------------------- | ||
|
|
||
| BUFFER=$'foo bar () { : }' | ||
|
|
||
| expected_region_highlight=( | ||
| '1 3 function-definition' # foo | ||
| '5 7 function-definition' # bar | ||
| '9 10 reserved-word' # () | ||
| '12 12 reserved-word' # { | ||
| '14 14 builtin' # : | ||
| '16 16 reserved-word' # } | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| #!/usr/bin/env zsh | ||
| # ------------------------------------------------------------------------------------------------- | ||
| # Copyright (c) 2018 zsh-syntax-highlighting contributors | ||
| # All rights reserved. | ||
| # | ||
| # Redistribution and use in source and binary forms, with or without modification, are permitted | ||
| # provided that the following conditions are met: | ||
| # | ||
| # * Redistributions of source code must retain the above copyright notice, this list of conditions | ||
| # and the following disclaimer. | ||
| # * Redistributions in binary form must reproduce the above copyright notice, this list of | ||
| # conditions and the following disclaimer in the documentation and/or other materials provided | ||
| # with the distribution. | ||
| # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors | ||
| # may be used to endorse or promote products derived from this software without specific prior | ||
| # written permission. | ||
| # | ||
| # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR | ||
| # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
| # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR | ||
| # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER | ||
| # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | ||
| # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| # ------------------------------------------------------------------------------------------------- | ||
| # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- | ||
| # vim: ft=zsh sw=2 ts=2 et | ||
| # ------------------------------------------------------------------------------------------------- | ||
|
|
||
| BUFFER='function () () pwd' | ||
|
|
||
| expected_region_highlight=( | ||
| '1 8 reserved-word' # function | ||
| '10 11 reserved-word' # () | ||
| '13 14 reserved-word' # () | ||
| '16 18 builtin' # pwd | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| #!/usr/bin/env zsh | ||
| # ------------------------------------------------------------------------------------------------- | ||
| # Copyright (c) 2018 zsh-syntax-highlighting contributors | ||
| # All rights reserved. | ||
| # | ||
| # Redistribution and use in source and binary forms, with or without modification, are permitted | ||
| # provided that the following conditions are met: | ||
| # | ||
| # * Redistributions of source code must retain the above copyright notice, this list of conditions | ||
| # and the following disclaimer. | ||
| # * Redistributions in binary form must reproduce the above copyright notice, this list of | ||
| # conditions and the following disclaimer in the documentation and/or other materials provided | ||
| # with the distribution. | ||
| # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors | ||
| # may be used to endorse or promote products derived from this software without specific prior | ||
| # written permission. | ||
| # | ||
| # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR | ||
| # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
| # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR | ||
| # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER | ||
| # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | ||
| # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| # ------------------------------------------------------------------------------------------------- | ||
| # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- | ||
| # vim: ft=zsh sw=2 ts=2 et | ||
| # ------------------------------------------------------------------------------------------------- | ||
|
|
||
| BUFFER='function f () () pwd' | ||
|
|
||
| expected_region_highlight=( | ||
| '1 8 reserved-word' # function | ||
| '10 10 function-definition' # f | ||
| '12 13 reserved-word' # () | ||
| '15 16 reserved-word' # () | ||
| '18 20 builtin' # pwd | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test cases (written before I read the diff):
function { pwd }— anonymous functionfunction pwd— defines a function namedpwd, not runs that commandfunction >/dev/null { pwd }— anonymous functionfunction f >/dev/null { pwd }— named function with sticky redirectionfunction >/dev/null f { pwd }— syntax error (!)The above also support an optional
()after the function names and before the brace.() {}— anonymous function() pwd— anonymous function() () () pwd— anonymous function for calling torThe above also come in named variants.
function () () pwd— two anonymous functionsfunction f () () pwd— named function whose body is an anonymous functionfunction () f () pwd— anonymous function that defines a function namedffunction () () f pwd— two anonymous functions,fis in command position (unknown-token)Then there's the MULTI_FUNC_DEF variants of all these.
Then there's
unsetopt multifuncdef; function f g h { pwd }— creates a function namedf. Probably a zsh bug, actually, but shouldn't we highlightgandhas errors nevertheless? (I saw the test for the non-function-syntax variant of this.)Question: In
() pwd, should the()be highlighted as a command position? What aboutfunction { pwd }?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another case (github didn't let me edit comment after I pressed the green button):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fun fact:
function >/dev/null f { pwd }is only a syntax error whenright_brace_is_recognised_everywhereis true. The redirection makes it an anonymous function that executesf. The wonders of zsh's grammar.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What should the newline be highlighted as?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about highlighting it the same way as the newlines in
?