File tree 3 files changed +12
-6
lines changed
3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,9 @@ _zsh_highlight_main_highlighter()
101
101
# Tokens that, at (naively-determined) "command position", are followed by
102
102
# a de jure command position. All of these are reserved words.
103
103
ZSH_HIGHLIGHT_TOKENS_CONTROL_FLOW=(
104
+ $' \x7b ' # block
105
+ $' \x28 ' # subshell
106
+ ' ()' # anonymous function
104
107
' while'
105
108
' until'
106
109
' if'
@@ -247,6 +250,9 @@ _zsh_highlight_main_highlighter()
247
250
style=$ZSH_HIGHLIGHT_STYLES [reserved-word]
248
251
_zsh_highlight_main_add_region_highlight $start_pos $(( start_pos + 2 )) $style
249
252
already_added=1
253
+ elif [[ $arg == ' ()' ]]; then
254
+ # anonymous function
255
+ style=$ZSH_HIGHLIGHT_STYLES [reserved-word]
250
256
else
251
257
if _zsh_highlight_main_highlighter_check_path; then
252
258
style=$ZSH_HIGHLIGHT_STYLES [path]
Original file line number Diff line number Diff line change 30
30
BUFFER=' () echo hello; () { echo world }'
31
31
32
32
expected_region_highlight=(
33
- " 1 2 $ZSH_HIGHLIGHT_STYLES [reserved-word] 'issue #194' " # ()
34
- " 4 7 $ZSH_HIGHLIGHT_STYLES [command] 'issue #194' " # echo
33
+ " 1 2 $ZSH_HIGHLIGHT_STYLES [reserved-word]" # ()
34
+ " 4 7 $ZSH_HIGHLIGHT_STYLES [command]" # echo
35
35
" 9 13 $ZSH_HIGHLIGHT_STYLES [default]" # hello
36
36
" 14 14 $ZSH_HIGHLIGHT_STYLES [commandseparator]" # ;
37
- " 16 17 $ZSH_HIGHLIGHT_STYLES [reserved-word] 'issue #194' " # ()
38
- " 19 19 $ZSH_HIGHLIGHT_STYLES [reserved-word] 'issue #194' " # {
39
- " 21 24 $ZSH_HIGHLIGHT_STYLES [command] 'issue #194' " # echo
37
+ " 16 17 $ZSH_HIGHLIGHT_STYLES [reserved-word]" # ()
38
+ " 19 19 $ZSH_HIGHLIGHT_STYLES [reserved-word]" # {
39
+ " 21 24 $ZSH_HIGHLIGHT_STYLES [command]" # echo
40
40
)
Original file line number Diff line number Diff line change @@ -31,6 +31,6 @@ BUFFER='tar cf - * | (cd /target; tar xfp -)'
31
31
32
32
expected_region_highlight=(
33
33
" 1 3 $ZSH_HIGHLIGHT_STYLES [command]" # tar
34
- " 15 16 $ZSH_HIGHLIGHT_STYLES [command] 'issue #166' " # cd
34
+ " 15 16 $ZSH_HIGHLIGHT_STYLES [command]" # cd
35
35
" 27 29 $ZSH_HIGHLIGHT_STYLES [command]" # tar
36
36
)
You can’t perform that action at this time.
0 commit comments